You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2004/09/29 21:48:43 UTC

[Bug 3848] SA 3.0 time outs with amavis+razor

http://bugzilla.spamassassin.org/show_bug.cgi?id=3848

jm@jmason.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID



------- Additional Comments From jm@jmason.org  2004-09-29 12:48 -------
Mail/SpamAssassin/NoMailAudit.pm is no longer supported in SA 3.0.0 -- you have
an older version of amavisd that is not supported by 3.0.0.  you need to upgrade
amavisd to the more recent versions which support SA 3.0.0.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

Re: [Bug 3848] SA 3.0 time outs with amavis+razor

Posted by Bob Apthorpe <ap...@cynistar.net>.
Hi,
On Wed, 29 Sep 2004, Theo Van Dinter wrote:

> On Wed, Sep 29, 2004 at 03:32:22PM -0500, Bob Apthorpe wrote:
> > If I wanted to analyzed a message using either SA 2.6x or 3.x, what do I
> > use to encapsulate that message aside from
> > Mail::SpamAssassin::NoMailAudit? That is, how do I have to change:
> >
> > ----
> >         $self->{'_mail'} = Mail::SpamAssassin::NoMailAudit->new();
> >
> >         # Make a M::SA object; point to custom configs
> >         my $spamtest = Mail::SpamAssassin->new($self->{'sa_prefs'});
> >
> >         # Get verdict, score, list of rules
> >         my $status = $spamtest->check($self->{'_mail'});
> > ----
> >
> > so that it'll work with both SA 2.6x and 3.x?
>
> the top of the M::SA docs have it pretty clear:
>
>          my $spamtest = Mail::SpamAssassin->new();
>          my $mail = $spamtest->parse( $message );
>          my $status = $spamtest->check( $mail );
>
> We decided to change the API to just call parse() which will return the
> appropriate object instead of calling NoMailAudit (or in 3.0, Message,) and
> doing it yourself (although you can do that, the parse() method lets us change
> things on the backend without having to change the published API).
>
> So in theory, you could figure out what version you're on, then do an if/else
> to call NMA or parse() appropriately.

Ok, so let me see if I have this straight:

At the head of the module where all the 'use' statements live...
----
use Mail::SpamAssassin;

use Mail::Header;
use Mail::Internet;

if ($Mail::SpamAssassin::VERSION < 3) {
    use Mail::SpamAssassin::NoMailAudit;
} else {
    use Mail::SpamAssassin::Message;
}
----

Then later, once we've wrapped the text in fake mail headers to make
a RFC822-compliant message...
----
    my $message =
      Mail::Internet->new('Header' => $mailhead, 'Body' => $Rl_body);

    # Fake up a mail message and stuff the comment in the body
    if ($Mail::SpamAssassin::VERSION < 3) {
        $self->{'_mail'} =
          Mail::SpamAssassin::NoMailAudit->new('data' =>
[$message->as_string]);
    } else {
        $self->{'_mail'} =
          Mail::SpamAssassin::Message->new({'message' =>
$message->as_string});
    }
----

And finally, analyze the message...
----
    # Make a M::SA object; point to custom configs
    my $spamtest = Mail::SpamAssassin->new($self->{'sa_prefs'});

    # Get verdict, score, list of rules
    my $status = $spamtest->check($self->{'_mail'});
----

That should gracefully handle both SA 2.x and 3.x, correct?

-- Bob

Re: [Bug 3848] SA 3.0 time outs with amavis+razor

Posted by Theo Van Dinter <fe...@kluge.net>.
On Wed, Sep 29, 2004 at 03:32:22PM -0500, Bob Apthorpe wrote:
> If I wanted to analyzed a message using either SA 2.6x or 3.x, what do I
> use to encapsulate that message aside from
> Mail::SpamAssassin::NoMailAudit? That is, how do I have to change:
> 
> ----
>         $self->{'_mail'} = Mail::SpamAssassin::NoMailAudit->new();
> 
>         # Make a M::SA object; point to custom configs
>         my $spamtest = Mail::SpamAssassin->new($self->{'sa_prefs'});
> 
>         # Get verdict, score, list of rules
>         my $status = $spamtest->check($self->{'_mail'});
> ----
> 
> so that it'll work with both SA 2.6x and 3.x?

the top of the M::SA docs have it pretty clear:

         my $spamtest = Mail::SpamAssassin->new();
         my $mail = $spamtest->parse( $message );
         my $status = $spamtest->check( $mail );

We decided to change the API to just call parse() which will return the
appropriate object instead of calling NoMailAudit (or in 3.0, Message,) and
doing it yourself (although you can do that, the parse() method lets us change
things on the backend without having to change the published API).

So in theory, you could figure out what version you're on, then do an if/else
to call NMA or parse() appropriately.

-- 
Randomly Generated Tagline:
"Yeah ... You can give pilots guns ... or here's an idea: Why don't you
 make damn sure the airport is secure!?!?"
                                 - Lewis Black, The Daily Show 2002.07.17

Re: [Bug 3848] SA 3.0 time outs with amavis+razor

Posted by Bob Apthorpe <ap...@cynistar.net>.
Hi,

On Wed, 29 Sep 2004 bugzilla-daemon@bugzilla.spamassassin.org wrote:

> http://bugzilla.spamassassin.org/show_bug.cgi?id=3848
> [...]
> ------- Additional Comments From jm@jmason.org  2004-09-29 12:48 -------
> Mail/SpamAssassin/NoMailAudit.pm is no longer supported in SA 3.0.0 -- you have
> an older version of amavisd that is not supported by 3.0.0.  you need to upgrade
> amavisd to the more recent versions which support SA 3.0.0.

I'm putting the finishing touches on the initial draft of
Text::SpamAssassin (formerly Blog::SpamAssassin) in preparation of posting
it to CPAN.

If I wanted to analyzed a message using either SA 2.6x or 3.x, what do I
use to encapsulate that message aside from
Mail::SpamAssassin::NoMailAudit? That is, how do I have to change:

----
        $self->{'_mail'} = Mail::SpamAssassin::NoMailAudit->new();

        # Make a M::SA object; point to custom configs
        my $spamtest = Mail::SpamAssassin->new($self->{'sa_prefs'});

        # Get verdict, score, list of rules
        my $status = $spamtest->check($self->{'_mail'});
----

so that it'll work with both SA 2.6x and 3.x?

Thanks,

-- 
Bob Apthorpe