Browse code

bb#1549 second try

git-svn: trunk@5043

aCaB authored on 2009/04/17 08:01:51
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Fri Apr 17 00:59:48 CEST 2009 (acab)
2
+------------------------------------
3
+ * clamav-milter/clamfi.c: try harder not to break DKIM when AddHeader=Add
4
+			   Many thanks to Dick St.Peters
5
+
1 6
 Thu Apr 16 16:17:23 CEST 2009 (acab)
2 7
 ------------------------------------
3 8
  * shared/optparser.c, etc/clamav-milter.conf: document how to make
... ...
@@ -82,18 +82,23 @@ struct CLAMFI {
82 82
 
83 83
 
84 84
 static void add_x_header(SMFICTX *ctx, char *st, unsigned int scanned, unsigned int status) {
85
-    if(addxvirus == 1) {
85
+    if(addxvirus == 1) { /* Replace/Yes */
86 86
 	while(scanned)
87 87
 	    if(smfi_chgheader(ctx, (char *)"X-Virus-Scanned", scanned--, NULL) != MI_SUCCESS)
88 88
 		logg("^Failed to remove existing X-Virus-Scanned header\n");
89 89
 	while(status)
90 90
 	    if(smfi_chgheader(ctx, (char *)"X-Virus-Status", status--, NULL) != MI_SUCCESS)
91 91
 		logg("^Failed to remove existing X-Virus-Status header\n");
92
+	if(smfi_addheader(ctx, (char *)"X-Virus-Scanned", xvirushdr) != MI_SUCCESS)
93
+	    logg("^Failed to add X-Virus-Scanned header\n");
94
+	if(smfi_addheader(ctx, (char *)"X-Virus-Status", st) != MI_SUCCESS)
95
+	    logg("^Failed to add X-Virus-Status header\n");
96
+    } else { /* Add */
97
+	if(smfi_insheader(ctx, 0, (char *)"X-Virus-Scanned", xvirushdr) != MI_SUCCESS)
98
+	    logg("^Failed to insert X-Virus-Scanned header\n");
99
+	if(smfi_insheader(ctx, 0, (char *)"X-Virus-Status", st) != MI_SUCCESS)
100
+	    logg("^Failed to insert X-Virus-Status header\n");
92 101
     }
93
-    if(smfi_addheader(ctx, (char *)"X-Virus-Scanned", xvirushdr) != MI_SUCCESS)
94
-	logg("^Failed to add X-Virus-Scanned header\n");
95
-    if(smfi_addheader(ctx, (char *)"X-Virus-Status", st) != MI_SUCCESS)
96
-	logg("^Failed to add X-Virus-Status header\n");
97 102
 }
98 103
 
99 104
 enum CFWHAT {