diff --git a/src/config.h b/src/config.h index b1190ddd..ffa0e269 100644 --- a/src/config.h +++ b/src/config.h @@ -13,7 +13,7 @@ #define VERSION "0.1.23-master-branch" -#define BUILD 769 +#define BUILD 770 #define HOSTID "mailarchiver" diff --git a/src/parser.c b/src/parser.c index 624b3450..beb17ab7 100644 --- a/src/parser.c +++ b/src/parser.c @@ -335,8 +335,8 @@ int parse_line(char *buf, struct _state *state, struct session_data *sdata, int else if(strncasecmp(buf, "References:", 11) == 0) state->message_state = MSG_REFERENCES; else if(strncasecmp(buf, "Subject:", strlen("Subject:")) == 0) state->message_state = MSG_SUBJECT; else if(strncasecmp(buf, "Recipient:", strlen("Recipient:")) == 0) state->message_state = MSG_RECIPIENT; - else if(strncasecmp(buf, "Date:", strlen("Date:")) == 0 && sdata->sent == 0) sdata->sent = parse_date_header(buf); - else if(strncasecmp(buf, "Delivery-date:", strlen("Delivery-date:")) == 0 && sdata->delivered == 0) sdata->delivered = parse_date_header(buf); + else if(strncasecmp(buf, "Date:", strlen("Date:")) == 0 && sdata->sent == 0) sdata->sent = parse_date_header(buf, cfg); + else if(strncasecmp(buf, "Delivery-date:", strlen("Delivery-date:")) == 0 && sdata->delivered == 0) sdata->delivered = parse_date_header(buf, cfg); else if(strncasecmp(buf, "Received:", strlen("Received:")) == 0) state->message_state = MSG_RECEIVED; else if(cfg->extra_to_field[0] != '\0' && strncasecmp(buf, cfg->extra_to_field, strlen(cfg->extra_to_field)) == 0) state->message_state = MSG_TO; diff --git a/src/parser.h b/src/parser.h index 7ebad407..62a30ae3 100644 --- a/src/parser.h +++ b/src/parser.h @@ -14,7 +14,7 @@ void post_parse(struct session_data *sdata, struct _state *state, struct __confi 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 __data *data, struct __config *cfg); void init_state(struct _state *state); -unsigned long parse_date_header(char *s); +unsigned long parse_date_header(char *s, struct __config *cfg); int isHexNumber(char *p); int extract_boundary(char *p, struct _state *state); void fixupEncodedHeaderLine(char *buf); diff --git a/src/parser_utils.c b/src/parser_utils.c index 7b5d730d..b47f7880 100644 --- a/src/parser_utils.c +++ b/src/parser_utils.c @@ -100,7 +100,7 @@ void init_state(struct _state *state){ } -unsigned long parse_date_header(char *datestr){ +unsigned long parse_date_header(char *datestr, struct __config *cfg){ int n=0; char *p, *q, *r, s[SMALLBUFSIZE]; unsigned long ts=0; @@ -173,6 +173,10 @@ unsigned long parse_date_header(char *datestr){ tm.tm_isdst = -1; ts = mktime(&tm); +#ifdef HAVE_TWEAK_SENT_TIME + if(ts > 631148400) ts += cfg->tweak_sent_time_offset; +#endif + return ts; }