git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@800 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2004/08/26 18:35:40... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Thu Aug 26 10:34:48 BST 2004 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav/mbox.c: Scan CommuniGate files |
|
4 |
+ |
|
1 | 5 |
Thu Aug 26 02:53:41 CEST 2004 (tk) |
2 | 6 |
---------------------------------- |
3 | 7 |
* clamscan, clamd, zziplib: Fix possible small memory leaks (thanks to |
... | ... |
@@ -17,6 +17,9 @@ |
17 | 17 |
* |
18 | 18 |
* Change History: |
19 | 19 |
* $Log: mbox.c,v $ |
20 |
+ * Revision 1.113 2004/08/26 09:33:20 nigelhorne |
|
21 |
+ * Scan Communigate Pro files |
|
22 |
+ * |
|
20 | 23 |
* Revision 1.112 2004/08/23 13:15:16 nigelhorne |
21 | 24 |
* messageClearMarkers |
22 | 25 |
* |
... | ... |
@@ -324,7 +327,7 @@ |
324 | 324 |
* Compilable under SCO; removed duplicate code with message.c |
325 | 325 |
* |
326 | 326 |
*/ |
327 |
-static char const rcsid[] = "$Id: mbox.c,v 1.112 2004/08/23 13:15:16 nigelhorne Exp $"; |
|
327 |
+static char const rcsid[] = "$Id: mbox.c,v 1.113 2004/08/26 09:33:20 nigelhorne Exp $"; |
|
328 | 328 |
|
329 | 329 |
#if HAVE_CONFIG_H |
330 | 330 |
#include "clamav-config.h" |
... | ... |
@@ -551,6 +554,7 @@ static pthread_mutex_t tables_mutex = PTHREAD_MUTEX_INITIALIZER; |
551 | 551 |
* http://www.lazerware.com/formats/Specs/AppleSingle_AppleDouble.pdf |
552 | 552 |
* TODO: ensure parseEmailHeaders is always called before parseEmailBody |
553 | 553 |
* TODO: create parseEmail which calls parseEmailHeaders then parseEmailBody |
554 |
+ * TODO: Look into TNEF. Is there anything that needs to be done here? |
|
554 | 555 |
*/ |
555 | 556 |
int |
556 | 557 |
cli_mbox(const char *dir, int desc, unsigned int options) |
... | ... |
@@ -661,6 +665,17 @@ cli_mbox(const char *dir, int desc, unsigned int options) |
661 | 661 |
* It's a single message, parse the headers then the body |
662 | 662 |
* Ignore blank lines at the start of the message |
663 | 663 |
*/ |
664 |
+ if(strncmp(buffer, "P I ", 4) == 0) |
|
665 |
+ /* |
|
666 |
+ * CommuniGate Pro format: ignore headers until |
|
667 |
+ * blank line |
|
668 |
+ */ |
|
669 |
+ while((fgets(buffer, sizeof(buffer), fd) != NULL) && |
|
670 |
+ (strchr("\r\n", buffer[0]) == NULL)) |
|
671 |
+ ; |
|
672 |
+ /* |
|
673 |
+ * Ignore any blank lines at the top of the message |
|
674 |
+ */ |
|
664 | 675 |
while(strchr("\r\n", buffer[0]) && |
665 | 676 |
(fgets(buffer, sizeof(buffer), fd) != NULL)) |
666 | 677 |
; |
... | ... |
@@ -1450,12 +1465,6 @@ parseEmailBody(message *messageIn, text *textIn, const char *dir, const table_t |
1450 | 1450 |
case AUDIO: |
1451 | 1451 |
case IMAGE: |
1452 | 1452 |
case VIDEO: |
1453 |
- /* |
|
1454 |
- * TODO: it may be nice to |
|
1455 |
- * have an option to throw |
|
1456 |
- * away all images and sound |
|
1457 |
- * files for ultra-secure sites |
|
1458 |
- */ |
|
1459 | 1453 |
addAttachment = TRUE; |
1460 | 1454 |
break; |
1461 | 1455 |
default: |
... | ... |
@@ -1652,7 +1661,7 @@ parseEmailBody(message *messageIn, text *textIn, const char *dir, const table_t |
1652 | 1652 |
fileblobDestroy(fb); |
1653 | 1653 |
} |
1654 | 1654 |
} else if((encodingLine(mainMessage) != NULL) && |
1655 |
- ((t_line = bounceBegin(mainMessage)) != NULL)) { |
|
1655 |
+ ((t_line = bounceBegin(mainMessage)) != NULL)) { |
|
1656 | 1656 |
const text *t; |
1657 | 1657 |
static const char encoding[] = "Content-Transfer-Encoding"; |
1658 | 1658 |
/* |
... | ... |
@@ -1994,9 +2003,24 @@ parseMimeHeader(message *m, const char *cmd, const table_t *rfc821Table, const c |
1994 | 1994 |
* just simply "Content-Type:" |
1995 | 1995 |
*/ |
1996 | 1996 |
if(arg == NULL) |
1997 |
- cli_warnmsg("Empty content-type received, no subtype specified, assuming text/plain; charset=us-ascii\n"); |
|
1997 |
+ /* |
|
1998 |
+ * According to section 4 of RFC1521: |
|
1999 |
+ * "Note also that a subtype specification is |
|
2000 |
+ * MANDATORY. There are no default subtypes" |
|
2001 |
+ * |
|
2002 |
+ * We have to break this an make an assumption |
|
2003 |
+ * for the subtype because virus writers and |
|
2004 |
+ * email client writers don't get it right |
|
2005 |
+ */ |
|
2006 |
+ cli_warnmsg("Empty content-type received, no subtype specified, assuming text/plain; charset=us-ascii\n"); |
|
1998 | 2007 |
else if(strchr(copy, '/') == NULL) |
1999 |
- cli_warnmsg("Invalid content-type '%s' received, no subtype specified, assuming text/plain; charset=us-ascii\n", copy); |
|
2008 |
+ /* |
|
2009 |
+ * Empty field, such as |
|
2010 |
+ * Content-Type: |
|
2011 |
+ * which I believe is illegal according to |
|
2012 |
+ * RFC1521 |
|
2013 |
+ */ |
|
2014 |
+ cli_warnmsg("Invalid content-type '%s' received, no subtype specified, assuming text/plain; charset=us-ascii\n", copy); |
|
2000 | 2015 |
else { |
2001 | 2016 |
/* |
2002 | 2017 |
* Some clients are broken and |