git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@512 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2004/04/20 23:15:01... | ... |
@@ -331,6 +331,10 @@ Changes |
331 | 331 |
make them easier to manage |
332 | 332 |
0.70n 20/4/04 Allow for "i" macro not defined in sendmail.cf |
333 | 333 |
clamfi_connect: print better message if hostaddr is null |
334 |
+0.70o 20/4/04 Added X-Virus-Status |
|
335 |
+ Always add X-Virus-Scanned |
|
336 |
+ If hostaddr is NULL assume it's a local connection. This |
|
337 |
+ is probably a safe assumption but it should be verified |
|
334 | 338 |
|
335 | 339 |
BUG REPORTS |
336 | 340 |
|
... | ... |
@@ -332,9 +332,16 @@ |
332 | 332 |
* make them easier to manage |
333 | 333 |
* 0.70n 20/4/04 Allow for "i" macro not defined in sendmail.cf |
334 | 334 |
* clamfi_connect: print better message if hostaddr is null |
335 |
+ * 0.70o 20/4/04 Added X-Virus-Status |
|
336 |
+ * Always add X-Virus-Scanned |
|
337 |
+ * If hostaddr is NULL assume it's a local connection. This |
|
338 |
+ * is probably a safe assumption but it should be verified |
|
335 | 339 |
* |
336 | 340 |
* Change History: |
337 | 341 |
* $Log: clamav-milter.c,v $ |
342 |
+ * Revision 1.79 2004/04/20 14:15:01 nigelhorne |
|
343 |
+ * Sorted out X- headers and handle hostaddr == NULL |
|
344 |
+ * |
|
338 | 345 |
* Revision 1.78 2004/04/20 08:13:15 nigelhorne |
339 | 346 |
* Print better message if hostaddr is null |
340 | 347 |
* |
... | ... |
@@ -554,9 +561,9 @@ |
554 | 554 |
* Revision 1.6 2003/09/28 16:37:23 nigelhorne |
555 | 555 |
* Added -f flag use MaxThreads if --max-children not set |
556 | 556 |
*/ |
557 |
-static char const rcsid[] = "$Id: clamav-milter.c,v 1.78 2004/04/20 08:13:15 nigelhorne Exp $"; |
|
557 |
+static char const rcsid[] = "$Id: clamav-milter.c,v 1.79 2004/04/20 14:15:01 nigelhorne Exp $"; |
|
558 | 558 |
|
559 |
-#define CM_VERSION "0.70n" |
|
559 |
+#define CM_VERSION "0.70o" |
|
560 | 560 |
|
561 | 561 |
/*#define CONFDIR "/usr/local/etc"*/ |
562 | 562 |
|
... | ... |
@@ -814,7 +821,7 @@ help(void) |
814 | 814 |
puts("\t--local\t\t\t-l\tScan messages sent from machines on our LAN."); |
815 | 815 |
puts("\t--outgoing\t\t-o\tScan outgoing messages from this machine."); |
816 | 816 |
puts("\t--noreject\t\t-N\tDon't reject viruses, silently throw them away."); |
817 |
- puts("\t--noxheader\t\t-n\tSuppress X-Virus-Scanned header."); |
|
817 |
+ puts("\t--noxheader\t\t-n\tSuppress X-Virus-Scanned/X-Virus-Status headers."); |
|
818 | 818 |
puts("\t--postmaster\t\t-p EMAIL\tPostmaster address [default=postmaster]."); |
819 | 819 |
puts("\t--postmaster-only\t-P\tSend warnings only to the postmaster."); |
820 | 820 |
puts("\t--quiet\t\t\t-q\tDon't send e-mail notifications of interceptions."); |
... | ... |
@@ -1577,24 +1584,27 @@ clamfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr) |
1577 | 1577 |
syslog(LOG_ERR, "clamfi_connect: hostname is null"); |
1578 | 1578 |
return cl_error; |
1579 | 1579 |
} |
1580 |
- if(hostaddr == NULL) { |
|
1581 |
- if(use_syslog) |
|
1582 |
- syslog(LOG_ERR, |
|
1583 |
- "clamfi_connect: hostaddr for '%s' is null", |
|
1584 |
- hostname); |
|
1585 |
- return cl_error; |
|
1586 |
- } |
|
1587 |
- |
|
1580 |
+ if(hostaddr == NULL) |
|
1581 |
+ /* |
|
1582 |
+ * According to the sendmail API hostaddr is NULL if |
|
1583 |
+ * "the type is not supported in the current version". What |
|
1584 |
+ * the documentation doesn't say is the type of what? |
|
1585 |
+ * |
|
1586 |
+ * Possibly the input is not a TCP/IP socket? |
|
1587 |
+ */ |
|
1588 |
+ remoteIP = "127.0.0.1"; |
|
1589 |
+ else { |
|
1588 | 1590 |
#ifdef HAVE_INET_NTOP |
1589 |
- remoteIP = (char *)inet_ntop(AF_INET, &((struct sockaddr_in *)(hostaddr))->sin_addr, ip, sizeof(ip)); |
|
1591 |
+ remoteIP = (char *)inet_ntop(AF_INET, &((struct sockaddr_in *)(hostaddr))->sin_addr, ip, sizeof(ip)); |
|
1590 | 1592 |
#else |
1591 |
- remoteIP = inet_ntoa(((struct sockaddr_in *)(hostaddr))->sin_addr); |
|
1593 |
+ remoteIP = inet_ntoa(((struct sockaddr_in *)(hostaddr))->sin_addr); |
|
1592 | 1594 |
#endif |
1593 | 1595 |
|
1594 |
- if(remoteIP == NULL) { |
|
1595 |
- if(use_syslog) |
|
1596 |
- syslog(LOG_ERR, "clamfi_connect: remoteIP is null"); |
|
1597 |
- return cl_error; |
|
1596 |
+ if(remoteIP == NULL) { |
|
1597 |
+ if(use_syslog) |
|
1598 |
+ syslog(LOG_ERR, "clamfi_connect: remoteIP is null"); |
|
1599 |
+ return cl_error; |
|
1600 |
+ } |
|
1598 | 1601 |
} |
1599 | 1602 |
|
1600 | 1603 |
#ifdef CL_DEBUG |
... | ... |
@@ -2062,7 +2072,13 @@ clamfi_eom(SMFICTX *ctx) |
2062 | 2062 |
if(sendmailId == NULL) |
2063 | 2063 |
sendmailId = "Unknown"; |
2064 | 2064 |
|
2065 |
+ if(!nflag) |
|
2066 |
+ smfi_addheader(ctx, "X-Virus-Scanned", clamav_version); |
|
2067 |
+ |
|
2065 | 2068 |
if(strstr(mess, "ERROR") != NULL) { |
2069 |
+ if(!nflag) |
|
2070 |
+ smfi_addheader(ctx, "X-Virus-Status", "Not Scanned"); |
|
2071 |
+ |
|
2066 | 2072 |
if(strstr(mess, "Size exceeded") != NULL) { |
2067 | 2073 |
/* |
2068 | 2074 |
* Clamd has stopped on StreamMaxLength before us |
... | ... |
@@ -2083,7 +2099,7 @@ clamfi_eom(SMFICTX *ctx) |
2083 | 2083 |
|
2084 | 2084 |
if(strstr(mess, "FOUND") == NULL) { |
2085 | 2085 |
if(!nflag) |
2086 |
- smfi_addheader(ctx, "X-Virus-Scanned", clamav_version); |
|
2086 |
+ smfi_addheader(ctx, "X-Virus-Status", "Clean"); |
|
2087 | 2087 |
|
2088 | 2088 |
/* |
2089 | 2089 |
* TODO: if privdata->from is NULL it's probably SPAM, and |
... | ... |
@@ -2115,6 +2131,9 @@ clamfi_eom(SMFICTX *ctx) |
2115 | 2115 |
char **to, *err; |
2116 | 2116 |
char reject[1024]; |
2117 | 2117 |
|
2118 |
+ if(!nflag) |
|
2119 |
+ smfi_addheader(ctx, "X-Virus-Status", "Infected"); |
|
2120 |
+ |
|
2118 | 2121 |
/* |
2119 | 2122 |
* Setup err as a list of recipients |
2120 | 2123 |
*/ |