Browse code

Not all binhex messages were being decoded

git-svn: trunk@2279

Nigel Horne authored on 2006/09/16 18:55:25
Showing 3 changed files
... ...
@@ -1,3 +1,8 @@
1
+Sat Sep 16 10:54:30 BST 2006 (njh)
2
+----------------------------------
3
+  * libclamav/message.c:	Not all binhex messages were being decoded
4
+			in experimental mode
5
+
1 6
 Fri Sep 15 17:28:24 BST 2006 (njh)
2 7
 ----------------------------------
3 8
   * libclamav/phishcheck.c:	Better way to find length of data to be
... ...
@@ -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.332 2006/09/16 08:30:55 njh Exp $";
19
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.333 2006/09/16 09:53:56 njh Exp $";
20 20
 
21 21
 #if HAVE_CONFIG_H
22 22
 #include "clamav-config.h"
... ...
@@ -2008,8 +2008,8 @@ parseEmailBody(message *messageIn, text *textIn, mbox_ctx *mctx)
2008 2008
 				checkURLs(mainMessage, mctx, &rc,subtype==HTML);/* there might be html sent without subtype html too,
2009 2009
 													so scan them for phishing too*/
2010 2010
 #ifdef CL_EXPERIMENTAL
2011
-				if(rc==3)
2012
-				infected=TRUE;
2011
+				if(rc == 3)
2012
+					infected=TRUE;
2013 2013
 			}
2014 2014
 #endif
2015 2015
 			break;
... ...
@@ -3823,8 +3823,8 @@ checkURLs(message *mainMessage, mbox_ctx *mctx, int *rc, int is_html)
3823 3823
 			       cli_dbgmsg("PH:Phishing found\n");
3824 3824
 		       }
3825 3825
 	       }
3826
-	       if(is_html && mctx->ctx->options&CL_SCAN_MAILURL)
3827
-		       do_checkURLs(mainMessage, mctx->dir,&hrefs);
3826
+	       if(is_html && (mctx->ctx->options&CL_SCAN_MAILURL) && (*rc != 3))
3827
+		       do_checkURLs(mainMessage, mctx->dir, &hrefs);
3828 3828
        }
3829 3829
        hrefs_done(b,&hrefs);
3830 3830
 }
... ...
@@ -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: message.c,v 1.185 2006/09/13 20:55:02 njh Exp $";
19
+static	char	const	rcsid[] = "$Id: message.c,v 1.186 2006/09/16 09:53:56 njh Exp $";
20 20
 
21 21
 #if HAVE_CONFIG_H
22 22
 #include "clamav-config.h"
... ...
@@ -1315,9 +1315,11 @@ messageExport(message *m, const char *dir, void *(*create)(void), void (*destroy
1315 1315
 
1316 1316
 		blobDestroy(tmp);
1317 1317
 
1318
-		m->binhex = NULL;
1318
+		if(destroy_text)
1319
+			m->binhex = NULL;
1319 1320
 
1320
-		if((m->numberOfEncTypes == 1) && (m->encodingTypes[0] == BINHEX)) {
1321
+		if((m->numberOfEncTypes == 0) ||
1322
+		   ((m->numberOfEncTypes == 1) && (m->encodingTypes[0] == BINHEX))) {
1321 1323
 			cli_dbgmsg("Finished exporting binhex file\n");
1322 1324
 			return ret;
1323 1325
 		}
... ...
@@ -1327,6 +1329,8 @@ messageExport(message *m, const char *dir, void *(*create)(void), void (*destroy
1327 1327
 		/*
1328 1328
 		 * Fast copy
1329 1329
 		 */
1330
+		cli_dbgmsg("messageExport: Entering fast copy mode\n");
1331
+
1330 1332
 		filename = (char *)messageFindArgument(m, "filename");
1331 1333
 		if(filename == NULL) {
1332 1334
 			filename = (char *)messageFindArgument(m, "name");
... ...
@@ -1581,7 +1585,11 @@ messageToFileblob(message *m, const char *dir, int destroy)
1581 1581
 blob *
1582 1582
 messageToBlob(message *m, int destroy)
1583 1583
 {
1584
-	blob *b = messageExport(m, NULL,
1584
+	blob *b;
1585
+
1586
+	cli_dbgmsg("messageToBlob\n");
1587
+
1588
+	b = messageExport(m, NULL,
1585 1589
 		(void *(*)(void))blobCreate,
1586 1590
 		(void(*)(void *))blobDestroy,
1587 1591
 		(void(*)(void *, const char *, const char *))blobSetFilename,