Browse code

Text/plain now handled as no encoding

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

Nigel Horne authored on 2004/12/05 01:03:55
Showing 3 changed files
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: mbox.c,v $
20
+ * Revision 1.198  2004/12/04 16:03:55  nigelhorne
21
+ * Text/plain now handled as no encoding
22
+ *
20 23
  * Revision 1.197  2004/12/04 15:50:39  nigelhorne
21 24
  * Handle text/rfc822-headers incorrectly sent as message/rfc822-headers
22 25
  *
... ...
@@ -579,7 +582,7 @@
579 579
  * Compilable under SCO; removed duplicate code with message.c
580 580
  *
581 581
  */
582
-static	char	const	rcsid[] = "$Id: mbox.c,v 1.197 2004/12/04 15:50:39 nigelhorne Exp $";
582
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.198 2004/12/04 16:03:55 nigelhorne Exp $";
583 583
 
584 584
 #if HAVE_CONFIG_H
585 585
 #include "clamav-config.h"
... ...
@@ -1009,7 +1012,7 @@ cli_mbox(const char *dir, int desc, unsigned int options)
1009 1009
 			 * of code I want to avoid
1010 1010
 			 */
1011 1011
 			(void)cli_chomp(buffer);
1012
-			
1012
+
1013 1013
 			/*
1014 1014
 			 * Ignore leading CR, e.g. if newlines are LFCR instead
1015 1015
 			 * or CRLF
... ...
@@ -1347,8 +1350,8 @@ parseEmailBody(message *messageIn, text *textIn, const char *dir, const table_t
1347 1347
 		mimeType = messageGetMimeType(mainMessage);
1348 1348
 		mimeSubtype = messageGetMimeSubtype(mainMessage);
1349 1349
 
1350
-		subtype = tableFind(subtypeTable, mimeSubtype);
1351 1350
 		/* pre-process */
1351
+		subtype = tableFind(subtypeTable, mimeSubtype);
1352 1352
 		if((mimeType == TEXT) && (subtype == PLAIN)) {
1353 1353
 			/*
1354 1354
 			 * This is effectively no encoding, notice that we
... ...
@@ -1375,18 +1378,8 @@ parseEmailBody(message *messageIn, text *textIn, const char *dir, const table_t
1375 1375
 			aText = textAddMessage(aText, mainMessage);
1376 1376
 			break;
1377 1377
 		case TEXT:
1378
-			if(subtype == PLAIN)
1379
-				/*
1380
-				 * Consider what to do if this fails
1381
-				 * (i.e. aText == NULL):
1382
-				 * We mustn't just return since that could
1383
-				 * cause a virus to be missed that we
1384
-				 * could be capable of scanning. Ignoring
1385
-				 * the error is probably the safest, we may be
1386
-				 * able to scan anyway and we lose nothing
1387
-				 */
1388
-				aText = textCopy(messageGetBody(mainMessage));
1389
-			else if((options&CL_SCAN_MAILURL) && (subtype == HTML))
1378
+			/* text/plain has been preprocessed as no encoding */
1379
+			if((options&CL_SCAN_MAILURL) && (subtype == HTML))
1390 1380
 				checkURLs(mainMessage, dir);
1391 1381
 			break;
1392 1382
 		case MULTIPART:
... ...
@@ -16,6 +16,9 @@
16 16
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 17
  *
18 18
  * $Log: text.c,v $
19
+ * Revision 1.12  2004/12/04 16:03:55  nigelhorne
20
+ * Text/plain now handled as no encoding
21
+ *
19 22
  * Revision 1.11  2004/11/27 21:54:26  nigelhorne
20 23
  * Tidy
21 24
  *
... ...
@@ -42,14 +45,14 @@
42 42
  *
43 43
  */
44 44
 
45
-static	char	const	rcsid[] = "$Id: text.c,v 1.11 2004/11/27 21:54:26 nigelhorne Exp $";
45
+static	char	const	rcsid[] = "$Id: text.c,v 1.12 2004/12/04 16:03:55 nigelhorne Exp $";
46 46
 
47 47
 #if HAVE_CONFIG_H
48 48
 #include "clamav-config.h"
49 49
 #endif
50 50
 
51 51
 #include <stdlib.h>
52
-#if	C_DARWIN
52
+#ifdef	C_DARWIN
53 53
 #include <sys/types.h>
54 54
 #include <sys/malloc.h>
55 55
 #else
... ...
@@ -70,6 +73,8 @@ static	char	const	rcsid[] = "$Id: text.c,v 1.11 2004/11/27 21:54:26 nigelhorne E
70 70
 #include "text.h"
71 71
 #include "others.h"
72 72
 
73
+static	text	*textCopy(const text *t_head);
74
+
73 75
 void
74 76
 textDestroy(text *t_head)
75 77
 {
... ...
@@ -95,7 +100,7 @@ textClean(text *t_head)
95 95
 }
96 96
 
97 97
 /* Clone the current object */
98
-text *
98
+static text *
99 99
 textCopy(const text *t_head)
100 100
 {
101 101
 	text *first = NULL, *last = NULL;
... ...
@@ -16,6 +16,9 @@
16 16
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 17
  *
18 18
  * $Log: text.h,v $
19
+ * Revision 1.7  2004/12/04 16:03:55  nigelhorne
20
+ * Text/plain now handled as no encoding
21
+ *
19 22
  * Revision 1.6  2004/08/22 10:34:24  nigelhorne
20 23
  * Use fileblob
21 24
  *
... ...
@@ -39,7 +42,6 @@ typedef struct text {
39 39
 
40 40
 void	textDestroy(text *t_head);
41 41
 text	*textClean(text *t_head);
42
-text	*textCopy(const text *t_head);
43 42
 text	*textAdd(text *t_head, const text *t);
44 43
 text	*textAddMessage(text *aText, message *aMessage);
45 44
 blob	*textToBlob(const text *t, blob *b);