From 8bf89488bff9f5ab97dc519c22bdbd5cad2f8ed4 Mon Sep 17 00:00:00 2001 From: SJ Date: Mon, 2 Nov 2015 15:14:52 +0100 Subject: [PATCH] internal date fix --- src/config.h | 2 +- src/defs.h | 3 +-- src/parser.h | 2 +- src/parser_utils.c | 4 ++-- src/rules.c | 8 ++++---- src/rules.h | 2 +- src/test.c | 2 +- 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/config.h b/src/config.h index 674b1d60..6797e5bd 100644 --- a/src/config.h +++ b/src/config.h @@ -14,7 +14,7 @@ #define VERSION "1.2.0-master" -#define BUILD 923 +#define BUILD 924 #define HOSTID "mailarchiver" diff --git a/src/defs.h b/src/defs.h index e4392a35..62d20209 100644 --- a/src/defs.h +++ b/src/defs.h @@ -226,8 +226,7 @@ struct session_data { float __acquire, __parsed, __av, __store, __compress, __encrypt; char bodydigest[2*DIGEST_LENGTH+1]; char digest[2*DIGEST_LENGTH+1]; - time_t now, sent, delivered; - unsigned long retained; + time_t now, sent, delivered, retained; char ms_journal; char import; int journal_envelope_length, journal_bottom_length; diff --git a/src/parser.h b/src/parser.h index 436631e0..4e308a69 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, struct __config *cfg); +time_t parse_date_header(char *s, struct __config *cfg); int isHexNumber(char *p); int extract_boundary(char *p, struct _state *state); void fixupEncodedHeaderLine(char *buf, int buflen); diff --git a/src/parser_utils.c b/src/parser_utils.c index cd00a625..d5504b69 100644 --- a/src/parser_utils.c +++ b/src/parser_utils.c @@ -112,10 +112,10 @@ long get_local_timezone_offset(){ } -unsigned long parse_date_header(char *datestr, struct __config *cfg){ +time_t parse_date_header(char *datestr, struct __config *cfg){ int n=0, len; long offset=0; - unsigned long ts=0; + time_t ts=0; char *p, *q, *r, *tz, s[SMALLBUFSIZE], tzh[4], tzm[3]; struct tm tm; diff --git a/src/rules.c b/src/rules.c index e6607e31..170736aa 100644 --- a/src/rules.c +++ b/src/rules.c @@ -249,7 +249,7 @@ char *check_againt_ruleset(struct node *xhash[], struct _state *state, int size, } -unsigned long query_retain_period(struct __data *data, struct _state *state, int size, int spam, struct __config *cfg){ +time_t query_retain_period(struct __data *data, struct _state *state, int size, int spam, struct __config *cfg){ size_t nmatch=0; struct rule *p; struct node *q; @@ -267,7 +267,7 @@ unsigned long query_retain_period(struct __data *data, struct _state *state, int if(p->domainlen > 2){ if(strcasestr(state->b_to_domain, p->domain) || strcasestr(state->b_from_domain, p->domain)){ state->retention = p->days; - return p->days * 86400; + return (time_t)p->days * (time_t)86400; } } else { @@ -301,7 +301,7 @@ unsigned long query_retain_period(struct __data *data, struct _state *state, int if(ismatch > 0){ state->retention = p->days; - return p->days * 86400; + return (time_t)p->days * (time_t)86400; } } @@ -313,7 +313,7 @@ unsigned long query_retain_period(struct __data *data, struct _state *state, int state->retention = cfg->default_retention_days; - return cfg->default_retention_days * 86400; + return (time_t)cfg->default_retention_days * (time_t)86400; } diff --git a/src/rules.h b/src/rules.h index 03783354..26d54f5b 100644 --- a/src/rules.h +++ b/src/rules.h @@ -11,7 +11,7 @@ void load_rules(struct session_data *sdata, struct __data *data, struct node *xh int append_rule(struct node *xhash[], struct rule_cond *rule_cond, struct __data *data); struct rule *create_rule_item(struct rule_cond *rule_cond, struct __data *data); char *check_againt_ruleset(struct node *xhash[], struct _state *state, int size, int spam); -unsigned long query_retain_period(struct __data *data, struct _state *state, int size, int spam, struct __config *cfg); +time_t query_retain_period(struct __data *data, struct _state *state, int size, int spam, struct __config *cfg); int get_folder_id_by_rule(struct __data *data, struct _state *state, int size, int spam, struct __config *cfg); int check_size_rule(int message_size, int size, char *_size); int check_spam_rule(int is_spam, int spam); diff --git a/src/test.c b/src/test.c index 67a2d5af..0d89f237 100644 --- a/src/test.c +++ b/src/test.c @@ -96,7 +96,7 @@ int main(int argc, char **argv){ printf("subject: *%s*\n", state.b_subject); printf("body: *%s*\n", state.b_body); - printf("sent: %ld, delivered-date: %ld\n", sdata.sent, sdata.delivered); + printf("sent: %lu, delivered-date: %lu\n", sdata.sent, sdata.delivered); make_digests(&sdata, &cfg);