git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@377 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2004/03/08 00:13:57... | ... |
@@ -1,3 +1,8 @@ |
1 |
+Sun Mar 7 15:19:51 GMT 2004 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav/message.c: Fixed minor typo in bounce message |
|
4 |
+ clamav-milter: Added extra information to --headers |
|
5 |
+ |
|
1 | 6 |
Sun Mar 7 12:40:05 GMT 2004 (njh) |
2 | 7 |
---------------------------------- |
3 | 8 |
* libclamav/message.c: Added new bounce delimeter (thanks to Dirk |
... | ... |
@@ -277,6 +277,11 @@ Changes |
277 | 277 |
and put sockets into subdirectory for security |
278 | 278 |
clamfi_close debug, change assert to debug message |
279 | 279 |
Better way to force TCPwrappers only with TCP/IP |
280 |
+0.67k 7/3/04 Ensure cli_dbgmsg's end with \n |
|
281 |
+ Fixed some warning messages with icc |
|
282 |
+ Use cli_[cm]alloc |
|
283 |
+ Included extra information if --headers is given (based on an |
|
284 |
+ idea from "Leonid Zeitlin" <lz@europe.com> |
|
280 | 285 |
|
281 | 286 |
BUG REPORTS |
282 | 287 |
|
... | ... |
@@ -276,9 +276,17 @@ |
276 | 276 |
* and put sockets into subdirectory for security |
277 | 277 |
* clamfi_close debug, change assert to debug message |
278 | 278 |
* Better way to force TCPwrappers only with TCP/IP |
279 |
- * |
|
279 |
+ * 0.67k 7/3/04 Ensure cli_dbgmsg's end with \n |
|
280 |
+ * Fixed some warning messages with icc |
|
281 |
+ * Use cli_[cm]alloc |
|
282 |
+ * Included extra information if --headers is given (based |
|
283 |
+ * on an idea from "Leonid Zeitlin" <lz@europe.com> |
|
284 |
+ * |
|
280 | 285 |
* Change History: |
281 | 286 |
* $Log: clamav-milter.c,v $ |
287 |
+ * Revision 1.59 2004/03/07 15:11:15 nigelhorne |
|
288 |
+ * Added more information to headers flag |
|
289 |
+ * |
|
282 | 290 |
* Revision 1.58 2004/03/03 09:14:55 nigelhorne |
283 | 291 |
* Change way check for TCPwrappers on TCP/IP |
284 | 292 |
* |
... | ... |
@@ -438,9 +446,9 @@ |
438 | 438 |
* Revision 1.6 2003/09/28 16:37:23 nigelhorne |
439 | 439 |
* Added -f flag use MaxThreads if --max-children not set |
440 | 440 |
*/ |
441 |
-static char const rcsid[] = "$Id: clamav-milter.c,v 1.58 2004/03/03 09:14:55 nigelhorne Exp $"; |
|
441 |
+static char const rcsid[] = "$Id: clamav-milter.c,v 1.59 2004/03/07 15:11:15 nigelhorne Exp $"; |
|
442 | 442 |
|
443 |
-#define CM_VERSION "0.67j" |
|
443 |
+#define CM_VERSION "0.67k" |
|
444 | 444 |
|
445 | 445 |
/*#define CONFDIR "/usr/local/etc"*/ |
446 | 446 |
|
... | ... |
@@ -461,9 +469,6 @@ static char const rcsid[] = "$Id: clamav-milter.c,v 1.58 2004/03/03 09:14:55 nig |
461 | 461 |
|
462 | 462 |
#include <stdio.h> |
463 | 463 |
#include <sysexits.h> |
464 |
-#ifdef HAVE_MALLOC_H |
|
465 |
-#include <malloc.h> |
|
466 |
-#endif |
|
467 | 464 |
#include <sys/types.h> |
468 | 465 |
#include <sys/stat.h> |
469 | 466 |
#include <syslog.h> |
... | ... |
@@ -773,7 +778,7 @@ main(int argc, char **argv) |
773 | 773 |
"force-scan", 0, NULL, 'f' |
774 | 774 |
}, |
775 | 775 |
{ |
776 |
- "headers", 0, NULL, 'H' |
|
776 |
+ "headers", 0, NULL, 'H' |
|
777 | 777 |
}, |
778 | 778 |
{ |
779 | 779 |
"help", 0, NULL, 'h' |
... | ... |
@@ -1051,7 +1056,7 @@ main(int argc, char **argv) |
1051 | 1051 |
return EX_CONFIG; |
1052 | 1052 |
} |
1053 | 1053 |
|
1054 |
- tcpSocket = cpt->numarg; |
|
1054 |
+ tcpSocket = (in_port_t)cpt->numarg; |
|
1055 | 1055 |
|
1056 | 1056 |
/* |
1057 | 1057 |
* cli_strtok's fieldno counts from 0 |
... | ... |
@@ -1230,8 +1235,8 @@ pingServer(int serverNumber) |
1230 | 1230 |
|
1231 | 1231 |
memset((char *)&server, 0, sizeof(struct sockaddr_in)); |
1232 | 1232 |
server.sin_family = AF_INET; |
1233 |
- server.sin_port = htons(tcpSocket); |
|
1234 |
- |
|
1233 |
+ server.sin_port = (in_port_t)htons(tcpSocket); |
|
1234 |
+ |
|
1235 | 1235 |
assert(serverIPs != NULL); |
1236 | 1236 |
assert(serverIPs[0] != -1L); |
1237 | 1237 |
|
... | ... |
@@ -1328,7 +1333,7 @@ findServer(void) |
1328 | 1328 |
int sock; |
1329 | 1329 |
|
1330 | 1330 |
server->sin_family = AF_INET; |
1331 |
- server->sin_port = htons(tcpSocket); |
|
1331 |
+ server->sin_port = (in_port_t)htons(tcpSocket); |
|
1332 | 1332 |
server->sin_addr.s_addr = serverIPs[i]; |
1333 | 1333 |
|
1334 | 1334 |
sock = socks[i] = socket(AF_INET, SOCK_STREAM, 0); |
... | ... |
@@ -1363,7 +1368,7 @@ findServer(void) |
1363 | 1363 |
|
1364 | 1364 |
tv.tv_sec = threadtimeout; |
1365 | 1365 |
tv.tv_usec = 0; |
1366 |
- |
|
1366 |
+ |
|
1367 | 1367 |
retval = select(maxsock, &rfds, NULL, NULL, &tv); |
1368 | 1368 |
if(retval < 0) |
1369 | 1369 |
perror("select"); |
... | ... |
@@ -1388,7 +1393,7 @@ findServer(void) |
1388 | 1388 |
for(i = 0; i < numServers; i++) |
1389 | 1389 |
if(FD_ISSET(socks[i], &rfds)) { |
1390 | 1390 |
free(socks); |
1391 |
- cli_dbgmsg("findServer: using server %d", i); |
|
1391 |
+ cli_dbgmsg("findServer: using server %d\n", i); |
|
1392 | 1392 |
return i; |
1393 | 1393 |
} |
1394 | 1394 |
|
... | ... |
@@ -1440,7 +1445,7 @@ clamfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr) |
1440 | 1440 |
const char *hostmail; |
1441 | 1441 |
const struct hostent *hp = NULL; |
1442 | 1442 |
|
1443 |
- /* |
|
1443 |
+ /* |
|
1444 | 1444 |
* Using TCP/IP for the sendmail->clamav-milter connection |
1445 | 1445 |
*/ |
1446 | 1446 |
if((hostmail = smfi_getsymval(ctx, "{if_name}")) == NULL) { |
... | ... |
@@ -1480,7 +1485,7 @@ clamfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr) |
1480 | 1480 |
#ifdef CL_DEBUG |
1481 | 1481 |
if(use_syslog) |
1482 | 1482 |
syslog(LOG_DEBUG, "clamfi_connect: not scanning outgoing messages"); |
1483 |
- cli_dbgmsg("clamfi_connect: not scanning outgoing messages"); |
|
1483 |
+ cli_dbgmsg("clamfi_connect: not scanning outgoing messages\n"); |
|
1484 | 1484 |
#endif |
1485 | 1485 |
return SMFIS_ACCEPT; |
1486 | 1486 |
} |
... | ... |
@@ -1518,7 +1523,7 @@ clamfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr) |
1518 | 1518 |
#ifdef CL_DEBUG |
1519 | 1519 |
if(use_syslog) |
1520 | 1520 |
syslog(LOG_DEBUG, "clamfi_connect: not scanning local messages"); |
1521 |
- cli_dbgmsg("clamfi_connect: not scanning outgoing messages"); |
|
1521 |
+ cli_dbgmsg("clamfi_connect: not scanning outgoing messages\n"); |
|
1522 | 1522 |
#endif |
1523 | 1523 |
return SMFIS_ACCEPT; |
1524 | 1524 |
} |
... | ... |
@@ -1593,7 +1598,7 @@ clamfi_envfrom(SMFICTX *ctx, char **argv) |
1593 | 1593 |
if(use_syslog) |
1594 | 1594 |
syslog(LOG_NOTICE, "Timeout waiting for a child to die"); |
1595 | 1595 |
#endif |
1596 |
- cli_dbgmsg("Timeout waiting for a child to die"); |
|
1596 |
+ cli_dbgmsg("Timeout waiting for a child to die\n"); |
|
1597 | 1597 |
} |
1598 | 1598 |
} |
1599 | 1599 |
|
... | ... |
@@ -1659,7 +1664,7 @@ clamfi_envfrom(SMFICTX *ctx, char **argv) |
1659 | 1659 |
|
1660 | 1660 |
memset((char *)&server, 0, sizeof(struct sockaddr_in)); |
1661 | 1661 |
server.sin_family = AF_INET; |
1662 |
- server.sin_port = htons(tcpSocket); |
|
1662 |
+ server.sin_port = (in_port_t)htons(tcpSocket); |
|
1663 | 1663 |
|
1664 | 1664 |
assert(serverIPs != NULL); |
1665 | 1665 |
|
... | ... |
@@ -1732,7 +1737,7 @@ clamfi_envfrom(SMFICTX *ctx, char **argv) |
1732 | 1732 |
|
1733 | 1733 |
memset((char *)&reply, 0, sizeof(struct sockaddr_in)); |
1734 | 1734 |
reply.sin_family = AF_INET; |
1735 |
- reply.sin_port = htons(port); |
|
1735 |
+ reply.sin_port = (in_port_t)htons(port); |
|
1736 | 1736 |
|
1737 | 1737 |
assert(serverIPs != NULL); |
1738 | 1738 |
|
... | ... |
@@ -1770,7 +1775,7 @@ clamfi_envfrom(SMFICTX *ctx, char **argv) |
1770 | 1770 |
privdata->to = NULL; |
1771 | 1771 |
|
1772 | 1772 |
if (hflag) |
1773 |
- privdata->headers = header_list_new(); |
|
1773 |
+ privdata->headers = header_list_new(); |
|
1774 | 1774 |
else |
1775 | 1775 |
privdata->headers = NULL; |
1776 | 1776 |
|
... | ... |
@@ -1797,7 +1802,7 @@ clamfi_envrcpt(SMFICTX *ctx, char **argv) |
1797 | 1797 |
clamfi_send(privdata, 0, "To: %s\n", argv[0]); |
1798 | 1798 |
|
1799 | 1799 |
if(privdata->to == NULL) { |
1800 |
- privdata->to = malloc(sizeof(char *) * 2); |
|
1800 |
+ privdata->to = cli_malloc(sizeof(char *) * 2); |
|
1801 | 1801 |
|
1802 | 1802 |
assert(privdata->numTo == 0); |
1803 | 1803 |
} else |
... | ... |
@@ -1820,7 +1825,7 @@ clamfi_header(SMFICTX *ctx, char *headerf, char *headerv) |
1820 | 1820 |
if(debug_level >= 9) |
1821 | 1821 |
printf("clamfi_header: %s: %s\n", headerf, headerv); |
1822 | 1822 |
else |
1823 |
- cli_dbgmsg("clamfi_header"); |
|
1823 |
+ cli_dbgmsg("clamfi_header\n"); |
|
1824 | 1824 |
#endif |
1825 | 1825 |
|
1826 | 1826 |
if(clamfi_send(privdata, 0, "%s: %s\n", headerf, headerv) < 0) { |
... | ... |
@@ -1829,7 +1834,7 @@ clamfi_header(SMFICTX *ctx, char *headerf, char *headerv) |
1829 | 1829 |
} |
1830 | 1830 |
|
1831 | 1831 |
if(hflag) |
1832 |
- header_list_add(privdata->headers, headerf, headerv); |
|
1832 |
+ header_list_add(privdata->headers, headerf, headerv); |
|
1833 | 1833 |
|
1834 | 1834 |
return SMFIS_CONTINUE; |
1835 | 1835 |
} |
... | ... |
@@ -1843,7 +1848,7 @@ clamfi_eoh(SMFICTX *ctx) |
1843 | 1843 |
if(logVerbose) |
1844 | 1844 |
syslog(LOG_DEBUG, "clamfi_eoh"); |
1845 | 1845 |
#ifdef CL_DEBUG |
1846 |
- cli_dbgmsg("clamfi_eoh"); |
|
1846 |
+ cli_dbgmsg("clamfi_eoh\n"); |
|
1847 | 1847 |
#endif |
1848 | 1848 |
|
1849 | 1849 |
if(clamfi_send(privdata, 1, "\n") < 0) { |
... | ... |
@@ -1888,7 +1893,7 @@ clamfi_eoh(SMFICTX *ctx) |
1888 | 1888 |
if(use_syslog) |
1889 | 1889 |
syslog(LOG_NOTICE, "clamfi_connect: ignoring whitelisted message"); |
1890 | 1890 |
#ifdef CL_DEBUG |
1891 |
- cli_dbgmsg("clamfi_connect: not scanning outgoing messages"); |
|
1891 |
+ cli_dbgmsg("clamfi_connect: not scanning outgoing messages\n"); |
|
1892 | 1892 |
#endif |
1893 | 1893 |
clamfi_cleanup(ctx); |
1894 | 1894 |
|
... | ... |
@@ -1918,7 +1923,7 @@ clamfi_body(SMFICTX *ctx, u_char *bodyp, size_t len) |
1918 | 1918 |
privdata->bodyLen += len; |
1919 | 1919 |
} else { |
1920 | 1920 |
assert(privdata->bodyLen == 0); |
1921 |
- privdata->body = malloc(len); |
|
1921 |
+ privdata->body = cli_malloc(len); |
|
1922 | 1922 |
memcpy(privdata->body, bodyp, len); |
1923 | 1923 |
privdata->bodyLen = len; |
1924 | 1924 |
} |
... | ... |
@@ -1937,7 +1942,7 @@ clamfi_eom(SMFICTX *ctx) |
1937 | 1937 |
if(logVerbose) |
1938 | 1938 |
syslog(LOG_DEBUG, "clamfi_eom"); |
1939 | 1939 |
#ifdef CL_DEBUG |
1940 |
- cli_dbgmsg("clamfi_eom"); |
|
1940 |
+ cli_dbgmsg("clamfi_eom\n"); |
|
1941 | 1941 |
assert(privdata != NULL); |
1942 | 1942 |
assert((privdata->cmdSocket >= 0) || (privdata->filename != NULL)); |
1943 | 1943 |
assert(!((privdata->cmdSocket >= 0) && (privdata->filename != NULL))); |
... | ... |
@@ -2000,7 +2005,7 @@ clamfi_eom(SMFICTX *ctx) |
2000 | 2000 |
clamfi_cleanup(ctx); |
2001 | 2001 |
syslog(LOG_NOTICE, "clamfi_eom: read nothing from clamd"); |
2002 | 2002 |
#ifdef CL_DEBUG |
2003 |
- cli_dbgmsg("clamfi_eom: read nothing from clamd"); |
|
2003 |
+ cli_dbgmsg("clamfi_eom: read nothing from clamd\n"); |
|
2004 | 2004 |
#endif |
2005 | 2005 |
return cl_error; |
2006 | 2006 |
} |
... | ... |
@@ -2054,7 +2059,7 @@ clamfi_eom(SMFICTX *ctx) |
2054 | 2054 |
/* |
2055 | 2055 |
* Setup err as a list of recipients |
2056 | 2056 |
*/ |
2057 |
- err = (char *)malloc(1024); |
|
2057 |
+ err = (char *)cli_malloc(1024); |
|
2058 | 2058 |
|
2059 | 2059 |
/* |
2060 | 2060 |
* Use snprintf rather than printf since we don't know the |
... | ... |
@@ -2087,7 +2092,7 @@ clamfi_eom(SMFICTX *ctx) |
2087 | 2087 |
smfi_getsymval(ctx, "i"), |
2088 | 2088 |
err); |
2089 | 2089 |
#ifdef CL_DEBUG |
2090 |
- cli_dbgmsg(err); |
|
2090 |
+ cli_dbgmsg("%s\n", err); |
|
2091 | 2091 |
#endif |
2092 | 2092 |
free(err); |
2093 | 2093 |
|
... | ... |
@@ -2152,9 +2157,10 @@ clamfi_eom(SMFICTX *ctx) |
2152 | 2152 |
if(privdata->filename != NULL) |
2153 | 2153 |
fprintf(sendmail, "\nThe message in question has been quarantined as %s\n", privdata->filename); |
2154 | 2154 |
|
2155 |
- if (hflag) { |
|
2156 |
- fprintf(sendmail, "\nThe message was received by %s from %s\n\n", |
|
2157 |
- smfi_getsymval(ctx, "j"), from); |
|
2155 |
+ if(hflag) { |
|
2156 |
+ fprintf(sendmail, "\nThe message was received by %s from %s via %s\n\n", |
|
2157 |
+ smfi_getsymval(ctx, "j"), from, |
|
2158 |
+ smfi_getsymval(ctx, "_")); |
|
2158 | 2159 |
fputs("For your information, the original message headers were:\n\n", sendmail); |
2159 | 2160 |
header_list_print(privdata->headers, sendmail); |
2160 | 2161 |
} |
... | ... |
@@ -2211,7 +2217,7 @@ clamfi_abort(SMFICTX *ctx) |
2211 | 2211 |
#ifdef CL_DEBUG |
2212 | 2212 |
if(use_syslog) |
2213 | 2213 |
syslog(LOG_DEBUG, "clamfi_abort"); |
2214 |
- cli_dbgmsg("clamfi_abort"); |
|
2214 |
+ cli_dbgmsg("clamfi_abort\n"); |
|
2215 | 2215 |
#endif |
2216 | 2216 |
|
2217 | 2217 |
/* |
... | ... |
@@ -2233,7 +2239,7 @@ clamfi_close(SMFICTX *ctx) |
2233 | 2233 |
#ifdef CL_DEBUG |
2234 | 2234 |
struct privdata *privdata = (struct privdata *)smfi_getpriv(ctx); |
2235 | 2235 |
|
2236 |
- cli_dbgmsg("clamfi_close"); |
|
2236 |
+ cli_dbgmsg("clamfi_close\n"); |
|
2237 | 2237 |
if(privdata != NULL) { |
2238 | 2238 |
if(use_syslog) |
2239 | 2239 |
syslog(LOG_DEBUG, "clamfi_close, privdata != NULL"); |
... | ... |
@@ -2281,7 +2287,7 @@ clamfi_free(struct privdata *privdata) |
2281 | 2281 |
if(privdata->from) { |
2282 | 2282 |
#ifdef CL_DEBUG |
2283 | 2283 |
if(debug_level >= 9) |
2284 |
- cli_dbgmsg("Free privdata->from"); |
|
2284 |
+ cli_dbgmsg("Free privdata->from\n"); |
|
2285 | 2285 |
#endif |
2286 | 2286 |
free(privdata->from); |
2287 | 2287 |
privdata->from = NULL; |
... | ... |
@@ -2293,13 +2299,13 @@ clamfi_free(struct privdata *privdata) |
2293 | 2293 |
for(to = privdata->to; *to; to++) { |
2294 | 2294 |
#ifdef CL_DEBUG |
2295 | 2295 |
if(debug_level >= 9) |
2296 |
- cli_dbgmsg("Free *privdata->to"); |
|
2296 |
+ cli_dbgmsg("Free *privdata->to\n"); |
|
2297 | 2297 |
#endif |
2298 | 2298 |
free(*to); |
2299 | 2299 |
} |
2300 | 2300 |
#ifdef CL_DEBUG |
2301 | 2301 |
if(debug_level >= 9) |
2302 |
- cli_dbgmsg("Free privdata->to"); |
|
2302 |
+ cli_dbgmsg("Free privdata->to\n"); |
|
2303 | 2303 |
#endif |
2304 | 2304 |
free(privdata->to); |
2305 | 2305 |
privdata->to = NULL; |
... | ... |
@@ -2321,7 +2327,7 @@ clamfi_free(struct privdata *privdata) |
2321 | 2321 |
|
2322 | 2322 |
#ifdef CL_DEBUG |
2323 | 2323 |
if(debug_level >= 9) |
2324 |
- cli_dbgmsg("Free privdata"); |
|
2324 |
+ cli_dbgmsg("Free privdata\n"); |
|
2325 | 2325 |
#endif |
2326 | 2326 |
free(privdata); |
2327 | 2327 |
} |
... | ... |
@@ -2334,7 +2340,7 @@ clamfi_free(struct privdata *privdata) |
2334 | 2334 |
if(n_children > 0) |
2335 | 2335 |
--n_children; |
2336 | 2336 |
#ifdef CL_DEBUG |
2337 |
- cli_dbgmsg("pthread_cond_broadcast"); |
|
2337 |
+ cli_dbgmsg("pthread_cond_broadcast\n"); |
|
2338 | 2338 |
#endif |
2339 | 2339 |
pthread_cond_broadcast(&n_children_cond); |
2340 | 2340 |
#ifdef CL_DEBUG |
... | ... |
@@ -2518,7 +2524,7 @@ header_list_add(header_list_t list, const char *headerf, const char *headerv) |
2518 | 2518 |
|
2519 | 2519 |
header = (char *)cli_malloc(len); |
2520 | 2520 |
snprintf(header, len, "%s: %s", headerf, headerv); |
2521 |
- new_node = (struct header_node_t *) malloc(sizeof(struct header_node_t)); |
|
2521 |
+ new_node = (struct header_node_t *)cli_malloc(sizeof(struct header_node_t)); |
|
2522 | 2522 |
new_node->header = header; |
2523 | 2523 |
new_node->next = NULL; |
2524 | 2524 |
if(!list->first) |