diff --git a/clamav-devel/ChangeLog b/clamav-devel/ChangeLog index 27d0cacd4..4baae2d4e 100644 --- a/clamav-devel/ChangeLog +++ b/clamav-devel/ChangeLog @@ -1,3 +1,7 @@ +Tue Nov 9 19:43:38 GMT 2004 (njh) +---------------------------------- + * libclamav: Scan uuencoded files in preambles to multipart messages + Tue Nov 9 12:25:20 GMT 2004 (njh) ---------------------------------- * libclamav/mbox.c: Better handling of mail-follow-urls when CURL is not diff --git a/clamav-devel/libclamav/mbox.c b/clamav-devel/libclamav/mbox.c index 6d311959f..58ad71738 100644 --- a/clamav-devel/libclamav/mbox.c +++ b/clamav-devel/libclamav/mbox.c @@ -17,6 +17,9 @@ * * Change History: * $Log: mbox.c,v $ + * Revision 1.173 2004/11/09 19:40:06 nigelhorne + * Find uuencoded files in preambles to multipart messages + * * Revision 1.172 2004/11/09 13:33:38 nigelhorne * Tidy * @@ -504,7 +507,7 @@ * Compilable under SCO; removed duplicate code with message.c * */ -static char const rcsid[] = "$Id: mbox.c,v 1.172 2004/11/09 13:33:38 nigelhorne Exp $"; +static char const rcsid[] = "$Id: mbox.c,v 1.173 2004/11/09 19:40:06 nigelhorne Exp $"; #if HAVE_CONFIG_H #include "clamav-config.h" @@ -1130,7 +1133,8 @@ parseEmailHeaders(const message *m, const table_t *rfc821) } if(fullline) { - cli_warnmsg("parseEmailHeaders: Fullline set '%s' - report to bugs@clamav.net\n"); + if(*fullline) + cli_warnmsg("parseEmailHeaders: Fullline set '%s' - report to bugs@clamav.net\n"); free(fullline); } @@ -1325,8 +1329,22 @@ parseEmailBody(message *messageIn, text *textIn, const char *dir, const table_t } do - if(boundaryStart(lineGetData(t_line->t_line), boundary)) - break; + if(t_line->t_line) { + if(boundaryStart(lineGetData(t_line->t_line), boundary)) + break; + /* + * Found a uuencoded file before the first multipart + * TODO: check yEnc and binhex here + */ + if(uuencodeBegin(mainMessage) == t_line) + if(messageGetEncoding(mainMessage) == NOENCODING) { + messageSetEncoding(mainMessage, "x-uuencode"); + fb = messageToFileblob(mainMessage, dir); + + if(fb) + fileblobDestroy(fb); + } + } while((t_line = t_line->t_next) != NULL); if(t_line == NULL) { diff --git a/clamav-devel/libclamav/message.c b/clamav-devel/libclamav/message.c index d3cde9464..1115ac30e 100644 --- a/clamav-devel/libclamav/message.c +++ b/clamav-devel/libclamav/message.c @@ -17,6 +17,9 @@ * * Change History: * $Log: message.c,v $ + * Revision 1.112 2004/11/09 19:40:06 nigelhorne + * Find uuencoded files in preambles to multipart messages + * * Revision 1.111 2004/11/08 16:27:09 nigelhorne * Fix crash with correctly encoded uuencode files * @@ -330,7 +333,7 @@ * uuencodebegin() no longer static * */ -static char const rcsid[] = "$Id: message.c,v 1.111 2004/11/08 16:27:09 nigelhorne Exp $"; +static char const rcsid[] = "$Id: message.c,v 1.112 2004/11/09 19:40:06 nigelhorne Exp $"; #if HAVE_CONFIG_H #include "clamav-config.h" @@ -1595,6 +1598,7 @@ messageExport(message *m, const char *dir, void *(*create)(void), void (*destroy (*setFilename)(ret, dir, filename); t_line = t_line->t_next; enctype = UUENCODE; + m->uuencode = NULL; } else if(((enctype == YENCODE) && yEncBegin(m)) || ((i == 0) && yEncBegin(m))) { /* * TODO: handle multipart yEnc encoded files @@ -1618,6 +1622,7 @@ messageExport(message *m, const char *dir, void *(*create)(void), void (*destroy } t_line = t_line->t_next; enctype = YENCODE; + m->yenc = NULL; } else { filename = (char *)messageFindArgument(m, "filename"); if(filename == NULL) { @@ -1886,7 +1891,9 @@ messageToText(message *m) if((data[0] == '\n') || (data[0] == '\0')) last->t_line = NULL; else if(line && (strncmp(data, line, strlen(line)) == 0)) { +#ifdef CL_DEBUG cli_dbgmsg("messageToText: decoded line is the same(%s)\n", data); +#endif last->t_line = lineLink(t_line->t_line); } else last->t_line = lineCreate((char *)data); @@ -2244,9 +2251,11 @@ decode(message *m, const char *in, unsigned char *out, unsigned char (*decoder)( unsigned char b1, b2, b3, b4; unsigned char cb1, cb2, cb3; /* carried over from last line */ +#ifdef CL_DEBUG cli_dbgmsg("decode %s (len %d isFast %d base64chars %d)\n", in, in ? strlen(in) : 0, isFast, m->base64chars); +#endif cb1 = cb2 = cb3 = '\0';