diff --git a/src/attachment.c b/src/attachment.c index 43693439..3b334e5d 100644 --- a/src/attachment.c +++ b/src/attachment.c @@ -37,7 +37,7 @@ int store_attachments(struct session_data *sdata, struct _state *state, struct _ found = 0; id = 0; - if(strlen(state->attachments[i].filename) > 4 && state->attachments[i].size > 10){ + if(state->attachments[i].size > 0){ snprintf(s, sizeof(s)-1, "SELECT `id` FROM `%s` WHERE `sig`='%s'", SQL_ATTACHMENT_TABLE, state->attachments[i].digest); diff --git a/src/config.h b/src/config.h index 96324abf..24277b08 100644 --- a/src/config.h +++ b/src/config.h @@ -13,7 +13,7 @@ #define VERSION "0.1.22" -#define BUILD 723 +#define BUILD 724 #define HOSTID "mailarchiver" diff --git a/src/parser.c b/src/parser.c index 4e70336a..c908bd86 100644 --- a/src/parser.c +++ b/src/parser.c @@ -155,6 +155,26 @@ void post_parse(struct session_data *sdata, struct _state *state, struct __confi } +void storno_attachment(struct _state *state){ + state->has_to_dump = 0; + + if(state->n_attachments <= 0) return; + + state->attachments[state->n_attachments].size = 0; + state->attachments[state->n_attachments].dumped = 0; + + memset(state->attachments[state->n_attachments].type, 0, TINYBUFSIZE); + memset(state->attachments[state->n_attachments].shorttype, 0, TINYBUFSIZE); + memset(state->attachments[state->n_attachments].aname, 0, TINYBUFSIZE); + memset(state->attachments[state->n_attachments].filename, 0, TINYBUFSIZE); + memset(state->attachments[state->n_attachments].internalname, 0, TINYBUFSIZE); + memset(state->attachments[state->n_attachments].digest, 0, 2*DIGEST_LENGTH+1); + + + state->n_attachments--; +} + + int parse_line(char *buf, struct _state *state, struct session_data *sdata, int take_into_pieces, char *writebuffer, int writebuffersize, char *abuffer, int abuffersize, struct __config *cfg){ char *p, *q, puf[SMALLBUFSIZE]; unsigned char b64buffer[MAXBUFSIZE]; @@ -264,22 +284,8 @@ int parse_line(char *buf, struct _state *state, struct session_data *sdata, int if(state->fd == -1){ - - state->attachments[state->n_attachments].size = 0; - state->attachments[state->n_attachments].dumped = 0; - memset(state->attachments[state->n_attachments].type, 0, TINYBUFSIZE); - memset(state->attachments[state->n_attachments].shorttype, 0, TINYBUFSIZE); - memset(state->attachments[state->n_attachments].aname, 0, TINYBUFSIZE); - memset(state->attachments[state->n_attachments].filename, 0, TINYBUFSIZE); - memset(state->attachments[state->n_attachments].internalname, 0, TINYBUFSIZE); - memset(state->attachments[state->n_attachments].digest, 0, 2*DIGEST_LENGTH+1); - - + storno_attachment(state); syslog(LOG_PRIORITY, "%s: error opening %s", sdata->ttmpfile, state->attachments[state->n_attachments].internalname); - - state->n_attachments--; - state->has_to_dump = 0; - } else { snprintf(puf, sizeof(puf)-1, "ATTACHMENT_POINTER_%s.a%d_XXX_PILER", sdata->ttmpfile, state->n_attachments);