g'day! quick patch follows... --j.
-------- Original Message -------- Subject: Patch for SpamAssassin From: "Ryan Snodgrass" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Justin, SpamAssassin is rock solid! Thanks for writing this. So after having SpamAssassin running for a while in the base configuration I decided to add Razor integration. Except things didn't necessarily go so well after doing the install and SpamAssassin started failing mysteriously. The problem was a Razor configuration problem but SA should have been able to recover from this and at least handle in a gracefully degraded maner. The root of the problem was the die() if Razor::Client wasn't instantiated. In this case we should really just emit a warning and not die. We want SpamAssassin to continue to process the e-mail, just without Razor checking. Also in the event of an exception we want to make sure $response is set back to undef so that this method returns as if it didn't run Razor. The following diff of Dns.pm shows the changes: 185,193c185,192 < die "undefined Razor::Client\n" if (!$rc); < < my $ver = $Razor::Client::VERSION; < if ($ver >= 1.12) { < my $respary = $rc->check ('spam' => \@msg); < # response can be "0" or "1". there can be many responses. < # so if we get 5 responses, and one of them's 1, we < # wind up with "00010", which +0 below turns to 10, ie. != 0. < for my $resp (@$respary) { $response .= $resp; } --- > if ($rc) { > my $ver = $Razor::Client::VERSION; > if ($ver >= 1.12) { > my $respary = $rc->check ('spam' => \@msg); > # response can be "0" or "1". there can be many responses. # > so if we get 5 responses, and one of them's 1, we > # wind up with "00010", which +0 below turns to 10, ie. != 0. > for my $resp (@$respary) { $response .= $resp; } 194a194,196 > } else { > $response = $rc->check (\@msg); > } 196c198 < $response = $rc->check (\@msg); --- > warn "undefined Razor::Client\n"; 202a205 > $response = undef; Most of the lines above are reindenting due to the if ($rc) check. Let me know if you have any questions. Thanks! Cheers, Ryan
Justin, SpamAssassin is rock
solid! Thanks for writing this. So after having SpamAssassin
running for a while in the base configuration I decided to add Razor
integration. Except things
didn’t necessarily go so well after doing the install and SpamAssassin started failing mysteriously. The problem was a Razor configuration
problem but SA should have been able to recover from this and at least handle
in a gracefully degraded maner. The root of the problem was the die() if Razor::Client
wasn’t instantiated. In this case we should really just emit a warning and not
die. We want SpamAssassin
to continue to process the e-mail, just without Razor checking. Also in the event of an exception we
want to make sure $response is set back to undef so
that this method returns as if it didn’t run Razor. The following diff of Dns.pm shows the changes: 185,193c185,192 <
die "undefined Razor::Client\n"
if (!$rc); < <
my $ver $Razor::Client::VERSION; <
if ($ver >= 1.12)
{ < my $respary = $rc->check
('spam' => \@msg); < # response
can be "0" or "1". there can be
many responses. < # so if we
get 5 responses, and one of them's 1, we < # wind up
with "00010", which +0 below turns to 10, ie. != 0. < for my $resp (@$respary) { $response .= $resp; } --- >
if ($rc) { > my $ver = $Razor::Client::VERSION; > if ($ver >= 1.12) { >
my $respary = $rc->check ('spam' => \@msg); >
# response can be "0" or "1". there
can be many responses. > # so if we get 5
responses, and one of them's 1, we >
# wind up with "00010", which +0 below turns to 10, ie. != 0. >
for my $resp (@$respary) { $response .= $resp; } 194a194,196 > } else { >
$response = $rc->check
(\@msg); > } 196c198 < $response
= $rc->check (\@msg); --- > warn
"undefined Razor::Client\n"; 202a205 >
$response = undef; Most of the lines above are reindenting
due to the if ($rc)
check. Let me know if you have any
questions. Thanks! Cheers, Ryan |