FreeBsd e-mail question

Ian Smith smithi at nimnet.asn.au
Thu Oct 4 09:34:23 PDT 2007


On Thu, 4 Oct 2007, Erik Trulsson wrote:
 > On Thu, Oct 04, 2007 at 04:56:35PM +1000, Ian Smith wrote:
 > > On Wed, 3 Oct 2007 16:30:54 -0400 Lisa Casey <lisa at jellico.com> wrote:
 > > 
 > >  > The problem comes in when a customer cancels his account. We remove users by 
 > >  > rmuser username. That command removes the user from the password file, 
 > >  > removes his home directory and removes the mailspool. What it doesn't do is 
 > >  > to remove the .username.pop file associated with that mailbox. This isn't a 
 > >  > problem unless we add another account with the same username. The new 
 > >  > account cannot pop his mail because he gets the following  error messge:
 > >  > 
 > >  > -ERR [SYS/PERM] Temporary drop /var/mail/.jjvc.pop not owned by jjvc.
 > >  > 
 > >  > If I take a look at /var/mail/.jjvc.pop it isn't owned by anyone, the 
 > >  > ownership of the file is the group number of the original jjvc.
 > >  > 
 > >  > -rw-rw----   1 1473             mail                     0 Sep 11 19:15 
 > >  > .jjvc.pop
 > >  > 
 > >  > Is there anyway to have rmuser remover the mail drop file associated with 
 > >  > that account also, or am I just going to have to remove these manually?
 > > 
 > > I've read this whole thread, and what's strange is that this used to
 > > work.  I just checked our old FreeBSD 2.2.6 system where rmuser always
 > > cleaned up /var/mail/.{$user}.pop properly.  Its /usr/sbin/rmuser had: 
 > > 
 > >  # Remove some pop daemon's leftover file
 > >  $file = "$mail_dir/.${login_name}.pop";
 > >  if (-e $file || -l $file) {
 > >      print STDERR "Removing pop daemon's temporary mail file ${file}:";
 > >      unlink $file ||
 > >          print STDERR "\n${whoami}: Warning: unlink on $file failed ($!) - continuing\n";
 > >      print STDERR " done.\n";
 > >  }
 > > 
 > > So I wonder whether it's a bug - or maybe a later popper update? - that
 > > has the present version of rmuser looking for ${MAILSPOOL}/${login}.pop
 > > instead?
 > 
 > As far as I can tell the change was introduced back in 2002 when rmuser was
 > changed from a Perl program into a shell script - presumably as part of the
 > process of removing Perl from the base system.
 > FreeBSD versions 2.2 - 4.11 used the Perl version of rmuser, while all
 > 5.x and 6.x releases have used the shell script version.
 > 
 > I have no idea if the difference - if the file rmuser looks for has a leading
 > '.' in the filename or not - was deliberate or simply a mistake, but I
 > suspect the latter: it is the kind of thing that is very easy to miss when
 > rewriting a program in another language.

Looks like that's exactly right.  Copying the maintainer and suggesting
the no-brain patch, pardon the broken tabs from pasting, against the
head / stable versions (checked) .. I should sendPR I guess .. time!

Cheers, Ian

--- /usr/sbin/rmuser    Sat Mar  3 16:48:29 2007
+++ /home/smithi/rmuser Fri Oct  5 00:30:51 2007
@@ -86,10 +86,10 @@
                    echo -n " mailspool"
                rm ${MAILSPOOL}/$login
        fi
-       if [ -f ${MAILSPOOL}/${login}.pop ]; then
-               verbose && echo -n " ${MAILSPOOL}/${login}.pop" ||
+       if [ -f ${MAILSPOOL}/.${login}.pop ]; then
+               verbose && echo -n " ${MAILSPOOL}/.${login}.pop" ||
                    echo -n " pop3"
-               rm ${MAILSPOOL}/${login}.pop
+               rm ${MAILSPOOL}/.${login}.pop
        fi
        verbose && echo '.'
 }



More information about the freebsd-questions mailing list