git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@2060 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2006/07/03 18:19:15... | ... |
@@ -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.315 2006/07/01 21:03:36 njh Exp $"; |
|
19 |
+static char const rcsid[] = "$Id: mbox.c,v 1.316 2006/07/03 09:19:15 njh Exp $"; |
|
20 | 20 |
|
21 | 21 |
#if HAVE_CONFIG_H |
22 | 22 |
#include "clamav-config.h" |
... | ... |
@@ -206,7 +206,7 @@ static int getTextPart(message *const messages[], size_t size); |
206 | 206 |
static size_t strip(char *buf, int len); |
207 | 207 |
static bool continuationMarker(const char *line); |
208 | 208 |
static int parseMimeHeader(message *m, const char *cmd, const table_t *rfc821Table, const char *arg); |
209 |
-static void saveTextPart(message *m, const char *dir); |
|
209 |
+static void saveTextPart(message *m, const char *dir, int destroy_text); |
|
210 | 210 |
static char *rfc2047(const char *in); |
211 | 211 |
static char *rfc822comments(const char *in, char *out); |
212 | 212 |
#ifdef PARTIAL_DIR |
... | ... |
@@ -2089,6 +2089,10 @@ parseEmailBody(message *messageIn, text *textIn, mbox_ctx *mctx) |
2089 | 2089 |
* of objects called messages, one for each of the |
2090 | 2090 |
* multiparts that mainMessage contains |
2091 | 2091 |
* |
2092 |
+ * TODO: The array is probably no longer needed, we can |
|
2093 |
+ * export to file each time around the loop rather than |
|
2094 |
+ * add to the array |
|
2095 |
+ * |
|
2092 | 2096 |
* This looks like parseEmailHeaders() - maybe there's |
2093 | 2097 |
* some duplication of code to be cleaned up |
2094 | 2098 |
*/ |
... | ... |
@@ -2562,7 +2566,7 @@ parseEmailBody(message *messageIn, text *textIn, mbox_ctx *mctx) |
2562 | 2562 |
fileblobSetFilename(fb, mctx->dir, "textpart"); |
2563 | 2563 |
/*fileblobAddData(fb, "Received: by clamd (textpart)\n", 30);*/ |
2564 | 2564 |
fileblobSetCTX(fb, mctx->ctx); |
2565 |
- (void)textToFileblob(aText, fb, 0); |
|
2565 |
+ (void)textToFileblob(aText, fb, 1); |
|
2566 | 2566 |
|
2567 | 2567 |
fileblobDestroy(fb); |
2568 | 2568 |
} |
... | ... |
@@ -2913,7 +2917,7 @@ parseEmailBody(message *messageIn, text *textIn, mbox_ctx *mctx) |
2913 | 2913 |
|
2914 | 2914 |
if(saveIt) { |
2915 | 2915 |
cli_dbgmsg("Saving text part to scan\n"); |
2916 |
- saveTextPart(mainMessage, mctx->dir); |
|
2916 |
+ saveTextPart(mainMessage, mctx->dir, 1); |
|
2917 | 2917 |
if(mainMessage != messageIn) { |
2918 | 2918 |
messageDestroy(mainMessage); |
2919 | 2919 |
mainMessage = NULL; |
... | ... |
@@ -3388,12 +3392,12 @@ parseMimeHeader(message *m, const char *cmd, const table_t *rfc821Table, const c |
3388 | 3388 |
* Save the text portion of the message |
3389 | 3389 |
*/ |
3390 | 3390 |
static void |
3391 |
-saveTextPart(message *m, const char *dir) |
|
3391 |
+saveTextPart(message *m, const char *dir, int destroy_text) |
|
3392 | 3392 |
{ |
3393 | 3393 |
fileblob *fb; |
3394 | 3394 |
|
3395 | 3395 |
messageAddArgument(m, "filename=textportion"); |
3396 |
- if((fb = messageToFileblob(m, dir, 0)) != NULL) { |
|
3396 |
+ if((fb = messageToFileblob(m, dir, destroy_text)) != NULL) { |
|
3397 | 3397 |
/* |
3398 | 3398 |
* Save main part to scan that |
3399 | 3399 |
*/ |
... | ... |
@@ -4433,7 +4437,7 @@ do_multipart(message *mainMessage, message **messages, int i, int *rc, mbox_ctx |
4433 | 4433 |
* Save this embedded message |
4434 | 4434 |
* to a temporary file |
4435 | 4435 |
*/ |
4436 |
- saveTextPart(aMessage, mctx->dir); |
|
4436 |
+ saveTextPart(aMessage, mctx->dir, 1); |
|
4437 | 4437 |
assert(aMessage == messages[i]); |
4438 | 4438 |
messageDestroy(messages[i]); |
4439 | 4439 |
messages[i] = NULL; |
... | ... |
@@ -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.177 2006/07/01 16:17:35 njh Exp $"; |
|
19 |
+static char const rcsid[] = "$Id: message.c,v 1.178 2006/07/03 09:19:15 njh Exp $"; |
|
20 | 20 |
|
21 | 21 |
#if HAVE_CONFIG_H |
22 | 22 |
#include "clamav-config.h" |
... | ... |
@@ -1504,6 +1504,10 @@ messageExport(message *m, const char *dir, void *(*create)(void), void (*destroy |
1504 | 1504 |
/*if(enctype == BASE64) |
1505 | 1505 |
if(strchr(line, '=')) |
1506 | 1506 |
break;*/ |
1507 |
+ if(line && destroy_text && (i == m->numberOfEncTypes - 1)) { |
|
1508 |
+ lineUnlink(t_line->t_line); |
|
1509 |
+ t_line->t_line = NULL; |
|
1510 |
+ } |
|
1507 | 1511 |
|
1508 | 1512 |
} while((t_line = t_line->t_next) != NULL); |
1509 | 1513 |
|