--- /usr/local/sbin/amavisd.bckp Mon Apr 9 17:25:57 2007 +++ /usr/local/sbin/amavisd Mon Apr 9 17:30:56 2007 @@ -793,6 +793,7 @@ X-Amavis-PenPals X-Amavis-OS-Fingerprint X-Amavis-PolicyBank X-Spam-Status X-Spam-Level X-Spam-Flag X-Spam-Score X-Spam-Report X-Spam-Checker-Version X-Spam-Tests + X-Spam-CRM114-Status X-Spam-CRM114-CacheID X-DSPAM-Signature X-DSPAM-Result X-DSPAM-Confidence X-DSPAM-Probability X-DSPAM-User X-DSPAM-Factors ); @@ -5016,6 +5017,12 @@ { my($self)=shift; !@_ ? $self->{spam_summary}:($self->{spam_summary}=shift)} sub autolearn_status { my($self)=shift; !@_ ? $self->{a_learn_stat}:($self->{a_learn_stat}=shift)} +sub crm114_status + { my($self)=shift; !@_ ? $self->{crm114_status} :($self->{crm114_status}=shift)} +sub crm114_score + { my($self)=shift; !@_ ? $self->{crm114_score} :($self->{crm114_score}=shift)} +sub crm114_cacheid + { my($self)=shift; !@_ ? $self->{crm114_cacheid} :($self->{crm114_cacheid}=shift)} # the following methods apply on a per-message level as well, summarizing # per-recipient information as far as possible @@ -8157,12 +8164,15 @@ $virus_dejavu = 1; } if ($spam_presence_checked) { - my($spam_level,$spam_status,$spam_report,$spam_summary) = - @$cache_entry{'SL','SS','SR','SY'}; + my($spam_level,$spam_status,$spam_report,$spam_summary,$crm114_score,$crm114_status,$crm114_cacheid) = + @$cache_entry{'SL','SS','SR','SY','SCS','SCT','SCI'}; $msginfo->spam_level($spam_level); $msginfo->spam_status($spam_status); $msginfo->spam_report($spam_report); $msginfo->spam_summary($spam_summary); + $msginfo->crm114_score($crm114_score); + $msginfo->crm114_status($crm114_status); + $msginfo->crm114_cacheid($crm114_cacheid); } do_log(1,"cached %s from <%s> (%s,%s)", $body_digest, $sender, $virus_presence_checked, $spam_presence_checked); @@ -8383,9 +8393,11 @@ Amavis::SpamControl::spam_scan($conn,$msginfo); prolong_timer($which_section); snmp_count('OpsSpamCheck'); - @$cache_entry{'St','SL','SS','SR','SY'} = + @$cache_entry{'St','SL','SS','SR','SY','SCS','SCT','SCI'} = ($now, $msginfo->spam_level, $msginfo->spam_status, - $msginfo->spam_report, $msginfo->spam_summary); + $msginfo->spam_report, $msginfo->spam_summary, + $msginfo->crm114_score, $msginfo->crm114_status, + $msginfo->crm114_cacheid); $spam_presence_checked = 1; } } @@ -8997,7 +9009,8 @@ if (c('remove_existing_spam_headers')) { my(@which_headers) = qw( X-Spam-Status X-Spam-Level X-Spam-Flag X-Spam-Score - X-Spam-Report X-Spam-Checker-Version X-Spam-Tests); + X-Spam-Report X-Spam-Checker-Version X-Spam-Tests + X-Spam-CRM114-Status X-Spam-CRM114-CacheID); push(@which_headers, qw( X-DSPAM-Result X-DSPAM-Confidence X-DSPAM-Probability X-DSPAM-Signature X-DSPAM-User X-DSPAM-Factors)) if defined $dspam; @@ -9199,6 +9212,12 @@ $allowed_hdrs && $allowed_hdrs->{lc('X-Spam-Level')}; $hdr_edits->add_header('X-Spam-Status', $full_spam_status, 1) if $allowed_hdrs && $allowed_hdrs->{lc('X-Spam-Status')}; + $hdr_edits->add_header('X-Spam-CRM114-Status', sprintf("%s ( %s )", + $msginfo->crm114_status,$msginfo->crm114_score), 1) + if $allowed_hdrs && $allowed_hdrs->{lc('X-Spam-CRM114-Status')}; + $hdr_edits->add_header('X-Spam-CRM114-CacheID', + $msginfo->crm114_cacheid, 1) + if $allowed_hdrs && $allowed_hdrs->{lc('X-Spam-CRM114-CacheID')}; } if ($do_tag2 && $is_local) { $hdr_edits->add_header('X-Spam-Report', "\n".$msginfo->spam_report, 2) @@ -16188,6 +16207,8 @@ my($spamassassin_obj) = $self->{'spamassassin_obj'}; my($spam_level,$sa_tests,$spam_report,$spam_summary,$autolearn_status); my($fh) = $msginfo->mail_text; + our ($crm114_status,$crm114_score,$crm114_cacheid); + local ($crm114_status,$crm114_score,$crm114_cacheid); $which_section = 'SA msg read'; # read mail into memory (horror!) in preparation for SpamAssassin $fh->seek(0,0) or die "Can't rewind mail file: $!"; @@ -16234,6 +16255,10 @@ # $spam_summary = $per_msg_status->get_tag('SUMMARY'); $spam_report = $per_msg_status->get_tag('REPORT'); + $crm114_status = $per_msg_status->get_tag('CRM114STATUS'); + $crm114_score = $per_msg_status->get_tag('CRM114SCORE'); + $crm114_cacheid = $per_msg_status->get_tag('CRM114CACHEID'); + #examples of obtaining additional information from SA: # my($rly_trusted) = $per_msg_status->get_tag('RELAYSTRUSTED'); # my($rly_untrusted) = $per_msg_status->get_tag('RELAYSUNTRUSTED'); @@ -16256,7 +16281,7 @@ umask($saved_umask); # SA changes umask to 0077 # section_time($which_section); if ($eval_stat ne '') { chomp($eval_stat); die $eval_stat } # resignal - ($spam_level, $sa_tests, $spam_report, $spam_summary, $autolearn_status); + ($spam_level, $sa_tests, $spam_report, $spam_summary, $autolearn_status, $crm114_status, $crm114_score, $crm114_cacheid); } sub check { @@ -16266,6 +16291,7 @@ my($dspam_signature,$dspam_result,$dspam_fname); my($which_section); my(@lines); my($spam_level,$sa_tests,$spam_report,$spam_summary,$autolearn_status); + my($crm114_status, $crm114_score, $crm114_cacheid); my($fh) = $msginfo->mail_text; my($hdr_edits) = $msginfo->header_edits; if (!$hdr_edits) { @@ -16383,7 +16409,7 @@ collect_results_structured($proc_fh,$pid,'SA',200*1024); @results = @$results_ref if defined $results_ref; } - ($spam_level,$sa_tests,$spam_report,$spam_summary,$autolearn_status) = + ($spam_level,$sa_tests,$spam_report,$spam_summary,$autolearn_status,$crm114_status,$crm114_score,$crm114_cacheid) = @results; }; my($eval_stat) = $@; @@ -16433,6 +16459,9 @@ $msginfo->spam_level($spam_level); $msginfo->spam_status($sa_tests); $msginfo->spam_report($spam_report); $msginfo->spam_summary($spam_summary); $msginfo->autolearn_status($autolearn_status); + $msginfo->crm114_status($crm114_status); + $msginfo->crm114_score($crm114_score); + $msginfo->crm114_cacheid($crm114_cacheid); $spam_level; }