Allow any number of alternatives in multipart messages

git-svn: trunk@616
remotes/push_mirror/metadata
Nigel Horne 21 years ago
parent 456edb5589
commit b726511fbb
  1. 5
      clamav-devel/ChangeLog
  2. 25
      clamav-devel/libclamav/mbox.c
  3. 2
      clamav-devel/libclamav/mbox.h

@ -1,3 +1,8 @@
Fri Jun 18 11:08:26 BST 2004 (njh)
----------------------------------
* libclamav: Allow any number of alternatives in
multipart messages
Wed Jun 16 09:09:45 BST 2004 (njh)
----------------------------------
* clamav-milter: Added access to sendmail variables in template

@ -17,6 +17,9 @@
*
* Change History:
* $Log: mbox.c,v $
* Revision 1.77 2004/06/18 10:07:12 nigelhorne
* Allow any number of alternatives in multipart messages
*
* Revision 1.76 2004/06/16 08:07:39 nigelhorne
* Added thread safety
*
@ -216,7 +219,7 @@
* Compilable under SCO; removed duplicate code with message.c
*
*/
static char const rcsid[] = "$Id: mbox.c,v 1.76 2004/06/16 08:07:39 nigelhorne Exp $";
static char const rcsid[] = "$Id: mbox.c,v 1.77 2004/06/18 10:07:12 nigelhorne Exp $";
#if HAVE_CONFIG_H
#include "clamav-config.h"
@ -651,7 +654,7 @@ parseEmailHeader(message *m, const char *line, const table_t *rfc821Table)
static int /* success or fail */
parseEmailBody(message *messageIn, blob **blobsIn, int nBlobs, text *textIn, const char *dir, table_t *rfc821Table, table_t *subtypeTable)
{
message *messages[MAXALTERNATIVE];
message **messages; /* parts of a multipart message */
int inhead, inMimeHead, i, rc = 1, htmltextPart, multiparts = 0;
text *aText;
blob *blobList[MAX_ATTACHMENTS], **blobs;
@ -668,6 +671,7 @@ parseEmailBody(message *messageIn, blob **blobsIn, int nBlobs, text *textIn, con
aText = textIn;
blobs = blobsIn;
messages = NULL;
mainMessage = messageIn;
/* Anything left to be parsed? */
@ -767,9 +771,11 @@ parseEmailBody(message *messageIn, blob **blobsIn, int nBlobs, text *textIn, con
* This looks like parseEmailHeaders() - maybe there's
* some duplication of code to be cleaned up
*/
for(multiparts = 0; t_line && (multiparts < MAXALTERNATIVE); multiparts++) {
for(multiparts = 0; t_line; multiparts++) {
int lines = 0;
messages = cli_realloc(messages, ((multiparts + 1) * sizeof(message *)));
aMessage = messages[multiparts] = messageCreate();
cli_dbgmsg("Now read in part %d\n", multiparts);
@ -903,8 +909,11 @@ parseEmailBody(message *messageIn, blob **blobsIn, int nBlobs, text *textIn, con
mainMessage = NULL;
}
if(multiparts == 0)
if(multiparts == 0) {
if(messages)
free(messages);
return 2; /* Nothing to do */
}
cli_dbgmsg("The message has %d parts\n", multiparts);
cli_dbgmsg("Find out the multipart type(%s)\n", mimeSubtype);
@ -1358,6 +1367,9 @@ parseEmailBody(message *messageIn, blob **blobsIn, int nBlobs, text *textIn, con
if(aText && (textIn == NULL))
textDestroy(aText);
if(messages)
free(messages);
return rc;
case MESSAGE:
@ -1404,6 +1416,8 @@ parseEmailBody(message *messageIn, blob **blobsIn, int nBlobs, text *textIn, con
if(mainMessage && (mainMessage != messageIn))
messageDestroy(mainMessage);
if(messages)
free(messages);
return 0;
case APPLICATION:
@ -1598,6 +1612,9 @@ parseEmailBody(message *messageIn, blob **blobsIn, int nBlobs, text *textIn, con
if(mainMessage && (mainMessage != messageIn))
messageDestroy(mainMessage);
if(messages)
free(messages);
cli_dbgmsg("parseEmailBody() returning %d\n", rc);
return rc;

@ -25,8 +25,6 @@ typedef enum {
NOENCODING, QUOTEDPRINTABLE, BASE64, EIGHTBIT, BINARY, UUENCODE, EEXTENSION
} encoding_type;
#define MAXALTERNATIVE 5 /* The maximum number of alternatives allowed in a message */
/* tk: shut up manager.c warning */
#include <clamav.h>

Loading…
Cancel
Save