git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@574 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2004/05/26 01:26:09... | ... |
@@ -1,3 +1,10 @@ |
1 |
+Tue May 25 17:24:48 BST 2004 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * clamav-milter: X-Virus-Status: Not Scanned - StreamMaxLength exceeded |
|
4 |
+ was not always being added |
|
5 |
+ Now says host running clamd rather than host running |
|
6 |
+ clamav-milter, useful for checking load balancing etc. |
|
7 |
+ |
|
1 | 8 |
Mon May 24 18:09:23 BST 2004 (njh) |
2 | 9 |
---------------------------------- |
3 | 10 |
* clamav-milter: Include hostname of the scanner (clamav-milter not |
... | ... |
@@ -396,6 +396,10 @@ Changes |
396 | 396 |
Commented out TKs advice about using quarantine when using |
397 | 397 |
localSocket, sys admins were confused by it |
398 | 398 |
0.71b 24/5/04 Add which host did the virus scanning |
399 |
+0.71c 25/5/04 X-Virus-Status: Not Scanned - StreamMaxLength exceeded was not |
|
400 |
+ always being added |
|
401 |
+ Now says host running clamd rather than host running |
|
402 |
+ clamav-milter, useful for checking load balancing etc. |
|
399 | 403 |
|
400 | 404 |
BUG REPORTS |
401 | 405 |
|
... | ... |
@@ -26,6 +26,9 @@ |
26 | 26 |
* |
27 | 27 |
* Change History: |
28 | 28 |
* $Log: clamav-milter.c,v $ |
29 |
+ * Revision 1.91 2004/05/25 16:24:21 nigelhorne |
|
30 |
+ * X-Virus-Scanned wasn't being added in maxstreamlength was exceeded |
|
31 |
+ * |
|
29 | 32 |
* Revision 1.90 2004/05/24 17:05:18 nigelhorne |
30 | 33 |
* Include the hostname of the scanner in the headers |
31 | 34 |
* |
... | ... |
@@ -281,9 +284,9 @@ |
281 | 281 |
* Revision 1.6 2003/09/28 16:37:23 nigelhorne |
282 | 282 |
* Added -f flag use MaxThreads if --max-children not set |
283 | 283 |
*/ |
284 |
-static char const rcsid[] = "$Id: clamav-milter.c,v 1.90 2004/05/24 17:05:18 nigelhorne Exp $"; |
|
284 |
+static char const rcsid[] = "$Id: clamav-milter.c,v 1.91 2004/05/25 16:24:21 nigelhorne Exp $"; |
|
285 | 285 |
|
286 |
-#define CM_VERSION "0.71b" |
|
286 |
+#define CM_VERSION "0.71c" |
|
287 | 287 |
|
288 | 288 |
/*#define CONFDIR "/usr/local/etc"*/ |
289 | 289 |
|
... | ... |
@@ -403,6 +406,7 @@ struct privdata { |
403 | 403 |
* looks like the remote end is playing ping |
404 | 404 |
* pong with us |
405 | 405 |
*/ |
406 |
+ int serverNumber; /* Index into serverIPs */ |
|
406 | 407 |
}; |
407 | 408 |
|
408 | 409 |
static int pingServer(int serverNumber); |
... | ... |
@@ -1876,11 +1880,23 @@ clamfi_eom(SMFICTX *ctx) |
1876 | 1876 |
|
1877 | 1877 |
/* |
1878 | 1878 |
* Include the hostname where the scan took place: |
1879 |
- * TODO: this should be where clamd is running, not where |
|
1880 |
- * clamav-milter is running |
|
1881 | 1879 |
*/ |
1882 |
- snprintf(buf, sizeof(buf) - 1, "%s\n\ton %s", clamav_version, |
|
1883 |
- smfi_getsymval(ctx, "{j}")); |
|
1880 |
+ if(localSocket) |
|
1881 |
+ snprintf(buf, sizeof(buf) - 1, "%s\n\ton %s", |
|
1882 |
+ clamav_version, |
|
1883 |
+ smfi_getsymval(ctx, "{j}")); |
|
1884 |
+ else { |
|
1885 |
+ char *hostname = cli_strtok(serverHostNames, privdata->serverNumber, ":"); |
|
1886 |
+ |
|
1887 |
+ if(hostname) { |
|
1888 |
+ snprintf(buf, sizeof(buf) - 1, "%s\n\ton %s", |
|
1889 |
+ clamav_version, |
|
1890 |
+ hostname); |
|
1891 |
+ free(hostname); |
|
1892 |
+ } else |
|
1893 |
+ /* sanity check failed - should issue warning */ |
|
1894 |
+ strcpy(buf, "Error determining host"); |
|
1895 |
+ } |
|
1884 | 1896 |
smfi_addheader(ctx, "X-Virus-Scanned", buf); |
1885 | 1897 |
} |
1886 | 1898 |
|
... | ... |
@@ -1892,9 +1908,9 @@ clamfi_eom(SMFICTX *ctx) |
1892 | 1892 |
if(use_syslog) |
1893 | 1893 |
syslog(LOG_NOTICE, "%s: Message more than StreamMaxLength (%ld) bytes - not scanned", |
1894 | 1894 |
sendmailId, streamMaxLength); |
1895 |
- clamfi_cleanup(ctx); /* not needed, but just to be safe */ |
|
1896 | 1895 |
if(!nflag) |
1897 | 1896 |
smfi_addheader(ctx, "X-Virus-Status", "Not Scanned - StreamMaxLength exceeded"); |
1897 |
+ clamfi_cleanup(ctx); /* not needed, but just to be safe */ |
|
1898 | 1898 |
return SMFIS_ACCEPT; |
1899 | 1899 |
} |
1900 | 1900 |
if(!nflag) |
... | ... |
@@ -2631,6 +2647,7 @@ connect2clamd(struct privdata *privdata) |
2631 | 2631 |
syslog(LOG_ERR, "Temporary quarantine file %s creation failed", privdata->filename); |
2632 | 2632 |
return 0; |
2633 | 2633 |
} |
2634 |
+ privdata->serverNumber = -1; |
|
2634 | 2635 |
} else { |
2635 | 2636 |
int freeServer, nbytes; |
2636 | 2637 |
struct sockaddr_in reply; |
... | ... |
@@ -2659,6 +2676,7 @@ connect2clamd(struct privdata *privdata) |
2659 | 2659 |
return 0; |
2660 | 2660 |
} |
2661 | 2661 |
freeServer = 0; |
2662 |
+ privdata->serverNumber = -1; |
|
2662 | 2663 |
} else { |
2663 | 2664 |
struct sockaddr_in server; |
2664 | 2665 |
|
... | ... |
@@ -2682,6 +2700,7 @@ connect2clamd(struct privdata *privdata) |
2682 | 2682 |
perror("connect"); |
2683 | 2683 |
return 0; |
2684 | 2684 |
} |
2685 |
+ privdata->serverNumber = freeServer; |
|
2685 | 2686 |
} |
2686 | 2687 |
|
2687 | 2688 |
/* |