From: Vsevolod Stakhov Date: Wed, 15 Jun 2016 08:21:03 +0000 (+0100) Subject: [Feature] Parse received timestamp X-Git-Tag: 1.3.0~333 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9aad3e020ba34916fd680fc157923d5d6906e1a2;p=thirdparty%2Frspamd.git [Feature] Parse received timestamp --- diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index bc31640fa1..38402039b2 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -1478,6 +1478,11 @@ lua_task_get_received_headers (lua_State * L) } lua_pushstring (L, proto); lua_settable (L, -3); + + lua_pushstring (L, "timestamp"); + lua_pushnumber (L, rh->timestamp); + lua_settable (L, -3); + rspamd_lua_table_set (L, "by_hostname", rh->by_hostname); lua_rawseti (L, -2, k ++); } diff --git a/src/ragel/smtp_date.rl b/src/ragel/smtp_date.rl index d2efe61a60..da5872439e 100644 --- a/src/ragel/smtp_date.rl +++ b/src/ragel/smtp_date.rl @@ -11,7 +11,7 @@ day_name = "Mon" | "Tue" | "Wed" | "Thu" | "Fri" | "Sat" | "Sun"; day_of_week = FWS? day_name; - day = FWS? digit_2+ FWS; + day = FWS? digit{1,2} FWS; month = "Jan" | "Feb" | "Mar" | "Apr" | "May" | "Jun" | "Jul" | "Aug" | "Sep" | "Oct" | "Nov" | "Dec"; @@ -20,8 +20,8 @@ hour = digit_2; minute = digit_2; second = digit_2; - time_of_day = hour ":" minute ( ":" second ); - zone = (FWS ( "+" |"_" ) digit_4); + time_of_day = hour ":" minute (":" second )?; + zone = FWS ("+" | "-") >Sign_Start %Sign_End digit_4; time = time_of_day zone; - date_time = (day_of_week ",")? date time CFWS?; + date_time = (day_of_week ",")? date time; }%% \ No newline at end of file diff --git a/src/ragel/smtp_received.rl b/src/ragel/smtp_received.rl index 02e850c9bd..8e18258550 100644 --- a/src/ragel/smtp_received.rl +++ b/src/ragel/smtp_received.rl @@ -40,6 +40,6 @@ For = CFWS "FOR"i FWS ( Path | Mailbox ) %For_End; Additional_Registered_Clauses = CFWS Atom FWS String; Opt_info = Via? With? ID? For? Additional_Registered_Clauses?; - Received = From_domain By_domain Opt_info CFWS? ";" FWS date_time >Date_Start %Date_End; + Received = From_domain By_domain Opt_info CFWS? ";" FWS date_time >Date_Start %Date_End CFWS?; }%%