git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@1128 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2004/11/27 06:54:00... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Fri Nov 26 21:53:03 GMT 2004 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav/mbox.c: Scan uuencodes after the final MIME section |
|
4 |
+ |
|
1 | 5 |
Fri Nov 26 22:01:58 CET 2004 (tk) |
2 | 6 |
--------------------------------- |
3 | 7 |
* libclamav/scanners.c: cli_scanzip: apply cosmetic patch from Andrey J. |
... | ... |
@@ -17,6 +17,9 @@ |
17 | 17 |
* |
18 | 18 |
* Change History: |
19 | 19 |
* $Log: mbox.c,v $ |
20 |
+ * Revision 1.184 2004/11/26 21:51:48 nigelhorne |
|
21 |
+ * Scan uuencodes after the final MIME section |
|
22 |
+ * |
|
20 | 23 |
* Revision 1.183 2004/11/26 17:32:42 nigelhorne |
21 | 24 |
* Add debug message for end of multipart headers |
22 | 25 |
* |
... | ... |
@@ -537,7 +540,7 @@ |
537 | 537 |
* Compilable under SCO; removed duplicate code with message.c |
538 | 538 |
* |
539 | 539 |
*/ |
540 |
-static char const rcsid[] = "$Id: mbox.c,v 1.183 2004/11/26 17:32:42 nigelhorne Exp $"; |
|
540 |
+static char const rcsid[] = "$Id: mbox.c,v 1.184 2004/11/26 21:51:48 nigelhorne Exp $"; |
|
541 | 541 |
|
542 | 542 |
#if HAVE_CONFIG_H |
543 | 543 |
#include "clamav-config.h" |
... | ... |
@@ -1260,7 +1263,7 @@ static int /* success or fail */ |
1260 | 1260 |
parseEmailBody(message *messageIn, text *textIn, const char *dir, const table_t *rfc821Table, const table_t *subtypeTable, unsigned int options) |
1261 | 1261 |
{ |
1262 | 1262 |
message **messages; /* parts of a multipart message */ |
1263 |
- int inhead, inMimeHead, i, rc = 1, htmltextPart, multiparts = 0; |
|
1263 |
+ int inMimeHead, i, rc = 1, htmltextPart, multiparts = 0; |
|
1264 | 1264 |
text *aText; |
1265 | 1265 |
const char *cptr; |
1266 | 1266 |
message *mainMessage; |
... | ... |
@@ -1275,7 +1278,7 @@ parseEmailBody(message *messageIn, text *textIn, const char *dir, const table_t |
1275 | 1275 |
/* Anything left to be parsed? */ |
1276 | 1276 |
if(mainMessage && (messageGetBody(mainMessage) != NULL)) { |
1277 | 1277 |
mime_type mimeType; |
1278 |
- int subtype; |
|
1278 |
+ int subtype, inhead; |
|
1279 | 1279 |
const char *mimeSubtype, *boundary; |
1280 | 1280 |
char *protocol; |
1281 | 1281 |
const text *t_line; |
... | ... |
@@ -1456,8 +1459,9 @@ parseEmailBody(message *messageIn, text *textIn, const char *dir, const table_t |
1456 | 1456 |
do { |
1457 | 1457 |
const char *line = lineGetData(t_line->t_line); |
1458 | 1458 |
|
1459 |
- /*cli_dbgmsg("inMimeHead %d inhead %d boundary %s line '%s' next '%s'\n", |
|
1460 |
- inMimeHead, inhead, boundary, line, t_line->t_next ? t_line->t_next->t_text : "(null)");*/ |
|
1459 |
+ /*printf("inMimeHead %d inhead %d boundary %s line '%s' next '%s'\n", |
|
1460 |
+ inMimeHead, inhead, boundary, line, |
|
1461 |
+ t_line->t_next && t_line->t_next->t_line ? lineGetData(t_line->t_next->t_line) : "(null)");*/ |
|
1461 | 1462 |
|
1462 | 1463 |
if(inMimeHead) { /* continuation line */ |
1463 | 1464 |
if(line == NULL) { |
... | ... |
@@ -1598,9 +1602,6 @@ parseEmailBody(message *messageIn, text *textIn, const char *dir, const table_t |
1598 | 1598 |
if(ptr) |
1599 | 1599 |
free(ptr); |
1600 | 1600 |
} |
1601 |
- } else if(boundaryStart(line, boundary)) { |
|
1602 |
- inhead = 1; |
|
1603 |
- break; |
|
1604 | 1601 |
} else if(endOfMessage(line, boundary)) { |
1605 | 1602 |
/* |
1606 | 1603 |
* Some viruses put information |
... | ... |
@@ -1612,6 +1613,9 @@ parseEmailBody(message *messageIn, text *textIn, const char *dir, const table_t |
1612 | 1612 |
*/ |
1613 | 1613 |
/* t_line = NULL;*/ |
1614 | 1614 |
break; |
1615 |
+ } else if(boundaryStart(line, boundary)) { |
|
1616 |
+ inhead = 1; |
|
1617 |
+ break; |
|
1615 | 1618 |
} else { |
1616 | 1619 |
if(messageAddLine(aMessage, t_line->t_line) < 0) |
1617 | 1620 |
break; |
... | ... |
@@ -1840,6 +1844,18 @@ parseEmailBody(message *messageIn, text *textIn, const char *dir, const table_t |
1840 | 1840 |
if(mainMessage != messageIn) |
1841 | 1841 |
messageDestroy(mainMessage); |
1842 | 1842 |
mainMessage = NULL; |
1843 |
+ } else if(aMessage) { |
|
1844 |
+ const text *u_line = uuencodeBegin(aMessage); |
|
1845 |
+ if(u_line) { |
|
1846 |
+ cli_dbgmsg("Found uuencoded message in multipart/mixed non mime part\n"); |
|
1847 |
+ messageSetEncoding(aMessage, "x-uuencode"); |
|
1848 |
+ fb = messageToFileblob(aMessage, dir); |
|
1849 |
+ |
|
1850 |
+ if(fb) |
|
1851 |
+ fileblobDestroy(fb); |
|
1852 |
+ assert(aMessage == messages[i]); |
|
1853 |
+ messageReset(messages[i]); |
|
1854 |
+ } |
|
1843 | 1855 |
} |
1844 | 1856 |
addToText = TRUE; |
1845 | 1857 |
if(messageGetBody(aMessage) == NULL) |