git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@1082 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2004/11/10 04:43:48... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Tue Nov 9 19:43:38 GMT 2004 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav: Scan uuencoded files in preambles to multipart messages |
|
4 |
+ |
|
1 | 5 |
Tue Nov 9 12:25:20 GMT 2004 (njh) |
2 | 6 |
---------------------------------- |
3 | 7 |
* libclamav/mbox.c: Better handling of mail-follow-urls when CURL is not |
... | ... |
@@ -17,6 +17,9 @@ |
17 | 17 |
* |
18 | 18 |
* Change History: |
19 | 19 |
* $Log: mbox.c,v $ |
20 |
+ * Revision 1.173 2004/11/09 19:40:06 nigelhorne |
|
21 |
+ * Find uuencoded files in preambles to multipart messages |
|
22 |
+ * |
|
20 | 23 |
* Revision 1.172 2004/11/09 13:33:38 nigelhorne |
21 | 24 |
* Tidy |
22 | 25 |
* |
... | ... |
@@ -504,7 +507,7 @@ |
504 | 504 |
* Compilable under SCO; removed duplicate code with message.c |
505 | 505 |
* |
506 | 506 |
*/ |
507 |
-static char const rcsid[] = "$Id: mbox.c,v 1.172 2004/11/09 13:33:38 nigelhorne Exp $"; |
|
507 |
+static char const rcsid[] = "$Id: mbox.c,v 1.173 2004/11/09 19:40:06 nigelhorne Exp $"; |
|
508 | 508 |
|
509 | 509 |
#if HAVE_CONFIG_H |
510 | 510 |
#include "clamav-config.h" |
... | ... |
@@ -1130,7 +1133,8 @@ parseEmailHeaders(const message *m, const table_t *rfc821) |
1130 | 1130 |
} |
1131 | 1131 |
|
1132 | 1132 |
if(fullline) { |
1133 |
- cli_warnmsg("parseEmailHeaders: Fullline set '%s' - report to bugs@clamav.net\n"); |
|
1133 |
+ if(*fullline) |
|
1134 |
+ cli_warnmsg("parseEmailHeaders: Fullline set '%s' - report to bugs@clamav.net\n"); |
|
1134 | 1135 |
free(fullline); |
1135 | 1136 |
} |
1136 | 1137 |
|
... | ... |
@@ -1325,8 +1329,22 @@ parseEmailBody(message *messageIn, text *textIn, const char *dir, const table_t |
1325 | 1325 |
} |
1326 | 1326 |
|
1327 | 1327 |
do |
1328 |
- if(boundaryStart(lineGetData(t_line->t_line), boundary)) |
|
1329 |
- break; |
|
1328 |
+ if(t_line->t_line) { |
|
1329 |
+ if(boundaryStart(lineGetData(t_line->t_line), boundary)) |
|
1330 |
+ break; |
|
1331 |
+ /* |
|
1332 |
+ * Found a uuencoded file before the first multipart |
|
1333 |
+ * TODO: check yEnc and binhex here |
|
1334 |
+ */ |
|
1335 |
+ if(uuencodeBegin(mainMessage) == t_line) |
|
1336 |
+ if(messageGetEncoding(mainMessage) == NOENCODING) { |
|
1337 |
+ messageSetEncoding(mainMessage, "x-uuencode"); |
|
1338 |
+ fb = messageToFileblob(mainMessage, dir); |
|
1339 |
+ |
|
1340 |
+ if(fb) |
|
1341 |
+ fileblobDestroy(fb); |
|
1342 |
+ } |
|
1343 |
+ } |
|
1330 | 1344 |
while((t_line = t_line->t_next) != NULL); |
1331 | 1345 |
|
1332 | 1346 |
if(t_line == NULL) { |
... | ... |
@@ -17,6 +17,9 @@ |
17 | 17 |
* |
18 | 18 |
* Change History: |
19 | 19 |
* $Log: message.c,v $ |
20 |
+ * Revision 1.112 2004/11/09 19:40:06 nigelhorne |
|
21 |
+ * Find uuencoded files in preambles to multipart messages |
|
22 |
+ * |
|
20 | 23 |
* Revision 1.111 2004/11/08 16:27:09 nigelhorne |
21 | 24 |
* Fix crash with correctly encoded uuencode files |
22 | 25 |
* |
... | ... |
@@ -330,7 +333,7 @@ |
330 | 330 |
* uuencodebegin() no longer static |
331 | 331 |
* |
332 | 332 |
*/ |
333 |
-static char const rcsid[] = "$Id: message.c,v 1.111 2004/11/08 16:27:09 nigelhorne Exp $"; |
|
333 |
+static char const rcsid[] = "$Id: message.c,v 1.112 2004/11/09 19:40:06 nigelhorne Exp $"; |
|
334 | 334 |
|
335 | 335 |
#if HAVE_CONFIG_H |
336 | 336 |
#include "clamav-config.h" |
... | ... |
@@ -1595,6 +1598,7 @@ messageExport(message *m, const char *dir, void *(*create)(void), void (*destroy |
1595 | 1595 |
(*setFilename)(ret, dir, filename); |
1596 | 1596 |
t_line = t_line->t_next; |
1597 | 1597 |
enctype = UUENCODE; |
1598 |
+ m->uuencode = NULL; |
|
1598 | 1599 |
} else if(((enctype == YENCODE) && yEncBegin(m)) || ((i == 0) && yEncBegin(m))) { |
1599 | 1600 |
/* |
1600 | 1601 |
* TODO: handle multipart yEnc encoded files |
... | ... |
@@ -1618,6 +1622,7 @@ messageExport(message *m, const char *dir, void *(*create)(void), void (*destroy |
1618 | 1618 |
} |
1619 | 1619 |
t_line = t_line->t_next; |
1620 | 1620 |
enctype = YENCODE; |
1621 |
+ m->yenc = NULL; |
|
1621 | 1622 |
} else { |
1622 | 1623 |
filename = (char *)messageFindArgument(m, "filename"); |
1623 | 1624 |
if(filename == NULL) { |
... | ... |
@@ -1886,7 +1891,9 @@ messageToText(message *m) |
1886 | 1886 |
if((data[0] == '\n') || (data[0] == '\0')) |
1887 | 1887 |
last->t_line = NULL; |
1888 | 1888 |
else if(line && (strncmp(data, line, strlen(line)) == 0)) { |
1889 |
+#ifdef CL_DEBUG |
|
1889 | 1890 |
cli_dbgmsg("messageToText: decoded line is the same(%s)\n", data); |
1891 |
+#endif |
|
1890 | 1892 |
last->t_line = lineLink(t_line->t_line); |
1891 | 1893 |
} else |
1892 | 1894 |
last->t_line = lineCreate((char *)data); |
... | ... |
@@ -2244,9 +2251,11 @@ decode(message *m, const char *in, unsigned char *out, unsigned char (*decoder)( |
2244 | 2244 |
unsigned char b1, b2, b3, b4; |
2245 | 2245 |
unsigned char cb1, cb2, cb3; /* carried over from last line */ |
2246 | 2246 |
|
2247 |
+#ifdef CL_DEBUG |
|
2247 | 2248 |
cli_dbgmsg("decode %s (len %d isFast %d base64chars %d)\n", in, |
2248 | 2249 |
in ? strlen(in) : 0, |
2249 | 2250 |
isFast, m->base64chars); |
2251 |
+#endif |
|
2250 | 2252 |
|
2251 | 2253 |
cb1 = cb2 = cb3 = '\0'; |
2252 | 2254 |
|