git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@168 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2003/12/31 23:48:16... | ... |
@@ -1,3 +1,8 @@ |
1 |
+Wed Dec 31 14:47:13 GMT 2003 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * clamav-milter: Included the sendmail queue ID in the log, from an |
|
4 |
+ idea by Andy Fiddaman <af@jeamland.org> |
|
5 |
+ |
|
1 | 6 |
Tue Dec 30 04:33:29 CET 2003 (tk) |
2 | 7 |
--------------------------------- |
3 | 8 |
* libclamav: don't report an error with password protected zip (problem |
... | ... |
@@ -27,20 +27,23 @@ can't be run "out of the box" |
27 | 27 |
|
28 | 28 |
Solaris 8 doesn't have milter support so clamav-milter won't work unless you |
29 | 29 |
rebuild sendmail from source. |
30 |
-Solaris 9 has milter support in the supplied sendmail, but doesn't include |
|
31 |
-libmilter so you can't develop milter applications on it. Go to sendmail.org, |
|
32 |
-download the lastest sendmail, cd to libmilter and "make install" there. |
|
33 |
-Needs -lresolv |
|
34 | 30 |
|
35 | 31 |
FreeBSD4.7 use /usr/local/bin/gcc30. GCC3.0 is an optional extra on |
36 | 32 |
FreeBSD. It comes with getopt.h which is handy. To link you need |
37 | 33 |
-lgnugetopt |
38 | 34 |
gcc30 -O3 -DCONFDIR=\"/usr/local/etc\" -I. -I.. -I../clamd -I../libclamav -pedantic -Wuninitialized -Wall -pipe -mcpu=pentium -march=pentium -fomit-frame-pointer -ffast-math -finline-functions -funroll-loops clamav-milter.c -pthread -lmilter ../libclamav/.libs/libclamav.a ../clamd/cfgfile.o ../clamd/others.o -lgnugetopt |
39 | 35 |
|
40 |
-FreeBSD4.8: should compile out of the box |
|
36 |
+FreeBSD4.8: compiles out of the box with either gcc2.95 or gcc3 |
|
41 | 37 |
OpenBSD3.3: the supplied sendmail does not come with Milter support. You |
42 | 38 |
will need to rebuild sendmail from source |
43 | 39 |
|
40 |
+Solaris 9 and FreeBSD5 have milter support in the supplied sendmail, but |
|
41 |
+doesn't include libmilter so you can't develop milter applications on it. |
|
42 |
+Go to sendmail.org, download the lastest sendmail, cd to libmilter and |
|
43 |
+"make install" there. |
|
44 |
+ |
|
45 |
+Needs -lresolv on Solaris |
|
46 |
+ |
|
44 | 47 |
INSTALLATION |
45 | 48 |
|
46 | 49 |
Install into /usr/local/sbin/clamav-milter, mode 744 |
... | ... |
@@ -179,6 +182,8 @@ Changes |
179 | 179 |
0.66 13/12/03 Upissue |
180 | 180 |
0.66a 22/12/03 Added --sign |
181 | 181 |
0.66b 27/12/03 --sign moved to privdata |
182 |
+0.66c 31/12/03 Included the sendmail queue ID in the log, from an |
|
183 |
+ idea by Andy Fiddaman <af@jeamland.org> |
|
182 | 184 |
|
183 | 185 |
BUG REPORTS |
184 | 186 |
|
... | ... |
@@ -69,10 +69,6 @@ |
69 | 69 |
* |
70 | 70 |
* Solaris 8 doesn't have milter support so clamav-milter won't work unless |
71 | 71 |
* you rebuild sendmail from source. |
72 |
- * Solaris 9 has milter support in the supplied sendmail, but doesn't include |
|
73 |
- * libmilter so you can't develop milter applications on it. Go to sendmail.org, |
|
74 |
- * download the lastest sendmail, cd to libmilter and "make install" there. |
|
75 |
- * Needs -lresolv |
|
76 | 72 |
* |
77 | 73 |
* FreeBSD4.7 use /usr/local/bin/gcc30. GCC3.0 is an optional extra on |
78 | 74 |
* FreeBSD. It comes with getopt.h which is handy. To link you need |
... | ... |
@@ -83,6 +79,13 @@ |
83 | 83 |
* OpenBSD3.3: the supplied sendmail does not come with Milter support. You |
84 | 84 |
* will need to rebuild sendmail from source |
85 | 85 |
* |
86 |
+ * Solaris 9 and FreeBSD5 have milter support in the supplied sendmail, but |
|
87 |
+ * doesn't include libmilter so you can't develop milter applications on it. |
|
88 |
+ * Go to sendmail.org, download the lastest sendmail, cd to libmilter and |
|
89 |
+ * "make install" there. |
|
90 |
+ * |
|
91 |
+ * Needs -lresolv on Solaris |
|
92 |
+ * |
|
86 | 93 |
* Changes |
87 | 94 |
* 0.2: 4/3/03 clamfi_abort() now always calls pthread_mutex_unlock |
88 | 95 |
* 5/3/03 Only send a bounce if -b is set |
... | ... |
@@ -182,9 +185,14 @@ |
182 | 182 |
* 0.66 13/12/03 Upissue |
183 | 183 |
* 0.66a 22/12/03 Added --sign |
184 | 184 |
* 0.66b 27/12/03 --sign moved to privdata |
185 |
+ * 0.66c 31/12/03 Included the sendmail queue ID in the log, from an |
|
186 |
+ * idea by Andy Fiddaman <af@jeamland.org> |
|
185 | 187 |
* |
186 | 188 |
* Change History: |
187 | 189 |
* $Log: clamav-milter.c,v $ |
190 |
+ * Revision 1.34 2003/12/31 14:46:35 nigelhorne |
|
191 |
+ * Include the sendmail queue ID in the log |
|
192 |
+ * |
|
188 | 193 |
* Revision 1.33 2003/12/27 17:28:56 nigelhorne |
189 | 194 |
* Moved --sign data to private area |
190 | 195 |
* |
... | ... |
@@ -269,9 +277,9 @@ |
269 | 269 |
* Revision 1.6 2003/09/28 16:37:23 nigelhorne |
270 | 270 |
* Added -f flag use MaxThreads if --max-children not set |
271 | 271 |
*/ |
272 |
-static char const rcsid[] = "$Id: clamav-milter.c,v 1.33 2003/12/27 17:28:56 nigelhorne Exp $"; |
|
272 |
+static char const rcsid[] = "$Id: clamav-milter.c,v 1.34 2003/12/31 14:46:35 nigelhorne Exp $"; |
|
273 | 273 |
|
274 |
-#define CM_VERSION "0.66b" |
|
274 |
+#define CM_VERSION "0.66c" |
|
275 | 275 |
|
276 | 276 |
/*#define CONFDIR "/usr/local/etc"*/ |
277 | 277 |
|
... | ... |
@@ -502,9 +510,9 @@ main(int argc, char **argv) |
502 | 502 |
for(;;) { |
503 | 503 |
int opt_index = 0; |
504 | 504 |
#ifdef CL_DEBUG |
505 |
- const char *args = "bc:flm:nop:PqQ:dhs:S:U:Vx:"; |
|
505 |
+ const char *args = "bc:flm:nop:PqQ:dhs:SU:Vx:"; |
|
506 | 506 |
#else |
507 |
- const char *args = "bc:flm:nop:PqQ:dhs:S:U:V"; |
|
507 |
+ const char *args = "bc:flm:nop:PqQ:dhs:SU:V"; |
|
508 | 508 |
#endif |
509 | 509 |
|
510 | 510 |
static struct option long_options[] = { |
... | ... |
@@ -954,11 +962,12 @@ clamfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr) |
954 | 954 |
return cl_error; |
955 | 955 |
} |
956 | 956 |
|
957 |
- if(use_syslog) |
|
958 |
- syslog(LOG_NOTICE, "clamfi_connect: connection from %s [%s]", hostname, remoteIP); |
|
959 | 957 |
#ifdef CL_DEBUG |
960 |
- if(debug_level >= 4) |
|
958 |
+ if(debug_level >= 4) { |
|
959 |
+ if(use_syslog) |
|
960 |
+ syslog(LOG_NOTICE, "clamfi_connect: connection from %s [%s]", hostname, remoteIP); |
|
961 | 961 |
printf("clamfi_connect: connection from %s [%s]\n", hostname, remoteIP); |
962 |
+ } |
|
962 | 963 |
#endif |
963 | 964 |
|
964 | 965 |
if(fflag) |
... | ... |
@@ -1251,8 +1260,7 @@ clamfi_envfrom(SMFICTX *ctx, char **argv) |
1251 | 1251 |
} |
1252 | 1252 |
} |
1253 | 1253 |
|
1254 |
- clamfi_send(privdata, 0, "Received: by clamav-milter\n"); |
|
1255 |
- clamfi_send(privdata, 0, "From: %s\n", argv[0]); |
|
1254 |
+ clamfi_send(privdata, 0, "Received: by clamav-milter\nFrom: %s\n", argv[0]); |
|
1256 | 1255 |
|
1257 | 1256 |
privdata->from = strdup(argv[0]); |
1258 | 1257 |
privdata->to = NULL; |
... | ... |
@@ -1491,10 +1499,15 @@ clamfi_eom(SMFICTX *ctx) |
1491 | 1491 |
* me might consider bouncing it... |
1492 | 1492 |
*/ |
1493 | 1493 |
if(use_syslog) |
1494 |
- syslog(LOG_NOTICE, "clean message from %s", |
|
1494 |
+ /* Include the sendmail queue ID in the log */ |
|
1495 |
+ syslog(LOG_NOTICE, "%s: clean message from %s", |
|
1496 |
+ smfi_getsymval(ctx, "i"), |
|
1495 | 1497 |
(privdata->from) ? privdata->from : "an unknown sender"); |
1496 | 1498 |
|
1497 | 1499 |
if(privdata->body) { |
1500 |
+ /* |
|
1501 |
+ * Add a signature that all has been scanned OK |
|
1502 |
+ */ |
|
1498 | 1503 |
assert(Sflag != 0); |
1499 | 1504 |
|
1500 | 1505 |
privdata->body = realloc(privdata->body, privdata->bodyLen + sizeof(signature)); |
... | ... |
@@ -1542,12 +1555,10 @@ clamfi_eom(SMFICTX *ctx) |
1542 | 1542 |
(void)strcpy(ptr, "\n"); |
1543 | 1543 |
|
1544 | 1544 |
if(use_syslog) |
1545 |
- /* |
|
1546 |
- * The "%s" is there to plug a remote possibility |
|
1547 |
- * of the program crashing if an e-mail address |
|
1548 |
- * contains a percent character |
|
1549 |
- */ |
|
1550 |
- syslog(LOG_NOTICE, "%s", err); |
|
1545 |
+ /* Include the sendmail queue ID in the log */ |
|
1546 |
+ syslog(LOG_NOTICE, "%s: %s", |
|
1547 |
+ smfi_getsymval(ctx, "i"), |
|
1548 |
+ err); |
|
1551 | 1549 |
#ifdef CL_DEBUG |
1552 | 1550 |
puts(err); |
1553 | 1551 |
#endif |
... | ... |
@@ -1788,7 +1799,7 @@ clamfi_send(const struct privdata *privdata, size_t len, const char *format, ... |
1788 | 1788 |
#endif |
1789 | 1789 |
|
1790 | 1790 |
while(len > 0) { |
1791 |
- int nbytes = (quarantine_dir) ? |
|
1791 |
+ const int nbytes = (quarantine_dir) ? |
|
1792 | 1792 |
write(privdata->dataSocket, ptr, len) : |
1793 | 1793 |
send(privdata->dataSocket, ptr, len, 0); |
1794 | 1794 |
|