summaryrefslogtreecommitdiff
path: root/mail/mimedefang/patches/patch-ac
blob: 702383384b85994a57312e46929c8e9b637973b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
$NetBSD: patch-ac,v 1.5 2007/03/14 11:21:33 markd Exp $

--- mimedefang.pl.in.orig	2007-01-19 03:43:12.000000000 +1300
+++ mimedefang.pl.in
@@ -121,26 +121,26 @@ $VirusScannerRoutinesInitialized = 0;
 $SALocalTestsOnly = 1;
 $DoStatusTags = 0;
 
-$Features{'Virus:AVP'}      = ('@AVP@' ne '/bin/false' ? '@AVP@' : 0);
-$Features{'Virus:AVP5'}      = ('@AVP5@' ne '/bin/false' ? '@AVP5@' : 0);
-$Features{'Virus:KAVSCANNER'} = ('@KAVSCANNER@' ne '/bin/false' ? '@KAVSCANNER@' : 0);
-$Features{'Virus:CLAMAV'}   = ('@CLAMSCAN@' ne '/bin/false' ? '@CLAMSCAN@' : 0);
-$Features{'Virus:CLAMD'}    = ('@CLAMD@' ne '/bin/false' ? '@CLAMD@' : 0);
-$Features{'Virus:FPROT'}    = ('@FPROT@' ne '/bin/false' ? '@FPROT@' : 0);
-$Features{'Virus:FSAV'}     = ('@FSAV@' ne '/bin/false' ? '@FSAV@' : 0);
-$Features{'Virus:HBEDV'}    = ('@HBEDV@' ne '/bin/false' ? '@HBEDV@' : 0);
-$Features{'Virus:VEXIRA'}   = ('@VEXIRA@' ne '/bin/false' ? '@VEXIRA@' : 0);
-$Features{'Virus:NAI'}      = ('@NAI@' ne '/bin/false' ? '@NAI@' : 0);
-$Features{'Virus:BDC'}      = ('@BDC@' ne '/bin/false' ? '@BDC@' : 0);
-$Features{'Virus:NVCC'}     = ('@NVCC@' ne '/bin/false' ? '@NVCC@' : 0);
+$Features{'Virus:AVP'}      = ((('@AVP@' ne '/bin/false') and (-x '@AVP@')) ? '@AVP@' : 0);
+$Features{'Virus:AVP5'}      = ((('@AVP5@' ne '/bin/false') and (-x '@AVP5@')) ? '@AVP5@' : 0);
+$Features{'Virus:KAVSCANNER'} = ((('@KAVSCANNER@' ne '/bin/false') and (-x '@KAVSCANNER@')) ? '@KAVSCANNER@' : 0);
+$Features{'Virus:CLAMAV'}   = ((('@CLAMSCAN@' ne '/bin/false') and (-x '@CLAMSCAN@')) ? '@CLAMSCAN@' : 0);
+$Features{'Virus:CLAMD'}    = ((('@CLAMD@' ne '/bin/false') and (-x '@CLAMD@')) ? '@CLAMD@' : 0);
+$Features{'Virus:FPROT'}    = ((('@FPROT@' ne '/bin/false') and (-x '@FPROT@')) ? '@FPROT@' : 0);
+$Features{'Virus:FSAV'}     = ((('@FSAV@' ne '/bin/false') and (-x '@FSAV@')) ? '@FSAV@' : 0);
+$Features{'Virus:HBEDV'}    = ((('@HBEDV@' ne '/bin/false') and (-x '@HBEDV@')) ? '@HBEDV@' : 0);
+$Features{'Virus:VEXIRA'}   = ((('@VEXIRA@' ne '/bin/false') and (-x '@VEXIRA@')) ? '@VEXIRA@' : 0);
+$Features{'Virus:NAI'}      = ((('@NAI@' ne '/bin/false') and (-x '@NAI@')) ? '@NAI@' : 0);
+$Features{'Virus:BDC'}      = ((('@BDC@' ne '/bin/false') and (-x '@BDC@')) ? '@BDC@' : 0);
+$Features{'Virus:NVCC'}     = ((('@NVCC@' ne '/bin/false') and (-x '@NVCC@')) ? '@NVCC@' : 0);
 $Features{'Virus:OpenAV'}   = 0;  # Not a good idea but we need a test!
 $Features{'Virus:SymantecCSS'} = 0; # Ditto
 $Features{'Virus:FPROTD'}   = 0;
