git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@91 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2003/10/31 22:35:07... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Fri Oct 31 13:34:18 GMT 2003 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * clamav-milter: added dont scan on error flag |
|
4 |
+ |
|
1 | 5 |
Fri Oct 31 02:51:59 CET 2003 (tk) |
2 | 6 |
--------------------------------- |
3 | 7 |
* clamd: initialize a session start-time in proper order (thanks to Michael |
... | ... |
@@ -139,6 +139,8 @@ Changes |
139 | 139 |
Gets version info from clamd |
140 | 140 |
Only reset fd's 0/1/2 if !ForeGround |
141 | 141 |
0.60n 22/10/03 Call pthread_cont_broadcast more often |
142 |
+0.60o 31/10/03 Optionally accept all mails if scanning procedure |
|
143 |
+ fails (Joe Talbott <josepht@cstone.net>) |
|
142 | 144 |
|
143 | 145 |
BUG REPORTS |
144 | 146 |
|
... | ... |
@@ -144,9 +144,14 @@ |
144 | 144 |
* Gets version info from clamd |
145 | 145 |
* Only reset fd's 0/1/2 if !ForeGround |
146 | 146 |
* 0.60n 22/10/03 Call pthread_cont_broadcast more often |
147 |
+ * 0.60o 31/10/03 Optionally accept all mails if scanning procedure |
|
148 |
+ * fails (Joe Talbott <josepht@cstone.net>) |
|
147 | 149 |
* |
148 | 150 |
* Change History: |
149 | 151 |
* $Log: clamav-milter.c,v $ |
152 |
+ * Revision 1.16 2003/10/31 13:33:40 nigelhorne |
|
153 |
+ * Added dont scan on error flag |
|
154 |
+ * |
|
150 | 155 |
* Revision 1.15 2003/10/22 19:44:01 nigelhorne |
151 | 156 |
* more calls to pthread_cond_broadcast |
152 | 157 |
* |
... | ... |
@@ -178,9 +183,9 @@ |
178 | 178 |
* Added -f flag use MaxThreads if --max-children not set |
179 | 179 |
* |
180 | 180 |
*/ |
181 |
-static char const rcsid[] = "$Id: clamav-milter.c,v 1.15 2003/10/22 19:44:01 nigelhorne Exp $"; |
|
181 |
+static char const rcsid[] = "$Id: clamav-milter.c,v 1.16 2003/10/31 13:33:40 nigelhorne Exp $"; |
|
182 | 182 |
|
183 |
-#define CM_VERSION "0.60n" |
|
183 |
+#define CM_VERSION "0.60o" |
|
184 | 184 |
|
185 | 185 |
/*#define CONFDIR "/usr/local/etc"*/ |
186 | 186 |
|
... | ... |
@@ -284,6 +289,14 @@ static int nflag = 0; /* |
284 | 284 |
* Don't add X-Virus-Scanned to header. Patch |
285 | 285 |
* from Dirk Meyer <dirk.meyer@dinoex.sub.org> |
286 | 286 |
*/ |
287 |
+static int cl_error = SMFIS_TEMPFAIL; /* |
|
288 |
+ * If an error occurs, return |
|
289 |
+ * this status. Allows messages |
|
290 |
+ * to be passed through |
|
291 |
+ * unscanned in the event of |
|
292 |
+ * an error. Patch from |
|
293 |
+ * Joe Talbott <josepht@cstone.net> |
|
294 |
+ */ |
|
287 | 295 |
|
288 | 296 |
#ifdef CL_DEBUG |
289 | 297 |
static int debug_level = 0; |
... | ... |
@@ -316,6 +329,7 @@ help(void) |
316 | 316 |
|
317 | 317 |
puts("\t--bounce\t\t-b\tSend a failure message to the sender."); |
318 | 318 |
puts("\t--config-file=FILE\t-c FILE\tRead configuration from FILE."); |
319 |
+ puts("\t--dont-scan-on-error\t\t-d\tPass e-mails through unscanned if a system error occurs."); |
|
319 | 320 |
puts("\t--force-scan\tForce scan all messages (overrides (-o and -l)."); |
320 | 321 |
puts("\t--help\t\t\t-h\tThis message."); |
321 | 322 |
puts("\t--local\t\t\t-l\tScan messages sent from machines on our LAN."); |
... | ... |
@@ -377,6 +391,9 @@ main(int argc, char **argv) |
377 | 377 |
"config-file", 1, NULL, 'c' |
378 | 378 |
}, |
379 | 379 |
{ |
380 |
+ "dont-scan-on-error", 0, NULL, 'd' |
|
381 |
+ }, |
|
382 |
+ { |
|
380 | 383 |
"force-scan", 1, NULL, 'f' |
381 | 384 |
}, |
382 | 385 |
{ |
... | ... |
@@ -433,6 +450,9 @@ main(int argc, char **argv) |
433 | 433 |
case 'c': /* where is clamav.conf? */ |
434 | 434 |
cfgfile = optarg; |
435 | 435 |
break; |
436 |
+ case 'd': /* don't scan on error */ |
|
437 |
+ cl_error = SMFIS_ACCEPT; |
|
438 |
+ break; |
|
436 | 439 |
case 'f': /* force the scan */ |
437 | 440 |
fflag++; |
438 | 441 |
break; |
... | ... |
@@ -764,7 +784,7 @@ clamfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr) |
764 | 764 |
if(regcomp(®, *possible, 0) != 0) { |
765 | 765 |
if(use_syslog) |
766 | 766 |
syslog(LOG_ERR, "Couldn't parse local regexp"); |
767 |
- return SMFIS_TEMPFAIL; |
|
767 |
+ return cl_error; |
|
768 | 768 |
} |
769 | 769 |
|
770 | 770 |
rc = (regexec(®, remoteIP, 0, NULL, 0) == REG_NOMATCH) ? 0 : 1; |
... | ... |
@@ -897,11 +917,11 @@ clamfi_envfrom(SMFICTX *ctx, char **argv) |
897 | 897 |
|
898 | 898 |
if((privdata->cmdSocket = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { |
899 | 899 |
perror("socket"); |
900 |
- return SMFIS_TEMPFAIL; |
|
900 |
+ return cl_error; |
|
901 | 901 |
} |
902 | 902 |
if(connect(privdata->cmdSocket, (struct sockaddr *)&server, sizeof(struct sockaddr_un)) < 0) { |
903 | 903 |
perror(localSocket); |
904 |
- return SMFIS_TEMPFAIL; |
|
904 |
+ return cl_error; |
|
905 | 905 |
} |
906 | 906 |
} else { |
907 | 907 |
struct sockaddr_in server; |
... | ... |
@@ -929,8 +949,8 @@ clamfi_envfrom(SMFICTX *ctx, char **argv) |
929 | 929 |
close(privdata->cmdSocket); |
930 | 930 |
free(privdata); |
931 | 931 |
if(use_syslog) |
932 |
- syslog(LOG_ERR, "send failed to create socket"); |
|
933 |
- return SMFIS_TEMPFAIL; |
|
932 |
+ syslog(LOG_ERR, "failed to create socket"); |
|
933 |
+ return cl_error; |
|
934 | 934 |
} |
935 | 935 |
|
936 | 936 |
shutdown(privdata->dataSocket, SHUT_RD); |
... | ... |
@@ -942,7 +962,7 @@ clamfi_envfrom(SMFICTX *ctx, char **argv) |
942 | 942 |
free(privdata); |
943 | 943 |
if(use_syslog) |
944 | 944 |
syslog(LOG_ERR, "send failed to clamd"); |
945 |
- return SMFIS_TEMPFAIL; |
|
945 |
+ return cl_error; |
|
946 | 946 |
} |
947 | 947 |
|
948 | 948 |
shutdown(privdata->cmdSocket, SHUT_WR); |
... | ... |
@@ -955,7 +975,7 @@ clamfi_envfrom(SMFICTX *ctx, char **argv) |
955 | 955 |
free(privdata); |
956 | 956 |
if(use_syslog) |
957 | 957 |
syslog(LOG_ERR, "recv failed from clamd getting PORT"); |
958 |
- return SMFIS_TEMPFAIL; |
|
958 |
+ return cl_error; |
|
959 | 959 |
} |
960 | 960 |
buf[nbytes] = '\0'; |
961 | 961 |
#ifdef CL_DEBUG |
... | ... |
@@ -972,7 +992,7 @@ clamfi_envfrom(SMFICTX *ctx, char **argv) |
972 | 972 |
else |
973 | 973 |
fprintf(stderr, "Expected port information from clamd, got '%s'\n", |
974 | 974 |
buf); |
975 |
- return SMFIS_TEMPFAIL; |
|
975 |
+ return cl_error; |
|
976 | 976 |
} |
977 | 977 |
|
978 | 978 |
memset((char *)&reply, 0, sizeof(struct sockaddr_in)); |
... | ... |
@@ -1005,7 +1025,7 @@ clamfi_envfrom(SMFICTX *ctx, char **argv) |
1005 | 1005 |
#endif |
1006 | 1006 |
} |
1007 | 1007 |
|
1008 |
- return SMFIS_TEMPFAIL; |
|
1008 |
+ return cl_error; |
|
1009 | 1009 |
} |
1010 | 1010 |
|
1011 | 1011 |
clamfi_send(privdata, 0, "From %s\n", argv[0]); |
... | ... |
@@ -1014,7 +1034,7 @@ clamfi_envfrom(SMFICTX *ctx, char **argv) |
1014 | 1014 |
privdata->from = strdup(argv[0]); |
1015 | 1015 |
privdata->to = NULL; |
1016 | 1016 |
|
1017 |
- return (smfi_setpriv(ctx, privdata) == MI_SUCCESS) ? SMFIS_CONTINUE : SMFIS_TEMPFAIL; |
|
1017 |
+ return (smfi_setpriv(ctx, privdata) == MI_SUCCESS) ? SMFIS_CONTINUE : cl_error; |
|
1018 | 1018 |
} |
1019 | 1019 |
|
1020 | 1020 |
static sfsistat |
... | ... |
@@ -1060,7 +1080,7 @@ clamfi_header(SMFICTX *ctx, char *headerf, char *headerv) |
1060 | 1060 |
|
1061 | 1061 |
if(clamfi_send(privdata, 0, "%s: %s\n", headerf, headerv) < 0) { |
1062 | 1062 |
clamfi_cleanup(ctx); |
1063 |
- return SMFIS_TEMPFAIL; |
|
1063 |
+ return cl_error; |
|
1064 | 1064 |
} |
1065 | 1065 |
return SMFIS_CONTINUE; |
1066 | 1066 |
} |
... | ... |
@@ -1079,7 +1099,7 @@ clamfi_eoh(SMFICTX *ctx) |
1079 | 1079 |
|
1080 | 1080 |
if(clamfi_send(privdata, 1, "\n") < 0) { |
1081 | 1081 |
clamfi_cleanup(ctx); |
1082 |
- return SMFIS_TEMPFAIL; |
|
1082 |
+ return cl_error; |
|
1083 | 1083 |
} |
1084 | 1084 |
|
1085 | 1085 |
/* |
... | ... |
@@ -1139,7 +1159,7 @@ clamfi_body(SMFICTX *ctx, u_char *bodyp, size_t len) |
1139 | 1139 |
|
1140 | 1140 |
if(clamfi_send(privdata, len, (char *)bodyp) < 0) { |
1141 | 1141 |
clamfi_cleanup(ctx); |
1142 |
- return SMFIS_TEMPFAIL; |
|
1142 |
+ return cl_error; |
|
1143 | 1143 |
} |
1144 | 1144 |
return SMFIS_CONTINUE; |
1145 | 1145 |
} |
... | ... |
@@ -1295,7 +1315,7 @@ clamfi_abort(SMFICTX *ctx) |
1295 | 1295 |
|
1296 | 1296 |
clamfi_cleanup(ctx); |
1297 | 1297 |
|
1298 |
- return SMFIS_TEMPFAIL; |
|
1298 |
+ return cl_error; |
|
1299 | 1299 |
} |
1300 | 1300 |
|
1301 | 1301 |
static sfsistat |