git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@56 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2003/09/27 01:09:19... | ... |
@@ -117,6 +117,9 @@ Changes |
117 | 117 |
0.60f 17/9/03 Changed fprintf to fputs where possible |
118 | 118 |
Redirect stdin from /dev/null, stdout&stderr to |
119 | 119 |
/dev/console |
120 |
+0.60g 26/9/03 Handle sendmail calling abort after calling cleanup |
|
121 |
+ (Should never happen - but it does) |
|
122 |
+ Added -noxheader patch from dirk.meyer@dinoex.sub.org |
|
120 | 123 |
|
121 | 124 |
BUG REPORTS |
122 | 125 |
|
... | ... |
@@ -122,9 +122,12 @@ |
122 | 122 |
* 0.60f 24/9/03 Changed fprintf to fputs where possible |
123 | 123 |
* Redirect stdin from /dev/null, stdout&stderr to |
124 | 124 |
* /dev/console |
125 |
+ * 0.60g 26/9/03 Handle sendmail calling abort after calling cleanup |
|
126 |
+ * (Should never happen - but it does) |
|
127 |
+ * Added -noxheader patch from dirk.meyer@dinoex.sub.org |
|
125 | 128 |
*/ |
126 | 129 |
|
127 |
-#define CM_VERSION "0.60f" |
|
130 |
+#define CM_VERSION "0.60g" |
|
128 | 131 |
|
129 | 132 |
/*#define CONFDIR "/usr/local/etc"*/ |
130 | 133 |
|
... | ... |
@@ -224,6 +227,10 @@ static int qflag = 0; /* |
224 | 224 |
* found is the syslog, so it's best to |
225 | 225 |
* enable LogSyslog in clamav.conf |
226 | 226 |
*/ |
227 |
+static int nflag = 0; /* |
|
228 |
+ * Don't add X-Virus-Scanned to header. Patch |
|
229 |
+ * from Dirk Meyer <dirk.meyer@dinoex.sub.org> |
|
230 |
+ */ |
|
227 | 231 |
|
228 | 232 |
#ifdef CL_DEBUG |
229 | 233 |
static int debug_level = 0; |
... | ... |
@@ -252,6 +259,7 @@ help(void) |
252 | 252 |
puts("\t--help\t\t\t-h\tThis message."); |
253 | 253 |
puts("\t--local\t\t\t-l\tScan messages sent from machines on our LAN."); |
254 | 254 |
puts("\t--outgoing\t\t-o\tScan outgoing messages from this machine."); |
255 |
+ puts("\t--noxheader\t\t-o\tSuppress X-Virus-Scanned header."); |
|
255 | 256 |
puts("\t--postmaster\t\t-p\tPostmaster address [default=postmaster]."); |
256 | 257 |
puts("\t--postmaster-only\t\t-P\tSend warnings only to the postmaster."); |
257 | 258 |
puts("\t--quiet\t\t\t-q\tDon't send e-mail notifications of interceptions."); |
... | ... |
@@ -290,9 +298,9 @@ main(int argc, char **argv) |
290 | 290 |
for(;;) { |
291 | 291 |
int opt_index = 0; |
292 | 292 |
#ifdef CL_DEBUG |
293 |
- const char *args = "bc:lopPqdhs:Vx:"; |
|
293 |
+ const char *args = "bc:lnopPqdhs:Vx:"; |
|
294 | 294 |
#else |
295 |
- const char *args = "bc:lopPqdhs:V"; |
|
295 |
+ const char *args = "bc:lnopPqdhs:V"; |
|
296 | 296 |
#endif |
297 | 297 |
static struct option long_options[] = { |
298 | 298 |
{ |
... | ... |
@@ -308,6 +316,9 @@ main(int argc, char **argv) |
308 | 308 |
"local", 0, NULL, 'l' |
309 | 309 |
}, |
310 | 310 |
{ |
311 |
+ "noxheader", 0, NULL, 'n' |
|
312 |
+ }, |
|
313 |
+ { |
|
311 | 314 |
"outgoing", 0, NULL, 'o' |
312 | 315 |
}, |
313 | 316 |
{ |
... | ... |
@@ -361,6 +372,9 @@ main(int argc, char **argv) |
361 | 361 |
case 'm': /* maximum number of children */ |
362 | 362 |
max_children = atoi(optarg); |
363 | 363 |
break; |
364 |
+ case 'n': /* don't add X-Virus-Scanned */ |
|
365 |
+ nflag++; |
|
366 |
+ break; |
|
364 | 367 |
case 'o': /* scan outgoing mail */ |
365 | 368 |
oflag++; |
366 | 369 |
break; |
... | ... |
@@ -997,7 +1011,8 @@ clamfi_eom(SMFICTX *ctx) |
997 | 997 |
} |
998 | 998 |
|
999 | 999 |
if(strstr(mess, "FOUND") == NULL) { |
1000 |
- smfi_addheader(ctx, "X-Virus-Scanned", clamav_version); |
|
1000 |
+ if(!nflag) |
|
1001 |
+ smfi_addheader(ctx, "X-Virus-Scanned", clamav_version); |
|
1001 | 1002 |
|
1002 | 1003 |
/* |
1003 | 1004 |
* TODO: if privdata->from is NULL it's probably SPAM, and |
... | ... |
@@ -1124,58 +1139,58 @@ clamfi_cleanup(SMFICTX *ctx) |
1124 | 1124 |
{ |
1125 | 1125 |
struct privdata *privdata = (struct privdata *)smfi_getpriv(ctx); |
1126 | 1126 |
|
1127 |
- assert(privdata != NULL); |
|
1128 |
- |
|
1129 |
- if(privdata->dataSocket >= 0) { |
|
1130 |
- close(privdata->dataSocket); |
|
1131 |
- privdata->dataSocket = -1; |
|
1132 |
- } |
|
1127 |
+ if(privdata) { |
|
1128 |
+ if(privdata->dataSocket >= 0) { |
|
1129 |
+ close(privdata->dataSocket); |
|
1130 |
+ privdata->dataSocket = -1; |
|
1131 |
+ } |
|
1133 | 1132 |
|
1134 |
- if(privdata->from) { |
|
1133 |
+ if(privdata->from) { |
|
1135 | 1134 |
#ifdef CL_DEBUG |
1136 |
- if(debug_level >= 9) |
|
1137 |
- puts("Free privdata->from"); |
|
1135 |
+ if(debug_level >= 9) |
|
1136 |
+ puts("Free privdata->from"); |
|
1138 | 1137 |
#endif |
1139 |
- free(privdata->from); |
|
1140 |
- privdata->from = NULL; |
|
1141 |
- } |
|
1138 |
+ free(privdata->from); |
|
1139 |
+ privdata->from = NULL; |
|
1140 |
+ } |
|
1142 | 1141 |
|
1143 |
- if(privdata->to) { |
|
1144 |
- char **to; |
|
1142 |
+ if(privdata->to) { |
|
1143 |
+ char **to; |
|
1145 | 1144 |
|
1146 |
- for(to = privdata->to; *to; to++) { |
|
1145 |
+ for(to = privdata->to; *to; to++) { |
|
1147 | 1146 |
#ifdef CL_DEBUG |
1148 |
- if(debug_level >= 9) |
|
1149 |
- puts("Free *privdata->to"); |
|
1147 |
+ if(debug_level >= 9) |
|
1148 |
+ puts("Free *privdata->to"); |
|
1150 | 1149 |
#endif |
1151 |
- free(*to); |
|
1152 |
- } |
|
1150 |
+ free(*to); |
|
1151 |
+ } |
|
1153 | 1152 |
#ifdef CL_DEBUG |
1154 |
- if(debug_level >= 9) |
|
1155 |
- puts("Free privdata->to"); |
|
1153 |
+ if(debug_level >= 9) |
|
1154 |
+ puts("Free privdata->to"); |
|
1156 | 1155 |
#endif |
1157 |
- free(privdata->to); |
|
1158 |
- privdata->to = NULL; |
|
1159 |
- } |
|
1156 |
+ free(privdata->to); |
|
1157 |
+ privdata->to = NULL; |
|
1158 |
+ } |
|
1160 | 1159 |
|
1161 |
- if(privdata->cmdSocket >= 0) { |
|
1162 |
- char buf[64]; |
|
1160 |
+ if(privdata->cmdSocket >= 0) { |
|
1161 |
+ char buf[64]; |
|
1163 | 1162 |
|
1164 |
- /* |
|
1165 |
- * Flush the remote end so that clamd doesn't get a SIGPIPE |
|
1166 |
- */ |
|
1167 |
- while(recv(privdata->cmdSocket, buf, sizeof(buf), 0) > 0) |
|
1168 |
- ; |
|
1169 |
- close(privdata->cmdSocket); |
|
1170 |
- privdata->cmdSocket = -1; |
|
1171 |
- } |
|
1163 |
+ /* |
|
1164 |
+ * Flush the remote end so that clamd doesn't get a SIGPIPE |
|
1165 |
+ */ |
|
1166 |
+ while(recv(privdata->cmdSocket, buf, sizeof(buf), 0) > 0) |
|
1167 |
+ ; |
|
1168 |
+ close(privdata->cmdSocket); |
|
1169 |
+ privdata->cmdSocket = -1; |
|
1170 |
+ } |
|
1172 | 1171 |
|
1173 | 1172 |
#ifdef CL_DEBUG |
1174 |
- if(debug_level >= 9) |
|
1175 |
- puts("Free privdata"); |
|
1173 |
+ if(debug_level >= 9) |
|
1174 |
+ puts("Free privdata"); |
|
1176 | 1175 |
#endif |
1177 |
- free(privdata); |
|
1178 |
- smfi_setpriv(ctx, NULL); |
|
1176 |
+ free(privdata); |
|
1177 |
+ smfi_setpriv(ctx, NULL); |
|
1178 |
+ } |
|
1179 | 1179 |
|
1180 | 1180 |
if(max_children > 0) { |
1181 | 1181 |
pthread_mutex_lock(&n_children_mutex); |