Browse code

NEW_WORLD: speed up when not looking for Phish

git-svn: trunk@1824

Nigel Horne authored on 2006/01/23 05:24:33
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Sun Jan 22 20:23:56 GMT 2006 (njh)
2
+----------------------------------
3
+  * libclamav/mbox.c	NEW_WORLD: speed up when not looking for Phish
4
+
1 5
 Sat Jan 21 18:35:34 GMT 2006 (njh)
2 6
 ----------------------------------
3 7
   * libclamav:		Scan uuencoded files. Helps to catch doubly encoded
... ...
@@ -15,7 +15,7 @@
15 15
  *  along with this program; if not, write to the Free Software
16 16
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 17
  */
18
-static	char	const	rcsid[] = "$Id: mbox.c,v 1.276 2006/01/21 18:39:18 nigelhorne Exp $";
18
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.277 2006/01/22 20:22:40 nigelhorne Exp $";
19 19
 
20 20
 #if HAVE_CONFIG_H
21 21
 #include "clamav-config.h"
... ...
@@ -39,10 +39,7 @@ static	char	const	rcsid[] = "$Id: mbox.c,v 1.276 2006/01/21 18:39:18 nigelhorne
39 39
 #include <strings.h>
40 40
 #include <ctype.h>
41 41
 #include <time.h>
42
-#include <unistd.h>
43 42
 #include <fcntl.h>
44
-#include <sys/stat.h>
45
-#include <sys/types.h>
46 43
 #include <sys/param.h>
47 44
 #include <clamav.h>
48 45
 #include <dirent.h>
... ...
@@ -542,16 +539,11 @@ cli_mbox(const char *dir, int desc, unsigned int options)
542 542
 			return CL_CLEAN;
543 543
 		}
544 544
 
545
-#ifdef	notdef
546
-		/* Not true, since the message could be a plain text phish */
547
-		cli_dbgmsg("cli_mbox: I believe it's plain text which must be clean\n");
548
-		return CL_CLEAN;
549
-#else
550
-		if(type == CL_TYPE_MAIL)
545
+		/* The message could be a plain text phish */
546
+		if((type == CL_TYPE_MAIL) && (!(options&CL_DB_NOPHISHING)))
551 547
 			return cli_parse_mbox(dir, desc, options);
552 548
 		cli_dbgmsg("cli_mbox: I believe it's plain text which must be clean\n");
553 549
 		return CL_CLEAN;
554
-#endif
555 550
 	}
556 551
 	free_map();
557 552
 
... ...
@@ -3570,9 +3562,11 @@ rfc1341(message *m, const char *dir)
3570 3570
 		oldfilename = (char *)messageFindArgument(m, "name");
3571 3571
 
3572 3572
 	arg = cli_malloc(10 + strlen(id) + strlen(number));
3573
-	sprintf(arg, "filename=%s%s", id, number);
3574
-	messageAddArgument(m, arg);
3575
-	free(arg);
3573
+	if(arg) {
3574
+		sprintf(arg, "filename=%s%s", id, number);
3575
+		messageAddArgument(m, arg);
3576
+		free(arg);
3577
+	}
3576 3578
 
3577 3579
 	if(oldfilename) {
3578 3580
 		cli_warnmsg("Must reset to %s\n", oldfilename);
... ...
@@ -3646,7 +3640,9 @@ rfc1341(message *m, const char *dir)
3646 3646
 					if(dent->d_ino == 0)
3647 3647
 						continue;
3648 3648
 
3649
-					sprintf(fullname, "%s/%s", pdir, dent->d_name);
3649
+					snprintf(fullname, sizeof(fullname) - 1,
3650
+						"%s/%s", pdir, dent->d_name);
3651
+
3650 3652
 					if(strncmp(filename, dent->d_name, strlen(filename)) != 0) {
3651 3653
 						if(!cli_leavetemps_flag)
3652 3654
 							continue;