From: Vsevolod Stakhov Date: Mon, 2 Dec 2019 13:35:15 +0000 (+0000) Subject: [Minor] Fix errors handling X-Git-Tag: 2.3~266 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=590b8ae34ecf00467feb698c1bdfc85ccb7de878;p=thirdparty%2Frspamd.git [Minor] Fix errors handling --- diff --git a/src/lua/lua_spf.c b/src/lua/lua_spf.c index cf88bc838a..e6dc579d68 100644 --- a/src/lua/lua_spf.c +++ b/src/lua/lua_spf.c @@ -212,9 +212,16 @@ lua_spf_resolve (lua_State * L) REF_INIT_RETAIN (cbd, lua_spf_dtor); if (!rspamd_spf_resolve (task, spf_lua_lib_callback, cbd, spf_cred)) { - msg_info_task ("cannot make spf request for %s", spf_cred->domain); - lua_spf_push_result (cbd, RSPAMD_SPF_RESOLVED_TEMP_FAILED, - NULL, "DNS failed"); + msg_info_task ("cannot make spf request for %s", + spf_cred ? spf_cred->domain : "empty domain"); + if (spf_cred) { + lua_spf_push_result (cbd, RSPAMD_SPF_RESOLVED_TEMP_FAILED, + NULL, "DNS failed"); + } + else { + lua_spf_push_result (cbd, RSPAMD_SPF_RESOLVED_NA, + NULL, "No domain"); + } REF_RELEASE (cbd); } } diff --git a/src/plugins/lua/spf.lua b/src/plugins/lua/spf.lua index ce7296c688..26a47fdd8f 100644 --- a/src/plugins/lua/spf.lua +++ b/src/plugins/lua/spf.lua @@ -76,9 +76,9 @@ end local function spf_check_callback(task) local function flag_to_symbol(fl) if bit.band(fl, rspamd_spf.flags.temp_fail) ~= 0 then - return local_config.symbols.temp_fail + return local_config.symbols.dnsfail elseif bit.band(fl, rspamd_spf.flags.perm_fail) ~= 0 then - return local_config.symbols.perm_fail + return local_config.symbols.permfail elseif bit.band(fl, rspamd_spf.flags.na) ~= 0 then return local_config.symbols.na end diff --git a/test/functional/configs/dmarc.conf b/test/functional/configs/dmarc.conf index ddfc1ac616..0d931b7d3e 100644 --- a/test/functional/configs/dmarc.conf +++ b/test/functional/configs/dmarc.conf @@ -1 +1,2 @@ dmarc { } +spf { }