summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libutil/util.c2
-rw-r--r--src/lua/lua_task.c2
-rw-r--r--src/ragel/smtp_date.rl10
3 files changed, 7 insertions, 7 deletions
diff --git a/src/libutil/util.c b/src/libutil/util.c
index 0ddbaf9ef..9d87d5c9f 100644
--- a/src/libutil/util.c
+++ b/src/libutil/util.c
@@ -2654,7 +2654,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/lua/lua_task.c b/src/lua/lua_task.c
index 96c03847c..7e6ba5b10 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -2596,7 +2596,7 @@ lua_task_get_date (lua_State *L)
struct rspamd_mime_header *h;
h = g_ptr_array_index (hdrs, 0);
- tt = rspamd_parse_smtp_date (h->raw_value, h->raw_len);
+ tt = rspamd_parse_smtp_date (h->decoded, strlen (h->decoded));
if (!gmt) {
localtime_r (&tt, &t);
diff --git a/src/ragel/smtp_date.rl b/src/ragel/smtp_date.rl
index 23ab3caba..25e1ea3c0 100644
--- a/src/ragel/smtp_date.rl
+++ b/src/ragel/smtp_date.rl
@@ -31,10 +31,10 @@
gulong n;
if (rspamd_strtoul (tmp, p - tmp, &n)) {
if (n < 1000) {
- tm.tm_year = n + 1900;
+ tm.tm_year = n;
}
else {
- tm.tm_year = n;
+ tm.tm_year = n - 1900;
}
}
}
@@ -172,12 +172,12 @@
day_name = "Mon" | "Tue" | "Wed" | "Thu" |
"Fri" | "Sat" | "Sun";
day_of_week = FWS? day_name;
- day = FWS? digit{1,2} FWS;
+ day = FWS? digit{1,2} >Day_Start %Day_End FWS;
month = "Jan" %Month_Jan | "Feb" %Month_Feb | "Mar" %Month_Mar | "Apr" %Month_Apr |
"May" %Month_May | "Jun" %Month_Jun | "Jul" %Month_Jul | "Aug" %Month_Aug |
"Sep" %Month_Sep | "Oct" %Month_Oct | "Nov" %Month_Nov | "Dec" %Month_Dec;
- year = FWS digit{2,} FWS;
- date = day >Day_Start %Day_End month %Month_End year >Year_Start %Year_End;
+ year = FWS digit{2,4} >Year_Start %Year_End FWS;
+ date = day month %Month_End year;
hour = digit_2;
minute = digit_2;
second = digit_2;