mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 18:50:12 +01:00
minor attachment handling fix
This commit is contained in:
parent
0d21858c96
commit
8abe4c6d60
@ -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);
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#define VERSION "0.1.22"
|
||||
|
||||
#define BUILD 723
|
||||
#define BUILD 724
|
||||
|
||||
#define HOSTID "mailarchiver"
|
||||
|
||||
|
36
src/parser.c
36
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);
|
||||
|
Loading…
Reference in New Issue
Block a user