Re: [Mimedefang] Correction about Autolearn Headers

2004-06-01 Thread Kevin A. McGrail
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.

___
Visit http://www.mimedefang.org and http://www.canit.ca
MIMEDefang mailing list
[EMAIL PROTECTED]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


Re: [Mimedefang] Correction about Autolearn Headers

2004-06-01 Thread Kevin A. McGrail
Gotcha.  Forest for the trees.  The wasted time from someone posting
supposedly working code getting the auto_learn_status from $SASpamTester had
me going 180 degrees the wrong way.


> 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. :-)

___
Visit http://www.mimedefang.org and http://www.canit.ca
MIMEDefang mailing list
[EMAIL PROTECTED]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


Re: [Mimedefang] Correction about Autolearn Headers

2004-06-01 Thread Kelson Vibber
At 09:13 AM 6/1/2004, David F. Skoll wrote:
On Tue, 1 Jun 2004, Kevin A. McGrail wrote:
> Therefore, the only way to make this work that I can see is to modify
> mimedefang.pl.  It would be a simple change to return $status, comment out
> the $status->finish, and return $status to the subfilter where you would
> need to run a $status->finish on it in the subfilter.
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.

Kelson Vibber
SpeedGate Communications  

___
Visit http://www.mimedefang.org and http://www.canit.ca
MIMEDefang mailing list
[EMAIL PROTECTED]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


Re: [Mimedefang] Correction about Autolearn Headers

2004-06-01 Thread David F. Skoll
On Tue, 1 Jun 2004, Kevin A. McGrail wrote:

> Therefore, the only way to make this work that I can see is to modify
> mimedefang.pl.  It would be a simple change to return $status, comment out
> the $status->finish, and return $status to the subfilter where you would
> need to run a $status->finish on it in the subfilter.

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. :-)

Regards,

David.
___
Visit http://www.mimedefang.org and http://www.canit.ca
MIMEDefang mailing list
[EMAIL PROTECTED]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


[Mimedefang] Correction about Autolearn Headers

2004-06-01 Thread Kevin A. McGrail
Many persons, including myself are interested in having the headers in a
MD+SA installation be as similar to SA's original headers as possible.

One of the differences I never solved was the autolearn status for Bayesian
tokens.  I was forwarded some code that originated on the SATalk email which
I unfortunately took on faith because it looked correct.

Unfortunately, after researching this further, it is my opinion that the
auto_learn_status is not available in the MimeDefang SubFilter and certainly
not through the SASpamTester Variable.  Whoever posted the original email on
SATalk had this completely wrong for a MIMEDefang installation.  It is
however, correct logic for the SA Learn status variable.

To go further, the SA Learn Status is a function of the SpamAssassin
PerMsgStatus that gets returned from a call to SpamAssassin's check()
function.

To clarify this in terms of MIMEDefang, the call to SA's check routine is
made in the subroutine spam_assassin_status and the status variable is
returned to spam_assassin_check where it is scoped locally AND finished
prior to executing sub spam_assassin_check.

Therefore, the only way to make this work that I can see is to modify
mimedefang.pl.  It would be a simple change to return $status, comment out
the $status->finish, and return $status to the subfilter where you would
need to run a $status->finish on it in the subfilter.  I will leave that to
Roaring Penguin to decide if they want to make that change.

Regards,
KAM

___
Visit http://www.mimedefang.org and http://www.canit.ca
MIMEDefang mailing list
[EMAIL PROTECTED]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang