diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-08-21 21:47:59 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-08-21 21:48:46 +0100 |
commit | d1cab3edeef224d8d2611087d4fa12623e68165d (patch) | |
tree | 282e769d0d12326aed376c1fb498dfd025166aa2 | |
parent | 450d49c880e636c35df96e65339803ede0fc0b2c (diff) | |
download | rspamd-d1cab3edeef224d8d2611087d4fa12623e68165d.tar.gz rspamd-d1cab3edeef224d8d2611087d4fa12623e68165d.zip |
[Fix] Fix storing of the original smtp from
-rw-r--r-- | src/libserver/task.c | 4 | ||||
-rw-r--r-- | src/libserver/task.h | 1 | ||||
-rw-r--r-- | src/lua/lua_task.c | 22 |
3 files changed, 20 insertions, 7 deletions
diff --git a/src/libserver/task.c b/src/libserver/task.c index 12f20f393..53da0dae6 100644 --- a/src/libserver/task.c +++ b/src/libserver/task.c @@ -204,6 +204,10 @@ rspamd_task_free (struct rspamd_task *task) rspamd_email_address_free (task->from_envelope); } + if (task->from_envelope_orig) { + rspamd_email_address_free (task->from_envelope_orig); + } + if (task->meta_words) { g_array_free (task->meta_words, TRUE); } diff --git a/src/libserver/task.h b/src/libserver/task.h index 778b77dbf..aa6d01a2e 100644 --- a/src/libserver/task.h +++ b/src/libserver/task.h @@ -190,6 +190,7 @@ struct rspamd_task { GPtrArray *rcpt_envelope; /**< array of rspamd_email_address */ struct rspamd_email_address *from_envelope; + struct rspamd_email_address *from_envelope_orig; ucl_object_t *messages; /**< list of messages that would be reported */ struct rspamd_re_runtime *re_rt; /**< regexp runtime */ diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index 09479ea21..6fc3768f7 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -3767,7 +3767,18 @@ lua_task_get_from (lua_State *L) /* Create table to preserve compatibility */ if (addr->addr) { lua_createtable (L, 1, 0); - lua_push_email_address (L, addr); + if (what & RSPAMD_ADDRESS_ORIGINAL) { + if (task->from_envelope_orig) { + lua_push_email_address (L, task->from_envelope_orig); + } + else { + lua_push_email_address (L, addr); + } + } + else { + lua_push_email_address (L, addr); + } + lua_rawseti (L, -2, 1); } else { @@ -3851,13 +3862,10 @@ lua_task_set_from (lua_State *L) } } else if (paddr) { + /* SMTP from case */ if (lua_import_email_address (L, task, 3, &addr)) { - - if (paddr) { - rspamd_email_address_free (*paddr); - } - - *paddr = addr; + task->from_envelope_orig = *paddr; + task->from_envelope = addr; lua_pushboolean (L, true); } else { |