Browse code

Better error message on message/partial

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

Nigel Horne authored on 2004/10/01 16:58:27
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Fri Oct  1 08:57:42 BST 2004 (njh)
2
+----------------------------------
3
+  * libclamav/mbox.c:	Better error message for 'message/partial' emails
4
+
1 5
 Fri Oct  1 02:28:08 CEST 2004 (tk)
2 6
 ----------------------------------
3 7
   * clamd: add new directive IdleTimeout (patch by Andrey J. Melnikoff (TEMHOTA)
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: mbox.c,v $
20
+ * Revision 1.144  2004/10/01 07:55:36  nigelhorne
21
+ * Better error message on message/partial
22
+ *
20 23
  * Revision 1.143  2004/09/30 21:47:35  nigelhorne
21 24
  * Removed unneeded strdups
22 25
  *
... ...
@@ -417,7 +420,7 @@
417 417
  * Compilable under SCO; removed duplicate code with message.c
418 418
  *
419 419
  */
420
-static	char	const	rcsid[] = "$Id: mbox.c,v 1.143 2004/09/30 21:47:35 nigelhorne Exp $";
420
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.144 2004/10/01 07:55:36 nigelhorne Exp $";
421 421
 
422 422
 #if HAVE_CONFIG_H
423 423
 #include "clamav-config.h"
... ...
@@ -1753,17 +1756,19 @@ parseEmailBody(message *messageIn, text *textIn, const char *dir, const table_t
1753 1753
 				/* RFC 2298 - handle like a normal email */
1754 1754
 				break;
1755 1755
 			else if(strcasecmp(mimeSubtype, "partial") == 0)
1756
-				/* TODO */
1757
-				cli_warnmsg("Content-type message/partial not yet supported\n");
1758
-			else if(strcasecmp(mimeSubtype, "external-body") == 0)
1759 1756
 				/*
1760
-				 * I don't believe that we should be going
1761
-				 * around the Internet looking for referenced
1762
-				 * files...
1757
+				 * How can we be expected to reassemble a message when in
1758
+				 * practice we'll be called once for each email so we won't
1759
+				 * have all the parts for reassembly. It is up to the
1760
+				 * calling program to reassemble full messages and pass
1761
+				 * them on to us for scanning
1763 1762
 				 */
1763
+				cli_warnmsg("Partial message received from MUA/MTA - message cannot be scanned\n");
1764
+			else if(strcasecmp(mimeSubtype, "external-body") == 0)
1765
+				/* TODO */
1764 1766
 				cli_warnmsg("Attempt to send Content-type message/external-body trapped");
1765 1767
 			else
1766
-				cli_warnmsg("Unsupported message format `%s'\n", mimeSubtype);
1768
+				cli_warnmsg("Unsupported message format `%s' - please report to bugs@clamav.net\n", mimeSubtype);
1767 1769
 
1768 1770
 			if(mainMessage && (mainMessage != messageIn))
1769 1771
 				messageDestroy(mainMessage);
... ...
@@ -2542,18 +2547,21 @@ checkURLs(message *m, const char *dir)
2542 2542
 	if(b == NULL)
2543 2543
 		return;
2544 2544
 
2545
-	blobClose(b);
2546 2545
 	len = blobGetDataSize(b);
2547 2546
 
2548
-	if(len == 0)
2547
+	if(len == 0) {
2548
+		blobDestroy(b);
2549 2549
 		return;
2550
+	}
2550 2551
 
2551 2552
 	/* TODO: make this size customisable */
2552 2553
 	if(len > 100*1024) {
2553 2554
 		cli_warnmsg("Viruses pointed to by URL not scanned in large message\n");
2554 2555
 		blobDestroy(b);
2556
+		return;
2555 2557
 	}
2556 2558
 
2559
+	blobClose(b);
2557 2560
 	t = tableCreate();
2558 2561
 	if(t == NULL) {
2559 2562
 		blobDestroy(b);