--- qpsmtpd-0.40/plugins/virus/clamav.clamav_fix 2007-06-14 11:57:23.000000000 -0600 +++ qpsmtpd-0.40/plugins/virus/clamav 2007-06-14 13:55:41.000000000 -0600 @@ -139,6 +139,9 @@ 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; @@ -149,6 +152,7 @@ $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"); @@ -202,6 +206,7 @@ if ($signal) { $self->log(LOGINFO, "clamscan exited with signal: $signal"); + return (DENYSOFT) if (!$self->{_declined_on_fail}); return (DECLINED); } if ($result == 1) { @@ -213,8 +218,13 @@ return (DENY, "Virus Found: $output"); } } + else { + $transaction->header->add( 'X-Virus-Checked', + "Checked by ClamAV on " . $self->qp->config("me") ); + } elsif ($result) { $self->log(LOGERROR, "ClamAV error: $cmd: $result\n"); + return (DENYSOFT) if (!$self->{_declined_on_fail}); } return (DECLINED); }