[Mimedefang] [PATCH] Mimedefang and clamd/clamav 0.90

Martin Blapp mb at imp.ch
Sat Feb 17 02:39:19 EST 2007


Hi David,

If you use mimedefang 2.61 and clamd 0.90 together you will soon notice
a lot of errors in your maillog:

> Feb 15 19:05:45 filter1 mimedefang.pl[80173]: l1FI5gps090153: Clamd returned 
> error: Zip module failure

For this kind of error we have a fallback to clamscan in your config files.
Unfortunalty the fallback doesn't work anymore, because the clamav folks
have removed the --mbox option.

And I found other mails failing with this error:

> Feb 16 21:34:18 filter1 mimedefang.pl[80173]: l1GKY0OX024228: Clamd returned 
> error: Not supported data format

Nice. After adding "Not supported data format" to the zip regex, the mails
were checked sucessfully by clamscan instead of tempfailing. I guess we need 
this workaround too.

Martin

--- mimedefang.pl.in.orig	Thu Jan 18 15:43:12 2007
+++ mimedefang.pl.in	Sat Feb 17 08:29:06 2007
@@ -3669,7 +3669,7 @@

      # Run clamscan
      my($code, $category, $action) =
-	run_virus_scanner($Features{'Virus:CLAMAV'} . " --mbox --stdout --disable-summary --infected $path 2>&1");
+	run_virus_scanner($Features{'Virus:CLAMAV'} . " --stdout --disable-summary --infected $path 2>&1");
      if ($action ne 'proceed') {
  	return (wantarray ? ($code, $category, $action) : $code);
      }
@@ -3693,7 +3693,7 @@

      # Run clamscan
      my($code, $category, $action) =
-	run_virus_scanner($Features{'Virus:CLAMAV'} . " -r --mbox --stdout --disable-summary --infected ./Work 2>&1");
+	run_virus_scanner($Features{'Virus:CLAMAV'} . " -r --stdout --disable-summary --infected ./Work 2>&1");
      if ($action ne 'proceed') {
  	return (wantarray ? ($code, $category, $action) : $code);
      }
@@ -4506,10 +4506,10 @@
  	    md_syslog('err', "$MsgID: Clamd returned error: $err_detail");
  	    # If it's a zip module failure, try falling back on clamscan.
  	    # This is despicable, but it might work
-	    if ($err_detail =~ /zip module failure/i &&
+	    if ($err_detail =~ /(?:zip module failure|Not supported data format)/i &&
  		$Features{'Virus:CLAMAV'}) {
  		my ($code, $category, $action) =
-		run_virus_scanner($Features{'Virus:CLAMAV'} . " -r --unzip --mbox --stdout --disable-summary --infected $CWD/Work 2>&1");
+		run_virus_scanner($Features{'Virus:CLAMAV'} . " -r --unzip --stdout --disable-summary --infected $CWD/Work 2>&1");
  		if ($action ne 'proceed') {
  			return (wantarray ? ($code, $category, $action) : $code);
  		}
@@ -4603,10 +4603,10 @@
  	    md_syslog('err', "$MsgID: Clamd returned error: $err_detail");
  	    # If it's a zip module failure, try falling back on clamscan.
  	    # This is despicable, but it might work
-	    if ($err_detail =~ /zip module failure/i &&
+	    if ($err_detail =~ /(?:zip module failure|Not supported data format)/i &&
  		$Features{'Virus:CLAMAV'}) {
  		my ($code, $category, $action) =
-		    run_virus_scanner($Features{'Virus:CLAMAV'} . " -r --unzip --mbox --stdout --disable-summary --infected $CWD/Work 2>&1");
+		    run_virus_scanner($Features{'Virus:CLAMAV'} . " -r --unzip --stdout --disable-summary --infected $CWD/Work 2>&1");
  		if ($action ne 'proceed') {
  			return (wantarray ? ($code, $category, $action) : $code);
  		}

Martin Blapp, <mb at imp.ch> <mbr at FreeBSD.org>
------------------------------------------------------------------
ImproWare AG, UNIXSP & ISP, Zurlindenstrasse 29, 4133 Pratteln, CH
Phone: +41 61 826 93 00 Fax: +41 61 826 93 01
PGP: <finger -l mbr at freebsd.org>
PGP Fingerprint: B434 53FC C87C FE7B 0A18 B84C 8686 EF22 D300 551E
------------------------------------------------------------------
-------------- next part --------------
--- mimedefang.pl.in.orig	Thu Jan 18 15:43:12 2007
+++ mimedefang.pl.in	Sat Feb 17 08:29:06 2007
@@ -3669,7 +3669,7 @@
 
     # Run clamscan
     my($code, $category, $action) =
-	run_virus_scanner($Features{'Virus:CLAMAV'} . " --mbox --stdout --disable-summary --infected $path 2>&1");
+	run_virus_scanner($Features{'Virus:CLAMAV'} . " --stdout --disable-summary --infected $path 2>&1");
     if ($action ne 'proceed') {
 	return (wantarray ? ($code, $category, $action) : $code);
     }
@@ -3693,7 +3693,7 @@
 
     # Run clamscan
     my($code, $category, $action) =
-	run_virus_scanner($Features{'Virus:CLAMAV'} . " -r --mbox --stdout --disable-summary --infected ./Work 2>&1");
+	run_virus_scanner($Features{'Virus:CLAMAV'} . " -r --stdout --disable-summary --infected ./Work 2>&1");
     if ($action ne 'proceed') {
 	return (wantarray ? ($code, $category, $action) : $code);
     }
@@ -4506,10 +4506,10 @@
 	    md_syslog('err', "$MsgID: Clamd returned error: $err_detail");
 	    # If it's a zip module failure, try falling back on clamscan.
 	    # This is despicable, but it might work
-	    if ($err_detail =~ /zip module failure/i &&
+	    if ($err_detail =~ /(?:zip module failure|Not supported data format)/i &&
 		$Features{'Virus:CLAMAV'}) {
 		my ($code, $category, $action) =
-		run_virus_scanner($Features{'Virus:CLAMAV'} . " -r --unzip --mbox --stdout --disable-summary --infected $CWD/Work 2>&1");
+		run_virus_scanner($Features{'Virus:CLAMAV'} . " -r --unzip --stdout --disable-summary --infected $CWD/Work 2>&1");
 		if ($action ne 'proceed') {
 			return (wantarray ? ($code, $category, $action) : $code);
 		}
@@ -4603,10 +4603,10 @@
 	    md_syslog('err', "$MsgID: Clamd returned error: $err_detail");
 	    # If it's a zip module failure, try falling back on clamscan.
 	    # This is despicable, but it might work
-	    if ($err_detail =~ /zip module failure/i &&
+	    if ($err_detail =~ /(?:zip module failure|Not supported data format)/i &&
 		$Features{'Virus:CLAMAV'}) {
 		my ($code, $category, $action) =
-		    run_virus_scanner($Features{'Virus:CLAMAV'} . " -r --unzip --mbox --stdout --disable-summary --infected $CWD/Work 2>&1");
+		    run_virus_scanner($Features{'Virus:CLAMAV'} . " -r --unzip --stdout --disable-summary --infected $CWD/Work 2>&1");
 		if ($action ne 'proceed') {
 			return (wantarray ? ($code, $category, $action) : $code);
 		}


More information about the MIMEDefang mailing list