git-svn: trunk@3267
Nigel Horne authored on 2007/10/05 20:02:23... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Fri Oct 5 11:02:07 BST 2007 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * clamav-milter: Corrected comment on the meaning of NTRIES |
|
4 |
+ |
|
1 | 5 |
Thu Oct 4 15:16:45 CEST 2007 (tk) |
2 | 6 |
---------------------------------- |
3 | 7 |
* libclamav/matcher-ac.c: fix range calculation for multipart sigs with string |
... | ... |
@@ -33,7 +33,7 @@ |
33 | 33 |
*/ |
34 | 34 |
static char const rcsid[] = "$Id: clamav-milter.c,v 1.312 2007/02/12 22:24:21 njh Exp $"; |
35 | 35 |
|
36 |
-#define CM_VERSION "devel-20081001" |
|
36 |
+#define CM_VERSION "devel-20081005" |
|
37 | 37 |
|
38 | 38 |
#if HAVE_CONFIG_H |
39 | 39 |
#include "clamav-config.h" |
... | ... |
@@ -170,7 +170,7 @@ typedef unsigned int in_addr_t; |
170 | 170 |
|
171 | 171 |
#define VERSION_LENGTH 128 |
172 | 172 |
#define DEFAULT_TIMEOUT 120 |
173 |
-#define NTRIES 30 /* How long to wait for the local clamd to start */ |
|
173 |
+#define NTRIES 5 /* How many times we try to connect to a clamd */ |
|
174 | 174 |
|
175 | 175 |
/*#define SESSION*/ |
176 | 176 |
/* Keep one command connexion open to clamd, otherwise a new |
... | ... |
@@ -2254,8 +2254,7 @@ pingServer(int serverNumber) |
2254 | 2254 |
cli_dbgmsg("pingServer%d: sending VERSION\n", serverNumber); |
2255 | 2255 |
if(send(sock, "VERSION\n", 8, 0) < 8) { |
2256 | 2256 |
perror("send"); |
2257 |
- close(sock); |
|
2258 |
- return 0; |
|
2257 |
+ return close(sock); |
|
2259 | 2258 |
} |
2260 | 2259 |
|
2261 | 2260 |
shutdown(sock, SHUT_WR); |
... | ... |
@@ -4565,8 +4564,7 @@ connect2clamd(struct privdata *privdata) |
4565 | 4565 |
|
4566 | 4566 |
pthread_mutex_lock(&sstatus_mutex); |
4567 | 4567 |
session->status = CMDSOCKET_DOWN; |
4568 |
- pthread_mutex_unlock(&sstatus_mutex); |
|
4569 |
- return 0; |
|
4568 |
+ return pthread_mutex_unlock(&sstatus_mutex); |
|
4570 | 4569 |
} |
4571 | 4570 |
#else |
4572 | 4571 |
nbytes = clamd_recv(privdata->cmdSocket, buf, sizeof(buf)); |
... | ... |
@@ -6176,17 +6174,15 @@ resolve(const char *host, table_t *t) |
6176 | 6176 |
* Currently only handles ip4, a and mx fields in the DNS record |
6177 | 6177 |
* Having said that, this is NOT a replacement for spf-milter, it is NOT |
6178 | 6178 |
* an SPF system, we ONLY use SPF records to reduce phish false positives |
6179 |
- * TODO: ptr |
|
6180 | 6179 |
* TODO: IPv6? |
6181 | 6180 |
* TODO: cache queries? |
6181 |
+ * TODO: check res_query is thread safe |
|
6182 | 6182 |
* |
6183 | 6183 |
* INPUT: prevhosts, a list of hosts already searched: stops include loops |
6184 | 6184 |
* e.g. mercado.com includes medrcadosw.com which includes mercado.com, |
6185 | 6185 |
* causing a loop |
6186 | 6186 |
* Return 1 if SPF says this email is from a legitimate source |
6187 | 6187 |
* 0 for fail or unknown |
6188 |
- * |
|
6189 |
- * TODO: check res_query is thread safe |
|
6190 | 6188 |
*/ |
6191 | 6189 |
static int |
6192 | 6190 |
spf(struct privdata *privdata, table_t *prevhosts) |
... | ... |
@@ -6231,6 +6227,7 @@ spf(struct privdata *privdata, table_t *prevhosts) |
6231 | 6231 |
if(ptr) |
6232 | 6232 |
*ptr = '\0'; |
6233 | 6233 |
|
6234 |
+ logg("*SPF query '%s'\n", host); |
|
6234 | 6235 |
len = res_query(host, C_IN, T_TXT, (u_char *)&q, sizeof(q)); |
6235 | 6236 |
if(len < 0) { |
6236 | 6237 |
free(host); |