git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@60 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2003/09/29 01:40:17... | ... |
@@ -1,3 +1,9 @@ |
1 |
+Sun Sep 28 17:38:44 BST 2003 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * clamav-milter: added --force-scan flag |
|
4 |
+ Use MaxThreads if --max-children not set |
|
5 |
+ (thanks to "Richard G. Roberto" <rgr@dedlegend.com>) |
|
6 |
+ |
|
1 | 7 |
Sun Sep 28 11:07:49 BST 2003 (njh) |
2 | 8 |
---------------------------------- |
3 | 9 |
* libclamav: mbox.c now compiles on SCO5 |
... | ... |
@@ -120,6 +120,9 @@ Changes |
120 | 120 |
0.60g 26/9/03 Handle sendmail calling abort after calling cleanup |
121 | 121 |
(Should never happen - but it does) |
122 | 122 |
Added -noxheader patch from dirk.meyer@dinoex.sub.org |
123 |
+0.60h 28/9/03 Support MaxThreads option in config file, |
|
124 |
+ overriden by --max-children. |
|
125 |
+ Patch from "Richard G. Roberto" <rgr@dedlegend.com> |
|
123 | 126 |
|
124 | 127 |
BUG REPORTS |
125 | 128 |
|
... | ... |
@@ -125,9 +125,18 @@ |
125 | 125 |
* 0.60g 26/9/03 Handle sendmail calling abort after calling cleanup |
126 | 126 |
* (Should never happen - but it does) |
127 | 127 |
* Added -noxheader patch from dirk.meyer@dinoex.sub.org |
128 |
+ * 0.60h 28/9/03 Support MaxThreads option in config file, |
|
129 |
+ * overriden by --max-children. |
|
130 |
+ * Patch from "Richard G. Roberto" <rgr@dedlegend.com> |
|
131 |
+ * Change History: |
|
132 |
+ * $Log: clamav-milter.c,v $ |
|
133 |
+ * Revision 1.6 2003/09/28 16:37:23 nigelhorne |
|
134 |
+ * Added -f flag use MaxThreads if --max-children not set |
|
135 |
+ * |
|
128 | 136 |
*/ |
137 |
+static char const rcsid[] = "$Id: clamav-milter.c,v 1.6 2003/09/28 16:37:23 nigelhorne Exp $"; |
|
129 | 138 |
|
130 |
-#define CM_VERSION "0.60g" |
|
139 |
+#define CM_VERSION "0.60h" |
|
131 | 140 |
|
132 | 141 |
/*#define CONFDIR "/usr/local/etc"*/ |
133 | 142 |
|
... | ... |
@@ -173,7 +182,6 @@ |
173 | 173 |
* TODO: check security - which UID will this run under? |
174 | 174 |
* TODO: bounce message should optionally be read from a file |
175 | 175 |
* TODO: optionally add a signature that the message has been scanned with ClamAV |
176 |
- * TODO: Use MaxThreads from the conf file rather than max-children |
|
177 | 176 |
* TODO: Support ThreadTimeout, LogTime and Logfile from the conf |
178 | 177 |
* file |
179 | 178 |
* TODO: Allow more than one clamdscan server to be given |
... | ... |
@@ -209,6 +217,7 @@ static int clamfi_send(const struct privdata *privdata, size_t len, const char |
209 | 209 |
static char *strrcpy(char *dest, const char *source); |
210 | 210 |
|
211 | 211 |
static char clamav_version[64]; |
212 |
+static int fflag = 0; /* force a scan, whatever */ |
|
212 | 213 |
static int oflag = 0; /* scan messages from our machine? */ |
213 | 214 |
static int lflag = 0; /* scan messages from our site? */ |
214 | 215 |
static int bflag = 0; /* |
... | ... |
@@ -256,6 +265,7 @@ help(void) |
256 | 256 |
|
257 | 257 |
puts("\t--bounce\t\t-b\tSend a failure message to the sender."); |
258 | 258 |
puts("\t--config-file=FILE\t-c FILE\tRead configuration from FILE."); |
259 |
+ puts("\t--force-scan\tForce scan all messages (overrides (-o and -l)."); |
|
259 | 260 |
puts("\t--help\t\t\t-h\tThis message."); |
260 | 261 |
puts("\t--local\t\t\t-l\tScan messages sent from machines on our LAN."); |
261 | 262 |
puts("\t--outgoing\t\t-o\tScan outgoing messages from this machine."); |
... | ... |
@@ -298,9 +308,9 @@ main(int argc, char **argv) |
298 | 298 |
for(;;) { |
299 | 299 |
int opt_index = 0; |
300 | 300 |
#ifdef CL_DEBUG |
301 |
- const char *args = "bc:lnopPqdhs:Vx:"; |
|
301 |
+ const char *args = "bc:flnopPqdhs:Vx:"; |
|
302 | 302 |
#else |
303 |
- const char *args = "bc:lnopPqdhs:V"; |
|
303 |
+ const char *args = "bc:flnopPqdhs:V"; |
|
304 | 304 |
#endif |
305 | 305 |
static struct option long_options[] = { |
306 | 306 |
{ |
... | ... |
@@ -310,6 +320,9 @@ main(int argc, char **argv) |
310 | 310 |
"config-file", 1, NULL, 'c' |
311 | 311 |
}, |
312 | 312 |
{ |
313 |
+ "force-scan", 1, NULL, 'f' |
|
314 |
+ }, |
|
315 |
+ { |
|
313 | 316 |
"help", 0, NULL, 'h' |
314 | 317 |
}, |
315 | 318 |
{ |
... | ... |
@@ -363,6 +376,9 @@ main(int argc, char **argv) |
363 | 363 |
case 'c': /* where is clamav.conf? */ |
364 | 364 |
cfgfile = optarg; |
365 | 365 |
break; |
366 |
+ case 'f': /* force the scan */ |
|
367 |
+ fflag++; |
|
368 |
+ break; |
|
366 | 369 |
case 'h': |
367 | 370 |
help(); |
368 | 371 |
return EX_OK; |
... | ... |
@@ -436,6 +452,14 @@ main(int argc, char **argv) |
436 | 436 |
} |
437 | 437 |
|
438 | 438 |
/* |
439 |
+ * patch from "Richard G. Roberto" <rgr@dedlegend.com> |
|
440 |
+ * If the --max-children flag isn't set, see if MaxThreads |
|
441 |
+ * is set in the config file |
|
442 |
+ */ |
|
443 |
+ if((cpt = cfgopt(copt, "MaxThreads")) != NULL) |
|
444 |
+ max_children = atoi(cpt->strarg); |
|
445 |
+ |
|
446 |
+ /* |
|
439 | 447 |
* Get the outgoing socket details - the way to talk to clamd |
440 | 448 |
* TODO: support TCP sockets |
441 | 449 |
*/ |
... | ... |
@@ -602,10 +626,6 @@ clamfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr) |
602 | 602 |
char buf[INET_ADDRSTRLEN]; /* IPv4 only */ |
603 | 603 |
const char *remoteIP = inet_ntop(AF_INET, &((struct sockaddr_in *)(hostaddr))->sin_addr, buf, sizeof(buf)); |
604 | 604 |
|
605 |
-#ifdef CL_DEBUG |
|
606 |
- assert(remoteIP != NULL); |
|
607 |
-#endif |
|
608 |
- |
|
609 | 605 |
if(use_syslog) |
610 | 606 |
syslog(LOG_NOTICE, "clamfi_connect: connection from %s [%s]", hostname, remoteIP); |
611 | 607 |
#ifdef CL_DEBUG |
... | ... |
@@ -613,6 +633,17 @@ clamfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr) |
613 | 613 |
printf("clamfi_connect: connection from %s [%s]\n", hostname, remoteIP); |
614 | 614 |
#endif |
615 | 615 |
|
616 |
+ if(fflag) |
|
617 |
+ /* |
|
618 |
+ * Patch from "Richard G. Roberto" <rgr@dedlegend.com> |
|
619 |
+ * Always scan whereever the message is from |
|
620 |
+ */ |
|
621 |
+ return SMFIS_CONTINUE; |
|
622 |
+ |
|
623 |
+#ifdef CL_DEBUG |
|
624 |
+ assert(remoteIP != NULL); |
|
625 |
+#endif |
|
626 |
+ |
|
616 | 627 |
if(!oflag) |
617 | 628 |
if(strcmp(remoteIP, "127.0.0.1") == 0) { |
618 | 629 |
#ifdef CL_DEBUG |