* plugins/virus/clamdscan

Use LOGNOTICE instead of LOGERROR when bailing early due to
    non-multipart message.

    Test clamd->ping() before scanning, and bail if it doesn't
    answer (with an appropriate error).

    Patch submitted by Dave Rolsky <autarch@urth.org>.

git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@583 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
John Peacock 2005-12-10 21:11:04 +00:00
parent 27975f5cee
commit c9779a3376

View File

@ -118,7 +118,7 @@ sub hook_data_post {
unless ( $content_type unless ( $content_type
&& $content_type =~ m!\bmultipart/.*\bboundary="?([^"]+)!i ) && $content_type =~ m!\bmultipart/.*\bboundary="?([^"]+)!i )
{ {
$self->log( LOGERROR, "non-multipart mail - skipping" ); $self->log( LOGNOTICE, "non-multipart mail - skipping" );
return DECLINED; return DECLINED;
} }
@ -153,7 +153,10 @@ sub hook_data_post {
$clamd = Clamd->new(); # default unix domain socket $clamd = Clamd->new(); # default unix domain socket
} }
return (DECLINED) unless $clamd->ping(); unless ( $clamd->ping() ) {
$self->log( LOGERROR, "Cannot ping clamd server - did you provide the correct clamd port or socket?" );
return DECLINED;
}
if ( my %found = $clamd->scan($filename) ) { if ( my %found = $clamd->scan($filename) ) {
my $viruses = join( ",", values(%found) ); my $viruses = join( ",", values(%found) );