From: Andrew Lewis Date: Fri, 23 Dec 2016 10:23:40 +0000 (+0200) Subject: [Fix] Date header timezone adjustments (#1279) X-Git-Tag: 1.5.0~496^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F1281%2Fhead;p=rspamd.git [Fix] Date header timezone adjustments (#1279) --- diff --git a/src/libutil/util.c b/src/libutil/util.c index c33a92180..76325522c 100644 --- a/src/libutil/util.c +++ b/src/libutil/util.c @@ -2648,7 +2648,7 @@ rspamd_tm_to_time (const struct tm *tm, glong tz) result += tm->tm_sec; /* Now apply tz offset */ - result -= offset; + result += offset; return result; } diff --git a/src/ragel/smtp_date.rl b/src/ragel/smtp_date.rl index 25e1ea3c0..6830506cd 100644 --- a/src/ragel/smtp_date.rl +++ b/src/ragel/smtp_date.rl @@ -79,16 +79,16 @@ } } action TZ_Sign { - tmp = p - 1; + tmp = p; } action TZ_Offset_Start { } action TZ_Offset_End { if (p > tmp + 1) { - rspamd_strtoul (tmp + 1, p - tmp - 1, (gulong *)&tz); + rspamd_strtoul (tmp + 1, p - tmp, (gulong *)&tz); - if (*tmp == '-') { + if (*(tmp - 1) == '-') { tz = -(tz); } } @@ -189,6 +189,6 @@ "MST" %TZ_MST | "MDT" %TZ_MDT | "PST" %TZ_PST | "PDT" %TZ_PDT | [a-iA-I] | [k-zK-Z]; - time = time_of_day %DT_End (zone | obs_zone %Obs_Zone_End); + time = time_of_day %DT_End (zone | obs_zone %Obs_Zone_End) FWS*; date_time = (day_of_week ",")? date time; -}%% \ No newline at end of file +}%%