1 |
slords |
1.1 |
--- qpsmtpd-0.40/plugins/virus/clamav.clamav_fix 2007-06-14 11:57:23.000000000 -0600 |
2 |
|
|
+++ qpsmtpd-0.40/plugins/virus/clamav 2007-06-14 13:55:41.000000000 -0600 |
3 |
|
|
@@ -139,6 +139,9 @@ |
4 |
|
|
elsif (/back_compat/) { |
5 |
|
|
$self->{_back_compat} = '-i --max-recursion=50'; |
6 |
|
|
} |
7 |
|
|
+ elsif (/declined_on_fail/) { |
8 |
|
|
+ $self->{_declined_on_fail} = 1; |
9 |
|
|
+ } |
10 |
|
|
else { |
11 |
|
|
$self->log(LOGERROR, "Unrecognized argument '$_' to clamav plugin"); |
12 |
|
|
return undef; |
13 |
|
|
@@ -149,6 +152,7 @@ |
14 |
|
|
$self->{_spool_dir} ||= $self->spool_dir(); |
15 |
|
|
$self->{_back_compat} ||= ''; # make sure something is set |
16 |
|
|
$self->{_clamd_conf} ||= '/etc/clamd/conf'; # make sure something is set |
17 |
|
|
+ $self->{_declined_on_fail} ||= 0; # decline the message on clamav failure |
18 |
|
|
|
19 |
|
|
unless ($self->{_spool_dir}) { |
20 |
|
|
$self->log(LOGERROR, "No spool dir configuration found"); |
21 |
|
|
@@ -202,6 +206,7 @@ |
22 |
|
|
|
23 |
|
|
if ($signal) { |
24 |
|
|
$self->log(LOGINFO, "clamscan exited with signal: $signal"); |
25 |
|
|
+ return (DENYSOFT) if (!$self->{_declined_on_fail}); |
26 |
|
|
return (DECLINED); |
27 |
|
|
} |
28 |
|
|
if ($result == 1) { |
29 |
|
|
@@ -213,8 +218,13 @@ |
30 |
|
|
return (DENY, "Virus Found: $output"); |
31 |
|
|
} |
32 |
|
|
} |
33 |
|
|
+ else { |
34 |
|
|
+ $transaction->header->add( 'X-Virus-Checked', |
35 |
|
|
+ "Checked by ClamAV on " . $self->qp->config("me") ); |
36 |
|
|
+ } |
37 |
|
|
elsif ($result) { |
38 |
|
|
$self->log(LOGERROR, "ClamAV error: $cmd: $result\n"); |
39 |
|
|
+ return (DENYSOFT) if (!$self->{_declined_on_fail}); |
40 |
|
|
} |
41 |
|
|
return (DECLINED); |
42 |
|
|
} |