Possible bug with spam permissions

Jan-Peter Koopmann Jan-Peter.Koopmann at SECEIDOS.DE
Tue Aug 23 14:32:05 IST 2005


    [ The following text is in the "iso-8859-1" character set. ]
    [ Your display is set for the "US-ASCII" character set.  ]
    [ Some characters may be displayed incorrectly. ]

On Tuesday, August 23, 2005 1:14 PM Julian Field wrote:

> Check for the presence or absence of g+s perms on the dir.

I am no perl-guru, but this looks suspicious to me:

  # Store it if they want that
  if ($actions{'store'}) {
    my($dir, $dir2, $spamdir, $uid, $gid, $changeowner);
    $uid = $global::MS->{quar}->{uid};
    $gid = $global::MS->{quar}->{gid};
    $changeowner = $global::MS->{quar}->{changeowner};
    $dir = MailScanner::Config::Value('quarantinedir', $this);
    #$dir2 = $dir . '/' .  MailScanner::Quarantine::TodayDir();   
    $dir2 = $dir . '/' .  $this->{datenumber};
    $spamdir = $dir2 . '/' . $HamSpam;
    #print STDERR "dir = $dir\ndir2 = $dir2\nspamdir = $spamdir\n"; 
    umask $global::MS->{quar}->{dirumask};
    unless (-d $dir) {
      mkdir $dir, 0777;
      chown $uid, $gid, $dir if $changeowner;
    }
    unless (-d $dir2) {
      mkdir $dir2, 0777;
      chown $uid, $gid, $dir2 if $changeowner;
    }
    unless (-d $spamdir) {
    mkdir $spamdir, 0777;
      chown $uid, $gid, $spamdir if $changeowner;
    }
    #print STDERR "Storing spam to $spamdir/" . $this->{id} . "\n";
    #print STDERR "uid=$uid gid=$gid changeowner=$changeowner\n";
    umask $global::MS->{quar}->{fileumask};
    my @paths = $this->{store}->CopyEntireMessage($this, $spamdir, $this->{id},
                                                  $uid, $gid, $changeowner);
    # Remember where we have stored the spam in an archive, so we never 
    # archive infected messages
    #print STDERR "Added " . join(',', @paths) . " to spamarchive\n";
    push @{$this->{spamarchive}}, @paths;
    chown $uid, $gid, "$spamdir/" . $this->{id}; # Harmless if this fails  
  }
  umask 0077; # Safety net


This will do a chown $uid, $gid on the spam file will it not? I added some debugging code to this. At the time of the chown the variables contain this

UID: 26 
GID: 6 0 6

UID 26 --> mailnull --> correct
GID: 6 --> mail --> not correct. 

I have 

Quarantine Group = getqmail

which would be GID 8006. And of course the spam files are created belong to group 'mail'. So this looks like a MailScanner problem and not like a setup/FreeBSD problem.

Regards,
  JP

------------------------ MailScanner list ------------------------
To unsubscribe, email jiscmail at jiscmail.ac.uk with the words:
'leave mailscanner' in the body of the email.
Before posting, read the Wiki (http://wiki.mailscanner.info/) and
the archives (http://www.jiscmail.ac.uk/lists/mailscanner.html).

Support MailScanner development - buy the book off the website!



More information about the MailScanner mailing list