Skip to content

Commit

Permalink
Merge patches from SMEServer (thanks Filippo!)
Browse files Browse the repository at this point in the history
  • Loading branch information
abh committed Jul 20, 2009
2 parents d6154ab + 52a1ba8 commit eb27828
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 5 deletions.
8 changes: 8 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@

Temporary deny if clamd is not running

Modify plugins/virus/clamav option for ClamAV 0.95 (no-summary)

Fix spamassassin plugin log noise if spam score is 0.0

Disconnect host in rhsbl (Charlie Brady)

POD cleanups (Steve Kemp)

check_spamhelo disconnects after denying a 'helo' (Filippo Carletti)
Expand Down
16 changes: 13 additions & 3 deletions plugins/rhsbl
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
#!perl -w

sub register {
my ($self, $qp, $denial ) = @_;
if ( defined $denial and $denial =~ /^disconnect$/i ) {
$self->{_rhsbl}->{DENY} = DENY_DISCONNECT;
}
else {
$self->{_rhsbl}->{DENY} = DENY;
}

}

sub hook_mail {
my ($self, $transaction, $sender, %param) = @_;
Expand Down Expand Up @@ -49,12 +59,12 @@ sub hook_rcpt {
my $result = $self->process_sockets;
if ($result && defined($self->{_rhsbl_zones_map}{$result})) {
if ($result =~ /^$host\./ ) {
return (DENY, "Mail from $host rejected because it " . $self->{_rhsbl_zones_map}{$result});
return ($self->{_rhsbl}->{DENY}, "Mail from $host rejected because it " . $self->{_rhsbl_zones_map}{$result});
} else {
return (DENY, "Mail from HELO $hello rejected because it " . $self->{_rhsbl_zones_map}{$result});
return ($self->{_rhsbl}->{DENY}, "Mail from HELO $hello rejected because it " . $self->{_rhsbl_zones_map}{$result});
}
}
return (DENY, $result) if $result;
return ($self->{_rhsbl}->{DENY}, $result) if $result;
return DECLINED;
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/spamassassin
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ sub hook_data_post { # check_spam
}

}
my $tests = <SPAMD>;
my $tests = <SPAMD>|| '';
close SPAMD;
$tests =~ s/\015//; # hack for outlook
$flag = $flag eq 'True' ? 'Yes' : 'No';
Expand Down
12 changes: 11 additions & 1 deletion plugins/virus/clamav
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ sub register {
elsif (/back_compat/) {
$self->{_back_compat} = '-i --max-recursion=50';
}
elsif (/declined_on_fail/) {
$self->{_declined_on_fail} = 1;
}
else {
$self->log(LOGERROR, "Unrecognized argument '$_' to clamav plugin");
return undef;
Expand All @@ -149,6 +152,7 @@ sub register {
$self->{_spool_dir} ||= $self->spool_dir();
$self->{_back_compat} ||= ''; # make sure something is set
$self->{_clamd_conf} ||= '/etc/clamd/conf'; # make sure something is set
$self->{_declined_on_fail} ||= 0; # decline the message on clamav failure

unless ($self->{_spool_dir}) {
$self->log(LOGERROR, "No spool dir configuration found");
Expand Down Expand Up @@ -187,7 +191,7 @@ sub hook_data_post {
. " --stdout "
. $self->{_back_compat}
. " --config-file=" . $self->{_clamd_conf}
. " --disable-summary $filename 2>&1";
. " --no-summary $filename 2>&1";
$self->log(LOGDEBUG, "Running: $cmd");
my $output = `$cmd`;

Expand All @@ -202,6 +206,7 @@ sub hook_data_post {

if ($signal) {
$self->log(LOGINFO, "clamscan exited with signal: $signal");
return (DENYSOFT) if (!$self->{_declined_on_fail});
return (DECLINED);
}
if ($result == 1) {
Expand All @@ -215,6 +220,11 @@ sub hook_data_post {
}
elsif ($result) {
$self->log(LOGERROR, "ClamAV error: $cmd: $result\n");
return (DENYSOFT) if (!$self->{_declined_on_fail});
}
else {
$transaction->header->add( 'X-Virus-Checked',
"Checked by ClamAV on " . $self->qp->config("me") );
}
return (DECLINED);
}
Expand Down

0 comments on commit eb27828

Please sign in to comment.