-$Features{'Virus:SOPHIE'}   = ('@SOPHIE@' ne '/bin/false' ? '@SOPHIE@' : 0);
-$Features{'Virus:SOPHOS'}   = ('@SOPHOS@' ne '/bin/false' ? '@SOPHOS@' : 0);
-$Features{'Virus:TREND'}    = ('@TREND@' ne '/bin/false' ? '@TREND@' : 0);
-$Features{'Virus:TROPHIE'}  = ('@TROPHIE@' ne '/bin/false' ? '@TROPHIE@' : 0);
-$Features{'Virus:CSAV'}     = ('@CSAV@' ne '/bin/false' ? '@CSAV@' : 0);
+$Features{'Virus:SOPHIE'}   = ((('@SOPHIE@' ne '/bin/false') and (-x '@SOPHIE@')) ? '@SOPHIE@' : 0);
+$Features{'Virus:SOPHOS'}   = ((('@SOPHOS@' ne '/bin/false') and (-x '@SOPHOS@')) ? '@SOPHOS@' : 0);
+$Features{'Virus:TREND'}    = ((('@TREND@' ne '/bin/false') and (-x '@TREND@')) ? '@TREND@' : 0);
+$Features{'Virus:TROPHIE'}  = ((('@TROPHIE@' ne '/bin/false') and (-x '@TROPHIE@')) ? '@TROPHIE@' : 0);
+$Features{'Virus:CSAV'}     = ((('@CSAV@' ne '/bin/false') and (-x '@CSAV@')) ? '@CSAV@' : 0);
 
 $Features{'Path:SENDMAIL'}  = '@SENDMAILPROG@';
 $Features{'Path:QUARANTINEDIR'} = '@QDIR@';
@@ -3669,7 +3669,7 @@ sub entity_contains_virus_clamav ($) {
 
     # 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 --no-summary --infected $path 2>&1");
     if ($action ne 'proceed') {
 	return (wantarray ? ($code, $category, $action) : $code);
     }
@@ -3693,7 +3693,7 @@ sub message_contains_virus_clamav () {
 
     # 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 --no-summary --infected ./Work 2>&1");
     if ($action ne 'proceed') {
 	return (wantarray ? ($code, $category, $action) : $code);
     }
@@ -4506,14 +4506,14 @@ sub entity_contains_virus_clamd ($;$) {
 	    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 --unrar --stdout --no-summary --infected $CWD/Work 2>&1");
 		if ($action ne 'proceed') {
 			return (wantarray ? ($code, $category, $action) : $code);
 		}
-		md_syslog('info', "$MsgID: Falling back on clamscan --unzip because of Zip module failure in clamd");
+		md_syslog('info', "$MsgID: Falling back on clamscan --unzip --unrar because of Zip module failure in clamd");
 		return (wantarray ? interpret_clamav_code($code) : $code);
 	    }
 	    return (wantarray ? (999, 'swerr', 'tempfail') : 1);
@@ -4603,14 +4603,14 @@ sub message_contains_virus_clamd (;$) {
 	    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 --unrar --stdout --no-summary --infected $CWD/Work 2>&1");
 		if ($action ne 'proceed') {
 			return (wantarray ? ($code, $category, $action) : $code);
 		}
-		md_syslog('info', "$MsgID: Falling back on clamscan --unzip because of Zip module failure in clamd");
+		md_syslog('info', "$MsgID: Falling back on clamscan --unzip --unrar because of Zip module failure in clamd");
 		return (wantarray ? interpret_clamav_code($code) : $code);
 	    }
 	    return (wantarray ? (999, 'swerr', 'tempfail') : 999);