mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-26 07:00: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;
|
found = 0;
|
||||||
id = 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);
|
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 VERSION "0.1.22"
|
||||||
|
|
||||||
#define BUILD 723
|
#define BUILD 724
|
||||||
|
|
||||||
#define HOSTID "mailarchiver"
|
#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){
|
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];
|
char *p, *q, puf[SMALLBUFSIZE];
|
||||||
unsigned char b64buffer[MAXBUFSIZE];
|
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){
|
if(state->fd == -1){
|
||||||
|
storno_attachment(state);
|
||||||
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);
|
|
||||||
|
|
||||||
|
|
||||||
syslog(LOG_PRIORITY, "%s: error opening %s", sdata->ttmpfile, state->attachments[state->n_attachments].internalname);
|
syslog(LOG_PRIORITY, "%s: error opening %s", sdata->ttmpfile, state->attachments[state->n_attachments].internalname);
|
||||||
|
|
||||||
state->n_attachments--;
|
|
||||||
state->has_to_dump = 0;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
snprintf(puf, sizeof(puf)-1, "ATTACHMENT_POINTER_%s.a%d_XXX_PILER", sdata->ttmpfile, state->n_attachments);
|
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