Browse code

Faster handling of bounce messages

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

Nigel Horne authored on 2005/02/04 06:10:42
Showing 3 changed files
... ...
@@ -1,3 +1,7 @@
1
+Thu Feb  3 21:09:34 GMT 2005 (njh)
2
+----------------------------------
3
+  * libclamav/mbox.c:	Speed improvements in the handling of bounce messages
4
+
1 5
 Wed Feb  2 08:32:46 GMT 2005 (njh)
2 6
 ----------------------------------
3 7
   * clamav-milter:	Call watchdog when neither SESSION nor --external is
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: mbox.c,v $
20
+ * Revision 1.215  2005/02/03 21:07:33  nigelhorne
21
+ * Faster handling of bounce messages
22
+ *
20 23
  * Revision 1.214  2005/02/01 14:46:06  nigelhorne
21 24
  * Decode encapsulated bounce messages that have been base64 encoded (needlessly :-) )
22 25
  *
... ...
@@ -630,7 +633,7 @@
630 630
  * Compilable under SCO; removed duplicate code with message.c
631 631
  *
632 632
  */
633
-static	char	const	rcsid[] = "$Id: mbox.c,v 1.214 2005/02/01 14:46:06 nigelhorne Exp $";
633
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.215 2005/02/03 21:07:33 nigelhorne Exp $";
634 634
 
635 635
 #if HAVE_CONFIG_H
636 636
 #include "clamav-config.h"
... ...
@@ -2506,14 +2509,25 @@ parseEmailBody(message *messageIn, text *textIn, const char *dir, const table_t
2506 2506
 						/* Content-Type: message/rfc822 */
2507 2507
 						cli_dbgmsg("Found message inside multipart (encoding type %d)\n",
2508 2508
 							messageGetEncoding(aMessage));
2509
-#if	0
2510
-						if(messageGetEncoding(aMessage) == NOMIME) {
2511
-							cli_dbgmsg("No encoding line found in the multipart/message\n");
2512
-							assert(aMessage == messages[i]);
2513
-							messageDestroy(messages[i]);
2514
-							messages[i] = NULL;
2515
-							continue;
2509
+						switch(messageGetEncoding(aMessage)) {
2510
+							case NOENCODING:
2511
+							case EIGHTBIT:
2512
+							case BINARY:
2513
+								if(encodingLine(aMessage) == NULL) {
2514
+									/*
2515
+									 * This means that the message has no attachments
2516
+									 * The test for messageGetEncoding is needed since
2517
+									 * encodingLine won't have been set if the message
2518
+									 * itself has been encoded
2519
+									 */
2520
+									cli_dbgmsg("No encoding line found in the multipart/message\n");
2521
+									assert(aMessage == messages[i]);
2522
+									messageDestroy(messages[i]);
2523
+									messages[i] = NULL;
2524
+									continue;
2525
+								}
2516 2526
 						}
2527
+#if	0
2517 2528
 						messageAddStrAtTop(aMessage,
2518 2529
 							"Received: by clamd (message/rfc822)");
2519 2530
 #endif
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: message.c,v $
20
+ * Revision 1.141  2005/02/03 21:07:34  nigelhorne
21
+ * Faster handling of bounce messages
22
+ *
20 23
  * Revision 1.140  2005/02/02 08:35:09  nigelhorne
21 24
  * Improved debug message
22 25
  *
... ...
@@ -417,7 +420,7 @@
417 417
  * uuencodebegin() no longer static
418 418
  *
419 419
  */
420
-static	char	const	rcsid[] = "$Id: message.c,v 1.140 2005/02/02 08:35:09 nigelhorne Exp $";
420
+static	char	const	rcsid[] = "$Id: message.c,v 1.141 2005/02/03 21:07:34 nigelhorne Exp $";
421 421
 
422 422
 #if HAVE_CONFIG_H
423 423
 #include "clamav-config.h"
... ...
@@ -693,7 +696,7 @@ messageSetMimeType(message *mess, const char *type)
693 693
 				if(highestSimil >= 50) {
694 694
 					cli_dbgmsg("Unknown MIME type \"%s\" - guessing as %s (%u%% certainty)\n",
695 695
 						type, closest, highestSimil);
696
-					mess->mimeType = t;
696
+					mess->mimeType = (mime_type)t;
697 697
 				} else {
698 698
 					cli_dbgmsg("Unknown MIME type: `%s', set to Application - if you believe this file contains a virus, report it to bugs@clamav.net\n", type);
699 699
 					mess->mimeType = APPLICATION;