git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@766 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2004/08/19 00:56:38... | ... |
@@ -1,3 +1,8 @@ |
1 |
+Wed Aug 18 16:54:01 BST 2004 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav/mbox.c: Only followURL if CL_MAILURL is set. |
|
4 |
+ Note this code is not included by default, see mbox.c |
|
5 |
+ |
|
1 | 6 |
Wed Aug 18 17:17:20 CEST 2004 (tk) |
2 | 7 |
---------------------------------- |
3 | 8 |
* clamscan: Scan mail files by default. Add new option --no-mail. |
... | ... |
@@ -17,6 +17,9 @@ |
17 | 17 |
* |
18 | 18 |
* Change History: |
19 | 19 |
* $Log: mbox.c,v $ |
20 |
+ * Revision 1.104 2004/08/18 15:53:43 nigelhorne |
|
21 |
+ * Honour CL_MAILURL |
|
22 |
+ * |
|
20 | 23 |
* Revision 1.103 2004/08/18 10:49:45 nigelhorne |
21 | 24 |
* CHECKURLs was mistakenly turned on |
22 | 25 |
* |
... | ... |
@@ -297,7 +300,7 @@ |
297 | 297 |
* Compilable under SCO; removed duplicate code with message.c |
298 | 298 |
* |
299 | 299 |
*/ |
300 |
-static char const rcsid[] = "$Id: mbox.c,v 1.103 2004/08/18 10:49:45 nigelhorne Exp $"; |
|
300 |
+static char const rcsid[] = "$Id: mbox.c,v 1.104 2004/08/18 15:53:43 nigelhorne Exp $"; |
|
301 | 301 |
|
302 | 302 |
#if HAVE_CONFIG_H |
303 | 303 |
#include "clamav-config.h" |
... | ... |
@@ -374,12 +377,12 @@ typedef enum { FALSE = 0, TRUE = 1 } bool; |
374 | 374 |
|
375 | 375 |
#define SAVE_TO_DISC /* multipart/message are saved in a temporary file */ |
376 | 376 |
|
377 |
-/*#define CHECKURLS /* |
|
377 |
+/*#define FOLLOWURLS /* |
|
378 | 378 |
* If an email contains URLs, check them - helps to |
379 | 379 |
* find Dialer.gen-45 |
380 | 380 |
*/ |
381 | 381 |
|
382 |
-#ifdef CHECKURLS |
|
382 |
+#ifdef FOLLOWURLS |
|
383 | 383 |
|
384 | 384 |
#define MAX_URLS 5 /* |
385 | 385 |
* Maximum number of URLs scanned in a message |
... | ... |
@@ -392,6 +395,9 @@ typedef enum { FALSE = 0, TRUE = 1 } bool; |
392 | 392 |
*/ |
393 | 393 |
#include <curl/curl.h> |
394 | 394 |
#endif |
395 |
+ |
|
396 |
+#else /*!FOLLOWURLS*/ |
|
397 |
+#undef WITH_CURL |
|
395 | 398 |
#endif |
396 | 399 |
|
397 | 400 |
static message *parseEmailHeaders(message *m, const table_t *rfc821Table, bool destroy); |
... | ... |
@@ -1354,7 +1360,7 @@ parseEmailBody(message *messageIn, blob **blobsIn, int nBlobs, text *textIn, con |
1354 | 1354 |
addAttachment = TRUE; |
1355 | 1355 |
} |
1356 | 1356 |
} else { |
1357 |
- /*if(options&CL_MAILURL) */ |
|
1357 |
+ if(options&CL_MAILURL) |
|
1358 | 1358 |
checkURLs(aMessage, dir); |
1359 | 1359 |
messageAddArgument(aMessage, "filename=textportion"); |
1360 | 1360 |
addAttachment = TRUE; |
... | ... |
@@ -2292,7 +2298,7 @@ saveFile(const blob *b, const char *dir) |
2292 | 2292 |
return (close(fd) >= 0); |
2293 | 2293 |
} |
2294 | 2294 |
|
2295 |
-#ifdef CHECKURLS |
|
2295 |
+#ifdef FOLLOWURLS |
|
2296 | 2296 |
static void |
2297 | 2297 |
checkURLs(message *m, const char *dir) |
2298 | 2298 |
{ |
... | ... |
@@ -2305,9 +2311,11 @@ checkURLs(message *m, const char *dir) |
2305 | 2305 |
if(b == NULL) |
2306 | 2306 |
return; |
2307 | 2307 |
|
2308 |
- ptr = (char *)blobGetData(b); |
|
2309 | 2308 |
len = blobGetDataSize(b); |
2310 | 2309 |
|
2310 |
+ if(len == 0) |
|
2311 |
+ return; |
|
2312 |
+ |
|
2311 | 2313 |
/* TODO: make this size customisable */ |
2312 | 2314 |
if(len > 100*1024) { |
2313 | 2315 |
cli_warnmsg("Viruses pointed to by URL not scanned in large message\n"); |
... | ... |
@@ -2315,12 +2323,14 @@ checkURLs(message *m, const char *dir) |
2315 | 2315 |
} |
2316 | 2316 |
|
2317 | 2317 |
t = tableCreate(); |
2318 |
+ |
|
2318 | 2319 |
n = 0; |
2320 |
+ ptr = (char *)blobGetData(b); |
|
2319 | 2321 |
|
2320 | 2322 |
/* |
2321 | 2323 |
* cli_memstr(ptr, len, "<a href=", 8) |
2322 |
- * Don't use cli_memstr() until bounds problem sorted, it becomes |
|
2323 |
- * case independant and it returns the place that the 'needle' was found |
|
2324 |
+ * Don't use cli_memstr() until bounds problem sorted |
|
2325 |
+ * and it returns the place that the 'needle' was found |
|
2324 | 2326 |
*/ |
2325 | 2327 |
while(len >= 8) { |
2326 | 2328 |
/* FIXME: allow any number of white space */ |
... | ... |
@@ -2446,7 +2456,7 @@ getURL(const char *url, const char *dir, const char *filename) |
2446 | 2446 |
return; |
2447 | 2447 |
} |
2448 | 2448 |
/* |
2449 |
- * If an item is in squid's cache get it from there (TCP_HIT/200) but |
|
2449 |
+ * If an item is in squid's cache get it from there (TCP_HIT/200) |
|
2450 | 2450 |
* by default curl doesn't (TCP_CLIENT_REFRESH_MISS/200) |
2451 | 2451 |
*/ |
2452 | 2452 |
headers = curl_slist_append(NULL, "Pragma:"); |