Browse code

NEW_WORLD - detect phishes

git-svn: trunk@2008

Nigel Horne authored on 2006/06/07 05:55:20
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Tue Jun  6 21:54:37 BST 2006 (njh)
2
+----------------------------------
3
+  * libclamav/mbox.c:	NEW_WORLD: wasn't detecting all phishes
4
+
1 5
 Tue Jun  6 16:36:40 BST 2006 (njh)
2 6
 ----------------------------------
3 7
   * clamav-milter:	Corrected the semantics of the failure to deliver
... ...
@@ -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.308 2006/06/06 16:57:00 njh Exp $";
19
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.309 2006/06/06 20:53:50 njh Exp $";
20 20
 
21 21
 #if HAVE_CONFIG_H
22 22
 #include "clamav-config.h"
... ...
@@ -163,7 +163,7 @@ typedef enum	{ FALSE = 0, TRUE = 1 } bool;
163 163
  */
164 164
 #define	PARTIAL_DIR
165 165
 
166
-/*#define	NEW_WORLD*/
166
+#define	NEW_WORLD
167 167
 
168 168
 /*#define	SCAN_UNENCODED_BOUNCES	*//*
169 169
 					 * Slows things down a lot and only catches unencoded copies
... ...
@@ -545,10 +545,18 @@ cli_mbox(const char *dir, int desc, cli_ctx *ctx)
545 545
 			return CL_CLEAN;
546 546
 		}
547 547
 
548
-		/* The message could be a plain text phish */
549
-		if((type == CL_TYPE_MAIL) && (!(ctx->options&CL_DB_NOPHISHING)))
548
+		/*
549
+		 * The message could be a plain text phish
550
+		 * FIXME: Can't get to the option whether we are looking for
551
+		 *	phishes or not, so assume we are, this slows things a
552
+		 *	lot
553
+		 * Should be
554
+		 *	if((type == CL_TYPE_MAIL) && (!(no-phishing))
555
+		 */
556
+		if(type == CL_TYPE_MAIL)
550 557
 			return cli_parse_mbox(dir, desc, ctx);
551
-		cli_dbgmsg("cli_mbox: I believe it's plain text which must be clean\n");
558
+		cli_dbgmsg("cli_mbox: I believe it's plain text (type == %d) which must be clean\n",
559
+			type);
552 560
 		return CL_CLEAN;
553 561
 	}
554 562
 	free_map();
... ...
@@ -676,10 +684,11 @@ cli_mbox(const char *dir, int desc, cli_ctx *ctx)
676 676
 					char *newline, *equal;
677 677
 					unsigned char *bigbuf, *data;
678 678
 					unsigned char smallbuf[1024];
679
+					const char *cptr;
679 680
 
680 681
 					/*printf("%ld: ", b64size); fflush(stdout);*/
681 682
 
682
-					for(ptr = b64start; b64size && (*ptr != '\n') && (*ptr != '\r'); ptr++) {
683
+					for(cptr = b64start; b64size && (*cptr != '\n') && (*cptr != '\r'); cptr++) {
683 684
 						length++;
684 685
 						--b64size;
685 686
 					}
... ...
@@ -732,12 +741,12 @@ cli_mbox(const char *dir, int desc, cli_ctx *ctx)
732 732
 					if(fileblobContainsVirus(fb))
733 733
 						break;
734 734
 
735
-					if((b64size > 0) && (*ptr == '\r')) {
736
-						b64start = ++ptr;
735
+					if((b64size > 0) && (*cptr == '\r')) {
736
+						b64start = ++cptr;
737 737
 						--b64size;
738 738
 					}
739
-					if((b64size > 0) && (*ptr == '\n')) {
740
-						b64start = ++ptr;
739
+					if((b64size > 0) && (*cptr == '\n')) {
740
+						b64start = ++cptr;
741 741
 						--b64size;
742 742
 					}
743 743
 					if(lastline)
... ...
@@ -815,10 +824,11 @@ cli_mbox(const char *dir, int desc, cli_ctx *ctx)
815 815
 				do {
816 816
 					int length = 0;
817 817
 					char *newline;
818
+					const char *cptr;
818 819
 
819 820
 					/*printf("%ld: ", quotedsize); fflush(stdout);*/
820 821
 
821
-					for(ptr = quotedstart; quotedsize && (*ptr != '\n') && (*ptr != '\r'); ptr++) {
822
+					for(cptr = quotedstart; quotedsize && (*cptr != '\n') && (*cptr != '\r'); cptr++) {
822 823
 						length++;
823 824
 						--quotedsize;
824 825
 					}
... ...
@@ -838,12 +848,12 @@ cli_mbox(const char *dir, int desc, cli_ctx *ctx)
838 838
 					if(messageAddStr(m, line) < 0)
839 839
 						break;
840 840
 
841
-					if((quotedsize > 0) && (*ptr == '\r')) {
842
-						quotedstart = ++ptr;
841
+					if((quotedsize > 0) && (*cptr == '\r')) {
842
+						quotedstart = ++cptr;
843 843
 						--quotedsize;
844 844
 					}
845
-					if((quotedsize > 0) && (*ptr == '\n')) {
846
-						quotedstart = ++ptr;
845
+					if((quotedsize > 0) && (*cptr == '\n')) {
846
+						quotedstart = ++cptr;
847 847
 						--quotedsize;
848 848
 					}
849 849
 				} while(quotedsize > 0L);