Browse code

Handle multipart/knowbot as multipart/mixed

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@1039 77e5149b-7576-45b1-b177-96237e5ba77b

Nigel Horne authored on 2004/10/24 13:38:09
Showing 2 changed files
... ...
@@ -1,13 +1,18 @@
1
+Sun Oct 24 05:36:39 BST 2004 (njh)
2
+----------------------------------
3
+  * libclamav/mbox.c:		Handle multipart/knowbot as multipart/mixed
4
+			until syntax documention can be found for this format
5
+
1 6
 Sun Oct 24 04:52:01 BST 2004 (njh)
2 7
 ----------------------------------
3 8
   * libclamav/message.c:	Change encoding guess message from warn to debug
4 9
   * clamav-milter:		Validate the length of the server hostnames
5 10
 				Generate a more useful message than libmilter's
6
-					bind failure message when the two
7
-					sockets are the same named pipe
11
+			bind failure message when the two sockets are the same
12
+			named pipe
8 13
 				SESSION code now on by default
9 14
 				Use cli_strtokbuf() instead of cli_strtok()
10
-					whereever possible
15
+			whereever possible
11 16
 
12 17
 Fri Oct 22 18:20:03 BST 2004 (njh)
13 18
 ----------------------------------
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: mbox.c,v $
20
+ * Revision 1.162  2004/10/24 04:35:15  nigelhorne
21
+ * Handle multipart/knowbot as multipart/mixed
22
+ *
20 23
  * Revision 1.161  2004/10/21 10:18:40  nigelhorne
21 24
  * PARTIAL: readdir_r even more options :-(
22 25
  *
... ...
@@ -471,7 +474,7 @@
471 471
  * Compilable under SCO; removed duplicate code with message.c
472 472
  *
473 473
  */
474
-static	char	const	rcsid[] = "$Id: mbox.c,v 1.161 2004/10/21 10:18:40 nigelhorne Exp $";
474
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.162 2004/10/24 04:35:15 nigelhorne Exp $";
475 475
 
476 476
 #if HAVE_CONFIG_H
477 477
 #include "clamav-config.h"
... ...
@@ -683,6 +686,7 @@ static	void	*getURL(struct arg *arg);
683 683
 				 * pointers would be appreciated. For now
684 684
 				 * we treat it as multipart/related
685 685
 				 */
686
+#define	KNOWBOT		14	/* Unknown and undocumented format? */
686 687
 
687 688
 static	const	struct tableinit {
688 689
 	const	char	*key;
... ...
@@ -711,6 +715,10 @@ static	const	struct tableinit {
711 711
 	{	"fax-message",	FAX		},
712 712
 	{	"encrypted",	ENCRYPTED	},
713 713
 	{	"x-bfile",	X_BFILE		},	/* BeOS */
714
+	{	"knowbot",		KNOWBOT		},	/* ??? */
715
+	{	"knowbot-metadata",	KNOWBOT		},	/* ??? */
716
+	{	"knowbot-code",		KNOWBOT		},	/* ??? */
717
+	{	"knowbot-state",	KNOWBOT		},	/* ??? */
714 718
 	{	NULL,		0		}
715 719
 };
716 720
 
... ...
@@ -1228,6 +1236,7 @@ parseEmailBody(message *messageIn, text *textIn, const char *dir, const table_t
1228 1228
 				break;
1229 1229
 			}
1230 1230
 
1231
+			/* Perhaps it should assume mixed? */
1231 1232
 			if(mimeSubtype[0] == '\0') {
1232 1233
 				cli_warnmsg("Multipart has no subtype assuming alternative\n");
1233 1234
 				mimeSubtype = "alternative";
... ...
@@ -1472,12 +1481,16 @@ parseEmailBody(message *messageIn, text *textIn, const char *dir, const table_t
1472 1472
 			free((char *)boundary);
1473 1473
 
1474 1474
 			/*
1475
-			 * For multipart/encrypted
1475
+			 * Preprocess. Anything special to be done before
1476
+			 * we handle the multiparts?
1476 1477
 			 */
1477
-			if(tableFind(subtypeTable, mimeSubtype) == ENCRYPTED)
1478
-				protocol = (char *)messageFindArgument(mainMessage, "protocol");
1479
-			else
1480
-				protocol = NULL;
1478
+			switch(tableFind(subtypeTable, mimeSubtype)) {
1479
+				case KNOWBOT:
1480
+					/* TODO */
1481
+					cli_dbgmsg("multipart/knowbot parsed as multipart/mixed for now\n");
1482
+					mimeSubtype = "mixed";
1483
+					break;
1484
+			}
1481 1485
 
1482 1486
 			/*
1483 1487
 			 * We've finished message we're parsing
... ...
@@ -1488,8 +1501,6 @@ parseEmailBody(message *messageIn, text *textIn, const char *dir, const table_t
1488 1488
 			}
1489 1489
 
1490 1490
 			if(multiparts == 0) {
1491
-				if(protocol)
1492
-					free(protocol);
1493 1491
 				if(messages)
1494 1492
 					free(messages);
1495 1493
 				return 2;	/* Nothing to do */
... ...
@@ -1861,6 +1872,7 @@ parseEmailBody(message *messageIn, text *textIn, const char *dir, const table_t
1861 1861
 				break;
1862 1862
 			case ENCRYPTED:
1863 1863
 				rc = 0;
1864
+				protocol = (char *)messageFindArgument(mainMessage, "protocol");
1864 1865
 				if(protocol) {
1865 1866
 					if(strcasecmp(protocol, "application/pgp-encrypted") == 0) {
1866 1867
 						/* RFC2015 */
... ...
@@ -2815,6 +2827,7 @@ rfc1341(message *m, const char *dir)
2815 2815
 
2816 2816
 				snprintf(filename, sizeof(filename), "%s%d", id, n);
2817 2817
 #ifdef HAVE_READDIR_R_3
2818
+
2818 2819
 #if	defined(C_SOLARIS) || defined(C_BEOS)
2819 2820
 				while((readdir_r(dd, (struct dirent *)result, &dent) == 0) && dent) {
2820 2821
 #else