More than one Custom Function

Paul housey at sme-ecom.co.uk
Fri May 15 14:39:27 IST 2009


 
> Thanks Rick thats works like a treat - logging to both mysql and 
> postgres!
>
> I just realised another issue I have, the postgres set up has to use
>
> Quarantine Whole Messages As Queue Files = yes
>
> as when it releases a message it just copies the qf and df file to the 
> mqueue.
>
> Mailwatch requires
>
> Quarantine Whole Messages As Queue Files = no
>
> without changing to much code does anyone know how I can run with 
> both? i.e. quarantine files as both qf df and also as one file?
>
> Cheers
>
> Paul
>
>

Hi Julien

I think you replied to this to say you have the source, i seem to have 
deleted your reply sorry!

I use sendmail and I have altered the CopyEntireMessage subroutine in 
SMDiskStore.pm (bit I changed is noted by >>>>>)

sub CopyEntireMessage {
  my $this = shift;
  my($message, $targetdir, $targetfile, $uid, $gid, $changeowner) = @_;

  #my $hfile = $message->{headerspath};
  #my $dfile = $this->{dpath};
  #my $hpath = $this->{hpath};
  #
  if (MailScanner::Config::Value('storeentireasdfqf')) {
    # Don't need cp or cat any more! Yay :-)
    #system($global::cp . " \"$hpath\" \"$dfile\" \"$targetdir\"");
 >>>>>    my $target = new IO::File "$targetdir/$targetfile", "w";    
 >>>>>    MailScanner::Log::DieLog("writing to $targetdir/$targetfile: $!")
 >>>>>      if not defined $target;
 >>>>>    $this->WriteEntireMessage($message, $target);
    return $this->CopyToDir($targetdir, $targetfile, $uid, $gid, 
$changeowner);
  } else {
    #system($global::cat . " \"$hfile\" \"$dfile\" > 
\"$targetdir/$targetfile\"");
    my $target = new IO::File "$targetdir/$targetfile", "w";
    MailScanner::Log::DieLog("writing to $targetdir/$targetfile: $!")
      if not defined $target;
    $this->WriteEntireMessage($message, $target);
    return ($targetdir . '/' . $targetfile);
  }
}

All I did was copy the code minus the return from the else part of the 
routine.

It seems to be working but I just wondered if you can think of anything 
else I may have broke by doing this? I only want to run it in tandom 
whilst I phase out the old system I have.

Thanks

Paul





More information about the MailScanner mailing list