this patch will prevent multiple X-Spam-Status: occurencys from
overriding your $sa_score and $sa_max values.  for some people who use
the sql logging additions, this is important, otherwise it records
incorrect values.   for everyone else, it's not overly important,
because the only place you will see these incorrect values is in the
x-qs headers.

i.e..
X-Qmail-Scanner: 1.16 (Clear:SA:0(-7.7/4.5):. Processed in 1.550563
secs)

patch is at the bottom of the email...  note it also removes these lines
-  $sa_score='0' if (!$sa_score);
-  $sa_max='0' if (!$sa_max);

there is no point in setting these, when they have already been
initialized at the beginning of the sub to integer 0 values.  setting
these here stores a string 0 value, which is then compared using "=="
(int comparision) when it should actually be "eq".  i know perl does the
type conversion, but it's just not -right-.   if you need sanity
checking at that point, it would be better to have

 $sa_score=0 if ($sa_score !~ /^(-)[0-9]{1}\.[0-9]{1}/);
 $sa_max=0 if ($sa_max !~ /^(-)[0-9]{1}\.[0-9]{1}/);

or even import the Number::Format functions and let it do the dirty
work.

 $sa_score = format_number($sa_score,1,1);
 $sa_max   = format_number($sa_max,1,1);

anything that is invalid would return 0.

dallas

//////////////////////////////////////////////

Patch can be downloaded at:
http://www.engelken.net/code/sub-spamassassin.pl.qs116.patch

It is attached here for mailling list archival purposes.

--- sub-spamassassin.pl.old     Tue Aug 12 11:49:52 2003
+++ sub-spamassassin.pl Tue Aug 12 11:50:33 2003
@@ -8,6 +8,7 @@
   my
($DD,$spamassassin_status,$stop_spamassassin_time,$spamassassin_time);
   my ($sa_status)=0;
   my ($sa_score)=0; my ($sa_max)=0;
+  my ($sa_header) = 0;
   &debug("SA: run $spamc_binary $spamc_options <
$scandir/$wmaildir/new/$file_id");
   open(SA,"$spamc_binary $spamc_options <
$scandir/$wmaildir/new/$file_id|")||&tempfail("cannot run $spamc_binary
< $scandir/$wmaildir/new/$file_id - $!");
 
open(SOUT,">$scandir/$wmaildir/new/$file_id.spamc")||&tempfail("cannot
open for write $scandir/$wmaildir/new/$file_id.spamc - $!");
@@ -18,8 +19,12 @@
     }
     #X-Spam-Status: No, hits=2.8 required=5.0
     if (/^X-Spam-Status: (Yes|No), hits=(.*) required=(.*)/) {
-      $sa_status=1 if ($1 eq "Yes");
-      $sa_score=$2;$sa_max=$3;
+       if (!$sa_header) {
+         $sa_status=1 if ($1 eq "Yes");
+         $sa_score=$2;$sa_max=$3;
+       }
+       $sa_header=1;  # set sa_header=1 to avoid multiple X-Spam-Status
+                     # headers from overriding. we want the first one
from the top
     }
     print SOUT;
   }
@@ -28,9 +33,6 @@
   $sa_status=$spamassassin_status if ($spamc_options =~ /\-c/);
   close(SOUT);

-  $sa_score='0' if (!$sa_score);
-  $sa_max='0' if (!$sa_max);
-
   if ($spamc_options !~ /\-c/ && -s
"$scandir/$wmaildir/new/$file_id.spamc" && $spamassassin_status == 0) {
     &debug("SA: overwriting $scandir/$wmaildir/new/$file_id with
$scandir/$wmaildir/new/$file_id.spamc");
     rename
("$scandir/$wmaildir/new/$file_id.spamc","$scandir/$wmaildir/new/$file_i
d");


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Qmail-scanner-general mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/qmail-scanner-general

Reply via email to