Browse code

Set MIME.RecursionLimit when --max-mail-recursion is hit

git-svn: trunk@2583

Nigel Horne authored on 2006/12/30 06:22:12
Showing 2 changed files
... ...
@@ -1,6 +1,11 @@
1
+Fri Dec 29 21:21:08 GMT 2006 (njh)
2
+----------------------------------
3
+  * libclamav/mbox.c:	Set MIME.RecursionLimit when --max-mail-recursion is hit
4
+
1 5
 Thu Dec 28 15:09:37 GMT 2006 (njh)
2 6
 ----------------------------------
3
-  * libclamav/mbox.c:	Some HTML.Phishing.Bank-512 being found (bug 33)
7
+  * libclamav/mbox.c:	Some HTML.Phishing.Bank-512 were not being found
8
+				(bug 33)
4 9
 
5 10
 Wed Dec 27 23:14:57 GMT 2006 (njh)
6 11
 ----------------------------------
... ...
@@ -16,7 +16,7 @@
16 16
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 17
  *  MA 02110-1301, USA.
18 18
  */
19
-static	char	const	rcsid[] = "$Id: mbox.c,v 1.367 2006/12/28 15:07:55 njh Exp $";
19
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.368 2006/12/29 21:20:37 njh Exp $";
20 20
 
21 21
 #ifdef	_MSC_VER
22 22
 #include <winsock.h>	/* only needed in CL_EXPERIMENTAL */
... ...
@@ -2044,10 +2044,14 @@ parseEmailBody(message *messageIn, text *textIn, mbox_ctx *mctx, unsigned int re
2044 2044
 	cli_dbgmsg("in parseEmailBody\n");
2045 2045
 
2046 2046
 	if(mctx->ctx->limits->maxmailrec)
2047
-		if(recursion_level >= mctx->ctx->limits->maxmailrec) {
2047
+		/*
2048
+		 * This is approximate
2049
+		 */
2050
+		if(recursion_level > mctx->ctx->limits->maxmailrec) {
2048 2051
 			cli_warnmsg("parseEmailBody: hit maximum recursion level (%u)\n",
2049
-				mctx->ctx->limits->maxmailrec);
2050
-			return OK_ATTACHMENTS_NOT_SAVED;
2052
+				recursion_level);
2053
+			*mctx->ctx->virname = "MIME.RecursionLimit";
2054
+			return VIRUS;
2051 2055
 		}
2052 2056
 
2053 2057
 	/* Anything left to be parsed? */
... ...
@@ -2500,7 +2504,7 @@ parseEmailBody(message *messageIn, text *textIn, mbox_ctx *mctx, unsigned int re
2500 2500
 						mainMessage = do_multipart(mainMessage,
2501 2501
 							messages, multiparts,
2502 2502
 							&rc, mctx, messageIn,
2503
-							&aText, recursion_level + 1);
2503
+							&aText, recursion_level);
2504 2504
 						--multiparts;
2505 2505
 						if(rc == VIRUS)
2506 2506
 							infected = TRUE;
... ...
@@ -5189,7 +5193,7 @@ do_multipart(message *mainMessage, message **messages, int i, mbox_status *rc, m
5189 5189
 					cli_dbgmsg("Found binhex message in multipart/mixed mainMessage\n");
5190 5190
 
5191 5191
 					if(exportBinhexMessage(mctx->dir, mainMessage))
5192
-						*rc = 3;
5192
+						*rc = VIRUS;
5193 5193
 				}
5194 5194
 				if(mainMessage != messageIn)
5195 5195
 					messageDestroy(mainMessage);
... ...
@@ -5198,7 +5202,7 @@ do_multipart(message *mainMessage, message **messages, int i, mbox_status *rc, m
5198 5198
 				if(binhexBegin(aMessage)) {
5199 5199
 					cli_dbgmsg("Found binhex message in multipart/mixed non mime part\n");
5200 5200
 					if(exportBinhexMessage(mctx->dir, aMessage))
5201
-						*rc = 3;
5201
+						*rc = VIRUS;
5202 5202
 					assert(aMessage == messages[i]);
5203 5203
 					messageReset(messages[i]);
5204 5204
 				}
... ...
@@ -5328,7 +5332,7 @@ do_multipart(message *mainMessage, message **messages, int i, mbox_status *rc, m
5328 5328
 				messageSetCTX(body, mctx->ctx);
5329 5329
 				*rc = parseEmailBody(body, NULL, mctx, recursion_level + 1);
5330 5330
 				if(messageContainsVirus(body))
5331
-					*rc = 3;
5331
+					*rc = VIRUS;
5332 5332
 				messageDestroy(body);
5333 5333
 			}
5334 5334
 #endif
... ...
@@ -5371,12 +5375,12 @@ do_multipart(message *mainMessage, message **messages, int i, mbox_status *rc, m
5371 5371
 
5372 5372
 		if(fb) {
5373 5373
 			if(fileblobContainsVirus(fb))
5374
-				*rc = 3;
5374
+				*rc = VIRUS;
5375 5375
 			fileblobDestroy(fb);
5376 5376
 		}
5377 5377
 	}
5378 5378
 	if(messageContainsVirus(aMessage))
5379
-		*rc = 3;
5379
+		*rc = VIRUS;
5380 5380
 	messageDestroy(aMessage);
5381 5381
 	messages[i] = NULL;
5382 5382