Browse code

messageClearMarkers

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

Nigel Horne authored on 2004/08/23 22:17:09
Showing 4 changed files
... ...
@@ -1,3 +1,9 @@
1
+Mon Aug 23 14:15:42 BST 2004 (njh)
2
+----------------------------------
3
+  * libclamav:		Some emails included within the body of other emails
4
+				(such as bounces and cut 'n' pastes) were
5
+				being scanned twice
6
+
1 7
 Mon Aug 23 11:25:01 BST 2004 (njh)
2 8
 ----------------------------------
3 9
   * libclamav/blob.c:	Fix compilation error on Cygwin
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: mbox.c,v $
20
+ * Revision 1.112  2004/08/23 13:15:16  nigelhorne
21
+ * messageClearMarkers
22
+ *
20 23
  * Revision 1.111  2004/08/22 20:20:14  nigelhorne
21 24
  * Tidy
22 25
  *
... ...
@@ -321,7 +324,7 @@
321 321
  * Compilable under SCO; removed duplicate code with message.c
322 322
  *
323 323
  */
324
-static	char	const	rcsid[] = "$Id: mbox.c,v 1.111 2004/08/22 20:20:14 nigelhorne Exp $";
324
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.112 2004/08/23 13:15:16 nigelhorne Exp $";
325 325
 
326 326
 #if HAVE_CONFIG_H
327 327
 #include "clamav-config.h"
... ...
@@ -1591,6 +1594,7 @@ parseEmailBody(message *messageIn, text *textIn, const char *dir, const table_t
1591 1591
 				if(fb) {
1592 1592
 					cli_dbgmsg("Saving main message as attachment\n");
1593 1593
 					fileblobDestroy(fb);
1594
+					messageClearMarkers(mainMessage);
1594 1595
 				}
1595 1596
 			} /*else
1596 1597
 				cli_warnmsg("Discarded application not sent as attachment\n");*/
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: message.c,v $
20
+ * Revision 1.75  2004/08/23 13:15:16  nigelhorne
21
+ * messageClearMarkers
22
+ *
20 23
  * Revision 1.74  2004/08/22 15:08:59  nigelhorne
21 24
  * messageExport
22 25
  *
... ...
@@ -219,7 +222,7 @@
219 219
  * uuencodebegin() no longer static
220 220
  *
221 221
  */
222
-static	char	const	rcsid[] = "$Id: message.c,v 1.74 2004/08/22 15:08:59 nigelhorne Exp $";
222
+static	char	const	rcsid[] = "$Id: message.c,v 1.75 2004/08/23 13:15:16 nigelhorne Exp $";
223 223
 
224 224
 #if HAVE_CONFIG_H
225 225
 #include "clamav-config.h"
... ...
@@ -270,6 +273,7 @@ static	char	const	rcsid[] = "$Id: message.c,v 1.74 2004/08/22 15:08:59 nigelhorn
270 270
 typedef enum { FALSE = 0, TRUE = 1 } bool;
271 271
 
272 272
 static	void	messageIsEncoding(message *m);
273
+static	const	text	*binhexBegin(const message *m);
273 274
 static	unsigned char	*decodeLine(message *m, const char *line, unsigned char *buf, size_t buflen);
274 275
 static unsigned char *decode(message *m, const char *in, unsigned char *out, unsigned char (*decoder)(char), bool isFast);
275 276
 static	void	squeeze(char *s);
... ...
@@ -277,6 +281,7 @@ static	unsigned	char	hex(char c);
277 277
 static	unsigned	char	base64(char c);
278 278
 static	unsigned	char	uudecode(char c);
279 279
 static	const	char	*messageGetArgument(const message *m, int arg);
280
+static	void	*messageExport(message *m, const char *dir, void *(*create)(void), void (*destroy)(void *), void (*setFilename)(void *, const char *, const char *), void (*addData)(void *, const unsigned char *, size_t), void *(*exportText)(const text *, void *));
280 281
 
281 282
 /*
282 283
  * These maps are ordered in decreasing likelyhood of their appearance
... ...
@@ -978,11 +983,11 @@ messageClean(message *m)
978 978
 /*
979 979
  * Export a message using the given export routines
980 980
  */
