[Mimedefang] Correction about Autolearn Headers

Kevin A. McGrail kmcgrail at pccc.com
Tue Jun 1 13:48:16 EDT 2004


Kelson,

I've looked at the 2.63 source code and MD 2.42 source about this and I
think the auto_learn information *is* available though not documented.

The changes I think are required are basically this:

1. do not use the spam_assassin_check built into MD.
2. make your own spam_assassin_check that checks the permsgstatus object and
builds the autolearn information


here's my first (untested) pass at the problem
(http://www.peregrinehw.com/downloads/MIMEDefang/contrib/autolearn_info):

sub my_spam_assassin_check (;$) {

    my($status) = spam_assassin_status(@_);
    return undef if (!defined($status));

    my $hits = $status->get_hits;
    my $req = $status->get_required_hits();
    my $tests = $status->get_names_of_tests_hit();
    my $report = $status->get_report();
    my $autolearn = "";

    #Check if Bayesian is Turned On, If AutoTesting is Turned On, or if
AutoLearning is turned off
    #I believe $SASpamTester will have this info and will be in scope if
called from filter_end.
    if (($SASpamTester->{conf}->{bayes_auto_learn}) and
        ($SASpamTester->{conf}->{use_bayes}) and
        (!$SASpamTester->{disable_auto_learning})) {


      if (!defined($status->{auto_learn_status})) {
         $autolearn="no";
      } elsif ($spamstatus->{auto_learn_status}) {
         $autolearn="spam";
      } else {
         $autolearn = "ham";
      }
    }

      $status->finish();

    return ($hits, $req, $tests, $report, $autolearn);
}

I then have a build_status_line function that I would pass the extra
autolearn information and add it to the header. (see build_status_line at
the bottom
http://www.peregrinehw.com/downloads/MIMEDefang/mimedefang-filter-KAM)

Any comments?  The check of the conf file above is not 100% needed so I
think this will work since we have access to the PerMsgStatus handler prior
to descoping it.

Regards,
KAM

> >You can do this already; just call spam_assassin_status from your
> >filter, and process the status object yourself.  Heck, it's even
> >documented in the mimedefang-filter man page. :-)
>
> This was possible in SA 2.5x - however, beginning with 2.60, the
> SpamAssassin object no longer exposes the auto-learn results or the
> function to build the status line.  (It didn't technically expose either
> before, but you could get the status line through an undocumented function
> -- which no longer exists.)  You can construct it from all the other
> pieces, but auto-learn isn't available.



More information about the MIMEDefang mailing list