From 03b30ebdc2bff1a6f0d3a6421ef11a2f7173edc6 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 25 Apr 2017 10:43:07 +0100 Subject: [PATCH] [Fix] Fix setting of email address --- rules/misc.lua | 4 ++-- src/lua/lua_task.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/rules/misc.lua b/rules/misc.lua index 20505828b..ccc52d887 100644 --- a/rules/misc.lua +++ b/rules/misc.lua @@ -415,8 +415,8 @@ local aliases_id = rspamd_config:register_symbol{ addr.addr = string.format('%s@', addr.user) end - if addr.name then - addr.raw = string.format('%s <%s>', addr.name, addr.addr) + if addr.name and #addr.name > 0 then + addr.raw = string.format('"%s" <%s>', addr.name, addr.addr) else addr.raw = string.format('<%s>', addr.addr) end diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index 2ed2419e2..9edfd39d4 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -2076,7 +2076,7 @@ lua_import_email_address (lua_State *L, struct rspamd_task *task, p = lua_tolstring (L, -1, &len); addr->name = (const gchar *)rspamd_mempool_alloc (task->task_pool, len); memcpy ((gchar *)addr->name, p, len); - addr->addr_len = len; + addr->name_len = len; } lua_pop (L, 1); @@ -2152,6 +2152,7 @@ lua_import_email_address (lua_State *L, struct rspamd_task *task, } lua_pop (L, 1); + addr->flags = RSPAMD_EMAIL_ADDR_VALID; *paddr = addr; -- 2.39.5