Browse code

Re-engineered update 1.11 lost in recent changes

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

Nigel Horne authored on 2004/01/10 00:07:42
Showing 1 changed files
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: mbox.c,v $
20
+ * Revision 1.28  2004/01/09 15:07:42  nigelhorne
21
+ * Re-engineered update 1.11 lost in recent changes
22
+ *
20 23
  * Revision 1.27  2004/01/09 14:45:59  nigelhorne
21 24
  * Removed duplicated code in multipart handler
22 25
  *
... ...
@@ -72,7 +75,7 @@
72 72
  * Compilable under SCO; removed duplicate code with message.c
73 73
  *
74 74
  */
75
-static	char	const	rcsid[] = "$Id: mbox.c,v 1.27 2004/01/09 14:45:59 nigelhorne Exp $";
75
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.28 2004/01/09 15:07:42 nigelhorne Exp $";
76 76
 
77 77
 #ifndef	CL_DEBUG
78 78
 /*#define	NDEBUG	/* map CLAMAV debug onto standard */
... ...
@@ -1414,23 +1417,31 @@ parseMimeHeader(message *m, const char *cmd, const table_t *rfc821Table, const c
1414 1414
 			else if(strchr(copy, '/') == NULL)
1415 1415
 				  cli_warnmsg("Invalid content-type '%s' received, no subtype specified, assuming text/plain; charset=us-ascii\n", copy);
1416 1416
 			else {
1417
-				char *s;
1418 1417
 				/*
1419 1418
 				 * Some clients are broken and
1420 1419
 				 * put white space after the ;
1421 1420
 				 */
1422 1421
 				strstrip(copy);
1423
-				messageSetMimeType(m, strtok_r(copy, "/", &strptr));
1422
+				if(*arg == '/') {
1423
+					cli_warnmsg("Content-type '/' received, assuming application/octet-stream\n");
1424
+					messageSetMimeType(m, "application");
1425
+					messageSetMimeSubtype(m, "octet-stream");
1426
+					(void)strtok_r(arg, ";", &strptr);
1427
+				} else {
1428
+					char *s;
1424 1429
 
1425
-				/*
1426
-				 * Stephen White <stephen@earth.li>
1427
-				 * Some clients put space after
1428
-				 * the mime type but before
1429
-				 * the ;
1430
-				 */
1431
-				s = strtok_r(NULL, ";", &strptr);
1432
-				strstrip(s);
1433
-				messageSetMimeSubtype(m, s);
1430
+					messageSetMimeType(m, strtok_r(copy, "/", &strptr));
1431
+
1432
+					/*
1433
+					 * Stephen White <stephen@earth.li>
1434
+					 * Some clients put space after
1435
+					 * the mime type but before
1436
+					 * the ;
1437
+					 */
1438
+					s = strtok_r(NULL, ";", &strptr);
1439
+					strstrip(s);
1440
+					messageSetMimeSubtype(m, s);
1441
+				}
1434 1442
 
1435 1443
 				/*
1436 1444
 				 * Add in all the arguments.