[svn:qpsmtpd] r583 - branches/0.3x/plugins/virus

[email protected] 10 Dec 2005 21:11:05 -0000
Newsgroups perl.cvs.qpsmtpd
Message-ID <[email protected]>
Author: jpeacock
Date: Sat Dec 10 13:11:04 2005
New Revision: 583

Modified:
   branches/0.3x/plugins/virus/clamdscan
Log:
* 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 <[email protected]>.

Modified: branches/0.3x/plugins/virus/clamdscan
==============================================================================
--- branches/0.3x/plugins/virus/clamdscan	(original)
+++ branches/0.3x/plugins/virus/clamdscan	Sat Dec 10 13:11:04 2005
@@ -118,7 +118,7 @@ sub hook_data_post {
     unless ( $content_type
         && $content_type =~ m!\bmultipart/.*\bboundary="?([^"]+)!i )
     {
-        $self->log( LOGERROR, "non-multipart mail - skipping" );
+        $self->log( LOGNOTICE, "non-multipart mail - skipping" );
         return DECLINED;
     }
 
@@ -153,7 +153,10 @@ sub hook_data_post {
         $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) ) {
         my $viruses = join( ",", values(%found) );