On Monday 14 July 2008 19:49:30 Jonathan Skanes wrote: > On Sunday 13 July 2008 01:11:04 Jonathan Skanes wrote: > > Hi all, > > > > I'm using an Amavis/SpamAssassin/Postfix setup on a fresh install of > > Ubuntu Hardy. I don't see any reference to the autolearn= field in any > > of the mail headers Amavis is generating. What am I missing? > > > > Here are the versions: > > > > amavisd-new: > > Installed: 1:2.5.3-1ubuntu3 > > Candidate: 1:2.5.3-1ubuntu3 > > Version table: > > *** 1:2.5.3-1ubuntu3 0 > > 500 http://gulus.usherbrooke.ca hardy/main Packages > > 100 /var/lib/dpkg/status > > spamassassin: > > Installed: 3.2.4-1ubuntu1 > > Candidate: 3.2.4-1ubuntu1 > > Version table: > > *** 3.2.4-1ubuntu1 0 > > 500 http://gulus.usherbrooke.ca hardy/universe Packages > > 100 /var/lib/dpkg/status > > > > So I got bored and started poking around in the code. Can anyone see any > issues with doing this? >
I updated my changes to reflect the semantics of Spamassassin. It returns 'autolearn=unavailable' if the message isn't scanned, ie. too big. Use this at your own risk. It seems to work well for me. Oh, and cheers to the developers, I found the code easy to read :) Feel free to include this, with attribution, if you think others may find it useful. --- /usr/sbin/amavisd-new-dist 2008-07-14 19:37:33.000000000 -0230 +++ /usr/sbin/amavisd-new 2008-07-15 17:54:49.000000000 -0230 @@ -9833,6 +9833,7 @@ my($do_p0f) = $is_local && $os_fp ne '' && $allowed_hdrs && $allowed_hdrs->{lc('X-Amavis-OS-Fingerprint')}; my($tag_level, $tag2_level, $subject_tag, $pp_age); + my($autolearn_status) = ( $msginfo->supplementary_info('AUTOLEARN') || 'unavailable' ); if ($allowed_hdrs && $allowed_hdrs->{lc('X-Amavis-PenPals')}) { $pp_age = $r->recip_penpals_age; $pp_age = format_time_interval($pp_age) if defined $pp_age; @@ -9896,10 +9897,11 @@ # : 0+sprintf("%.3f",$spam_level); # trim fraction # my($bl) = !defined($boost) ? undef : 0+sprintf("%.3f",$boost); # (!defined($boost) || $bl==0 ? $sl : $bl>=0 ? $sl.'+'.$bl : $sl.$bl), - $full_spam_status = sprintf("%s,\n score=%s\n %s%s%stests=[%s]", + $full_spam_status = sprintf("%s,\n score=%s\n autolearn=%s\n %s%s%stests=[%s]", $do_tag2 ? 'Yes' : 'No', !defined($spam_level) && !defined($boost) ? 'x' : 0+sprintf("%.3f",$spam_level+$boost), + $autolearn_status, !defined $tag_level || $tag_level eq '' ? '' : sprintf("tagged_above=%s\n ",$tag_level), !defined $tag2_level ? '' : sprintf("required=%s\n ", $tag2_level), @@ -10428,6 +10430,7 @@ my($tag_level_min,$tag2_level_min,$kill_level_min,$boost_max); my($spam_level) = $msginfo->spam_level; my(@q_addr,@qar_addr,@a_addr); # per-recip quarantine address(es) and admins + my($autolearn_status) = ( $msginfo->supplementary_info('AUTOLEARN') || 'unavailable' ); for my $r (@{$msginfo->per_recip_data}) { my($rec) = $r->recip_addr; my($blocking_ccat) = $r->blocking_ccat; @@ -10515,9 +10518,10 @@ my($sl) = !defined($spam_level) ? 'x' : 0+sprintf("%.3f",$spam_level); # trim my($bl) = !defined($boost_max) ? undef: 0+sprintf("%.3f",$boost_max); # trim my($full_spam_status) = sprintf( - "%s,\n score=%s\n tag=%s\n tag2=%s\n kill=%s\n %stests=[%s]", + "%s,\n score=%s\n autolearn=%s\n tag=%s\n tag2=%s\n kill=%s\n %stests=[%s]", $do_tag2_any||$do_kill_any ? 'Yes' : 'No', (!defined($boost_max) || $bl==0 ? $sl : $bl>=0 ? $sl.'+'.$bl : $sl.$bl), + $autolearn_status, (map { !defined $_ ? 'x' : 0+sprintf("%.3f",$_) } ($tag_level_min, $tag2_level_min, $kill_level_min)), join('', $blacklisted_any ? "BLACKLISTED\n " : (), @@ -10593,7 +10597,6 @@ } if (ll(2) && $msginfo->is_in_contents_category(CC_SPAM)) { # log entry compatible with older log parsers - my($autolearn_status) = $msginfo->supplementary_info('AUTOLEARN'); $s = $full_spam_status; $s =~ s/\n[ \t]/ /g; do_log(2,"SPAM, %s -> %s, %s%s%s", $msginfo->sender_smtp, join(',', qquote_rfc2821_local(@{$msginfo->recips})), $s, ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ AMaViS-user mailing list AMaViS-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amavis-user AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3 AMaViS-HowTos:http://www.amavis.org/howto/