diff --git a/src/defs.h b/src/defs.h index 27efbe8..75911f5 100644 --- a/src/defs.h +++ b/src/defs.h @@ -36,8 +36,7 @@ #define MSG_MESSAGE_ID 9 #define MSG_REFERENCES 10 #define MSG_RECIPIENT 11 -#define MSG_ENVELOPE_FROM 12 -#define MSG_ENVELOPE_TO 13 +#define MSG_ENVELOPE_TO 12 #define MAXHASH 277 diff --git a/src/parser.c b/src/parser.c index 0a78975..45f645e 100644 --- a/src/parser.c +++ b/src/parser.c @@ -185,7 +185,6 @@ if(take_into_pieces == 1){ if(state->message_state == MSG_BODY && state->fd != -1 && is_substr_in_hash(state->boundaries, buf) == 0){ - //n = write(state->fd, buf, len); // WRITE if(len + state->abufpos > abuffersize-1){ if(write(state->fd, abuffer, state->abufpos) == -1) syslog(LOG_PRIORITY, "ERROR: write(), %s, %d, %s", __func__, __LINE__, __FILE__); @@ -206,11 +205,8 @@ state->attachments[state->n_attachments].size += len; } - // There's a dummy separator header at the end of the envelope header lines, - // otherwise the first line of the real header would be lost - else if(cfg->process_rcpt_to_addresses == 0 || (state->message_state != MSG_ENVELOPE_TO && strncasecmp(buf, "X-Piler-Envelope-", strlen("X-Piler-Envelope-")))){ + else { state->saved_size += len; - //n = write(state->mfd, buf, len); // WRITE if(len + state->writebufpos > writebuffersize-1){ if(write(state->mfd, writebuffer, state->writebufpos) == -1) syslog(LOG_PRIORITY, "ERROR: write(), %s, %d, %s", __func__, __LINE__, __FILE__); state->writebufpos = 0; @@ -222,8 +218,6 @@ if(state->message_state == MSG_BODY && state->has_to_dump == 1 && state->pushed_pointer == 0){ - //printf("####name: %s, type: %s, base64: %d\n", state->filename, state->type, state->base64); - state->pushed_pointer = 1; @@ -236,8 +230,6 @@ snprintf(state->attachments[state->n_attachments].internalname, TINYBUFSIZE-1, "%s.a%d", sdata->ttmpfile, state->n_attachments); snprintf(state->attachments[state->n_attachments].aname, TINYBUFSIZE-1, "%s.a%d.bin", sdata->ttmpfile, state->n_attachments); - //printf("DUMP FILE: %s\n", state->attachments[state->n_attachments].internalname); - if(take_into_pieces == 1){ state->fd = open(state->attachments[state->n_attachments].internalname, O_CREAT|O_RDWR, S_IRUSR|S_IWUSR); @@ -260,7 +252,6 @@ } else { snprintf(puf, sizeof(puf)-1, "ATTACHMENT_POINTER_%s.a%d_XXX_PILER", sdata->ttmpfile, state->n_attachments); - //n = write(state->mfd, puf, strlen(puf)); // WRITE writelen = strlen(puf); if(writelen + state->writebufpos > writebuffersize-1){ if(write(state->mfd, writebuffer, state->writebufpos) == -1) syslog(LOG_PRIORITY, "ERROR: write(), %s, %d, %s", __func__, __LINE__, __FILE__); @@ -317,11 +308,7 @@ sdata->spam_message = 1; } - if(strncasecmp(buf, "X-Piler-Envelope-From:", strlen("X-Piler-Envelope-From:")) == 0){ - state->message_state = MSG_ENVELOPE_FROM; - buf += strlen("X-Piler-Envelope-From:"); - } - else if(strncasecmp(buf, "X-Piler-Envelope-To:", strlen("X-Piler-Envelope-To:")) == 0){ + if(strncasecmp(buf, "X-Piler-Envelope-To:", strlen("X-Piler-Envelope-To:")) == 0){ state->message_state = MSG_ENVELOPE_TO; buf += strlen("X-Piler-Envelope-To:"); } @@ -605,7 +592,7 @@ /* skip irrelevant headers */ - if(state->is_header == 1 && state->message_state != MSG_FROM && state->message_state != MSG_TO && state->message_state != MSG_CC && state->message_state != MSG_RECIPIENT && state->message_state != MSG_ENVELOPE_FROM && state->message_state != MSG_ENVELOPE_TO) return 0; + if(state->is_header == 1 && state->message_state != MSG_FROM && state->message_state != MSG_TO && state->message_state != MSG_CC && state->message_state != MSG_RECIPIENT && state->message_state != MSG_ENVELOPE_TO) return 0; /* don't process body if it's not a text or html part */ diff --git a/src/session.c b/src/session.c index b82d265..cdd04f1 100644 --- a/src/session.c +++ b/src/session.c @@ -237,16 +237,8 @@ if(session->fd == -1) return; - snprintf(s, sizeof(s)-1, "X-Piler-Envelope-From: %s\n", session->mailfrom); - if(write(session->fd, s, strlen(s)) == -1) syslog(LOG_PRIORITY, "ERROR: %s: cannot write envelope from address", session->ttmpfile); - for(i=0; inum_of_rcpt_to; i++){ - if(i == 0) snprintf(s, sizeof(s)-1, "X-Piler-Envelope-To: %s\n", session->rcptto[i]); - else snprintf(s, sizeof(s)-1, " %s\n", session->rcptto[i]); - + snprintf(s, sizeof(s)-1, "X-Piler-Envelope-To: %s\n", session->rcptto[i]); if(write(session->fd, s, strlen(s)) == -1) syslog(LOG_PRIORITY, "ERROR: %s: cannot write envelope to address", session->ttmpfile); } - - // Add a separator header line - if(write(session->fd, "X-Piler-Separator: dummy\n", strlen("X-Piler-Separator: dummy\n")) == -1) syslog(LOG_PRIORITY, "ERROR: %s: cannot write dummy separator header line", session->ttmpfile); }