diff -ur amavisd-new-20020517.orig/amavis/amavisd.in amavisd-new-20020517/amavis/amavisd.in --- amavisd-new-20020517.orig/amavis/amavisd.in Tue Sep 17 15:27:37 2002 +++ amavisd-new-20020517/amavis/amavisd.in Tue Sep 17 15:27:29 2002 @@ -380,7 +380,7 @@ # Razor, SpamAssassin my(%razor_options, $razor_body_signature, $spamassasin_obj); -my($spam_found, $spam_report); +my($spam_found, $spam_report, $spam_hits); use vars qw ( %whitelist_sender @whitelist_sender ); my(%scan_cache, $body_signature, @timing); @@ -810,7 +810,7 @@ $entity = undef; @SENDER_CONTACT = ( $SENDER ); $VIRUSFILE = undef; $output = undef; @virusname = (); $some_compression = 0; getfilename_reset(); - $spam_found = undef; $spam_report = undef; + $spam_found = undef; $spam_report = undef; $spam_hits = undef; $body_signature = undef; $razor_body_signature = undef; @@ -924,7 +924,7 @@ } } else { $which_section = "spam_scan"; - $spam_found = spam_scan($fh); + ($spam_found,$spam_hits) = spam_scan($fh); prolong_timer($which_section); if (defined($body_signature)) { # save results to cache $scan_cache{$body_signature}{'SF'} = $spam_found; @@ -1223,7 +1223,12 @@ $_ .= "X-AMaViS-Alert: INFECTED, message contains virus: " . join(', ',@virusname) . "\n" if @virusname; $_ .= "X-Razor-id: $razor_body_signature\n" if $razor_body_signature ne ""; - $_ .= "X-Spam-Status: $spam_report\n" if $spam_found && $spam_report ne ""; + if ($spam_found) { + $_ .= "X-Spam-Status: $spam_report\n" if $spam_report ne ""; + $_ .= "X-Spam-Flag: YES\n"; + $_ .= "X-Spam-Level: " . '*' x ($spam_hits <= 0 ? 0 : + ($spam_hits > 40 ? 40 : int($spam_hits+0.5))) . "\n"; + } $_ .= "\n"; &$print_method($_) or die "sending mail header3: $!"; } @@ -2032,7 +2037,7 @@ # try SpamAssassin - my($sa_spam_found,$per_msg_status); + my($sa_spam_found,$per_msg_status,$sa_hits); if ($size > $sa_mail_size_limit) { do_log(1, "spam_scan: don't waste time on SA, message longer than $sa_mail_size_limit bytes"); $sa_spam_found = $razor_spam_found; @@ -2056,7 +2061,7 @@ $sa_spam_found = $razor_spam_found; $spam_report = "tests=Razor" if $razor_spam_found; } else { - my($sa_hits) = $per_msg_status->get_hits + $sa_hits = $per_msg_status->get_hits + ($razor_spam_found ? 3 : 0); $sa_spam_found = $sa_hits >= $per_msg_status->get_required_hits; $spam_report = sprintf("hits=%3.1f tests=%s", @@ -2073,7 +2078,7 @@ $spam_report = ($sa_spam_found ? 'Yes' : 'No') . ($spam_report ne '' ? ', ' : '') . $spam_report; do_log( ($sa_spam_found ? 0 : 1), "spam_scan: $spam_report, <$SENDER>"); - $sa_spam_found; + ($sa_spam_found, $sa_hits); } #