From 4cd5cfe03ca6b315ea35a89df9f32b12d37fe694 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 15 Jun 2016 17:42:56 +0100 Subject: [PATCH] [Feature] Add ESMTPSA received type --- src/libmime/message.h | 1 + src/lua/lua_task.c | 5 ++++- src/ragel/smtp_received.rl | 1 + src/ragel/smtp_received_parser.rl | 3 +++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/libmime/message.h b/src/libmime/message.h index cacb4287b..619154c6b 100644 --- a/src/libmime/message.h +++ b/src/libmime/message.h @@ -61,6 +61,7 @@ enum rspamd_received_type { RSPAMD_RECEIVED_ESMTP, RSPAMD_RECEIVED_ESMTPA, RSPAMD_RECEIVED_ESMTPS, + RSPAMD_RECEIVED_ESMTPSA, RSPAMD_RECEIVED_LMTP, RSPAMD_RECEIVED_IMAP, RSPAMD_RECEIVED_UNKNOWN diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index 38402039b..15b0ae0b7 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -1439,7 +1439,7 @@ lua_task_get_received_headers (lua_State * L) if (G_UNLIKELY (rh->from_ip == NULL && rh->real_ip == NULL && rh->real_hostname == NULL && - rh->by_hostname == NULL)) { + rh->by_hostname == NULL && rh->timestamp == 0)) { continue; } @@ -1465,6 +1465,9 @@ lua_task_get_received_headers (lua_State * L) case RSPAMD_RECEIVED_ESMTPA: proto = "esmtpa"; break; + case RSPAMD_RECEIVED_ESMTPSA: + proto = "esmtpsa"; + break; case RSPAMD_RECEIVED_LMTP: proto = "lmtp"; break; diff --git a/src/ragel/smtp_received.rl b/src/ragel/smtp_received.rl index dd2212de3..e005dcc9c 100644 --- a/src/ragel/smtp_received.rl +++ b/src/ragel/smtp_received.rl @@ -15,6 +15,7 @@ "SMTP" %SMTP_proto | "ESMTPS" %ESMTPS_proto | "ESMTPA" %ESMTPA_proto | + "ESMTPSA" %ESMTPSA_proto | "LMTP" %LMTP_proto | "IMAP" %IMAP_proto | Attdl_Protocol; diff --git a/src/ragel/smtp_received_parser.rl b/src/ragel/smtp_received_parser.rl index bfd32eaaa..b2c73cab3 100644 --- a/src/ragel/smtp_received_parser.rl +++ b/src/ragel/smtp_received_parser.rl @@ -226,6 +226,9 @@ action ESMTP_proto { rh->type = RSPAMD_RECEIVED_ESMTP; } + action ESMTPSA_proto { + rh->type = RSPAMD_RECEIVED_ESMTPSA; + } action LMTP_proto { rh->type = RSPAMD_RECEIVED_LMTP; } -- 2.39.5