aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-06-14 18:07:27 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-06-14 18:07:27 +0100
commitfd70a499d4364d622ab47092703f3bfaa72a149f (patch)
tree3d578144b5402115e8b454382dda4c5e618f7034 /src/lua
parenta838cf4f8141baaab3b23877a41435a80f7804b3 (diff)
downloadrspamd-fd70a499d4364d622ab47092703f3bfaa72a149f.tar.gz
rspamd-fd70a499d4364d622ab47092703f3bfaa72a149f.zip
[Feature] Use new received parser instead of old one
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/lua_task.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index 7a756679b..cbcaf2ed5 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -1427,6 +1427,7 @@ lua_task_get_received_headers (lua_State * L)
{
struct rspamd_task *task = lua_check_task (L, 1);
struct received_header *rh;
+ const gchar *proto;
guint i, k = 1;
if (task) {
@@ -1445,12 +1446,35 @@ lua_task_get_received_headers (lua_State * L)
lua_newtable (L);
rspamd_lua_table_set (L, "from_hostname", rh->from_hostname);
- lua_pushstring (L, "from_ip");
- rspamd_lua_ip_push_fromstring (L, rh->from_ip);
- lua_settable (L, -3);
+ rspamd_lua_table_set (L, "from_ip", rh->from_ip);
rspamd_lua_table_set (L, "real_hostname", rh->real_hostname);
lua_pushstring (L, "real_ip");
- rspamd_lua_ip_push_fromstring (L, rh->real_ip);
+ rspamd_lua_ip_push (L, rh->addr);
+ lua_settable (L, -3);
+ lua_pushstring (L, "proto");
+
+ switch (rh->type) {
+ case RSPAMD_RECEIVED_SMTP:
+ proto = "smtp";
+ break;
+ case RSPAMD_RECEIVED_ESMTP:
+ proto = "esmtp";
+ break;
+ case RSPAMD_RECEIVED_ESMTPS:
+ proto = "esmtps";
+ break;
+ case RSPAMD_RECEIVED_LMTP:
+ proto = "lmtp";
+ break;
+ case RSPAMD_RECEIVED_IMAP:
+ proto = "imap";
+ break;
+ case RSPAMD_RECEIVED_UNKNOWN:
+ default:
+ proto = "unknown";
+ break;
+ }
+ lua_pushstring (L, proto);
lua_settable (L, -3);
rspamd_lua_table_set (L, "by_hostname", rh->by_hostname);
lua_rawseti (L, -2, k ++);