From 040394ec692f057126c5ebe03b954c7c8e63117f Mon Sep 17 00:00:00 2001 From: SJ Date: Tue, 2 Oct 2012 15:21:16 +0200 Subject: [PATCH] subject reading fix --- src/config.h | 2 +- src/parser.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/config.h b/src/config.h index 79de044b..b480ee33 100644 --- a/src/config.h +++ b/src/config.h @@ -13,7 +13,7 @@ #define VERSION "0.1.21" -#define BUILD 711 +#define BUILD 712 #define HOSTID "mailarchiver" diff --git a/src/parser.c b/src/parser.c index fe3ca2ff..5f136671 100644 --- a/src/parser.c +++ b/src/parser.c @@ -393,7 +393,10 @@ int parse_line(char *buf, struct _state *state, struct session_data *sdata, int if(state->is_1st_header == 1 && state->message_state == MSG_SUBJECT && strlen(state->b_subject) + strlen(buf) < MAXBUFSIZE-1){ if(state->b_subject[0] == '\0'){ - strncat(state->b_subject, buf+strlen("Subject:"), MAXBUFSIZE-1); + p = &buf[0]; + if(strncmp(buf, "Subject:", strlen("Subject:")) == 0) p += strlen("Subject:"); + + strncat(state->b_subject, p, MAXBUFSIZE-1); } else { @@ -588,7 +591,12 @@ int parse_line(char *buf, struct _state *state, struct session_data *sdata, int if(does_it_seem_like_an_email_address(puf) == 1){ q = strchr(puf, '@'); - if(q) memcpy(&(state->b_from_domain[strlen(state->b_from_domain)]), q+1, len); + if(q){ + memcpy(&(state->b_from_domain[strlen(state->b_from_domain)]), q+1, len); + /*if(strstr(sdata->mailfrom, "<>")){ + + }*/ + } if(is_email_address_on_my_domains(puf, cfg) == 1) sdata->internal_sender = 1;