981
-void *
981
+static void *
982 982
 messageExport(message *m, const char *dir, void *(*create)(void), void (*destroy)(void *), void (*setFilename)(void *, const char *, const char *), void (*addData)(void *, const unsigned char *, size_t), void *(*exportText)(const text *, void *))
983 983
 {
984 984
 	void *ret;
985
-	const text *t_line = NULL;
985
+	const text *t_line;
986 986
 	char *filename;
987 987
 
988 988
 	assert(m != NULL);
... ...
@@ -1380,6 +1385,7 @@ messageExport(message *m, const char *dir, void *(*create)(void), void (*destroy
1380 1380
 fileblob *
1381 1381
 messageToFileblob(message *m, const char *dir)
1382 1382
 {
1383
+	cli_dbgmsg("messageToFileblob\n");
1383 1384
 	return messageExport(m, dir, fileblobCreate, fileblobDestroy, fileblobSetFilename, fileblobAddData, textToFileblob);
1384 1385
 }
1385 1386
 
... ...
@@ -1436,7 +1442,7 @@ messageToText(message *m)
1436 1436
 			t_line = t_line->t_next;
1437 1437
 		} else {
1438 1438
 			if(binhexBegin(m))
1439
-				cli_warnmsg("Binhex messages not supported yet (2).\n");
1439
+				cli_warnmsg("Binhex messages not supported yet.\n");
1440 1440
 			t_line = messageGetBody(m);
1441 1441
 		}
1442 1442
 
... ...
@@ -1543,7 +1549,7 @@ uuencodeBegin(const message *m)
1543 1543
  * Scan to find the BINHEX message (if any)
1544 1544
  */
1545 1545
 #if	0
1546
-const text *
1546
+static const text *
1547 1547
 binhexBegin(const message *m)
1548 1548
 {
1549 1549
 	const text *t_line;
... ...
@@ -1555,7 +1561,7 @@ binhexBegin(const message *m)
1555 1555
 	return NULL;
1556 1556
 }
1557 1557
 #else
1558
-const text *
1558
+static const text *
1559 1559
 binhexBegin(const message *m)
1560 1560
 {
1561 1561
 	return m->binhex;
... ...
@@ -1618,6 +1624,12 @@ encodingLine(const message *m)
1618 1618
 }
1619 1619
 #endif
1620 1620
 
1621
+void
1622
+messageClearMarkers(message *m)
1623
+{
1624
+	m->encoding = m->bounce = m->uuencode = m->binhex = NULL;
1625
+}
1626
+
1621 1627
 /*
1622 1628
  * Decode a line and add it to a buffer, return the end of the buffer
1623 1629
  * to help appending callers. There is no new line at the end of "line"
... ...
@@ -16,6 +16,9 @@
16 16
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 17
  *
18 18
  * $Log: message.h,v $
19
+ * Revision 1.16  2004/08/23 13:15:16  nigelhorne
20
+ * messageClearMarkers
21
+ *
19 22
  * Revision 1.15  2004/08/22 15:08:59  nigelhorne
20 23
  * messageExport
21 24
  *
... ...
@@ -97,13 +100,12 @@ int	messageAddStr(message *m, const char *data);
97 97
 int	messageAddStrAtTop(message *m, const char *data);
98 98
 const	text	*messageGetBody(const message *m);
99 99
 void	messageClean(message *m);
100
-void	*messageExport(message *m, const char *dir, void *(*create)(void), void (*destroy)(void *), void (*setFilename)(void *, const char *, const char *), void (*addData)(void *, const unsigned char *, size_t), void *(*exportText)(const text *, void *));
101 100
 fileblob	*messageToFileblob(message *m, const char *dir);
102 101
 blob	*messageToBlob(message *m);
103 102
 text	*messageToText(message *m);
104 103
 const	text	*uuencodeBegin(const message *m);
105
-const	text	*binhexBegin(const message *m);
106 104
 const	text	*bounceBegin(const message *m);
107 105
 const	text	*encodingLine(const message *m);
106
+void	messageClearMarkers(message *m);
108 107
 
109 108
 #endif	/*_MESSAGE_H*/