diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-12-02 13:35:15 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-12-02 13:35:15 +0000 |
commit | 590b8ae34ecf00467feb698c1bdfc85ccb7de878 (patch) | |
tree | d7183617db1be5bd7abec5cd6b960edccddb247b | |
parent | b48f15002c715dd76dd3402e75d72acd8ffb3b75 (diff) | |
download | rspamd-590b8ae34ecf00467feb698c1bdfc85ccb7de878.tar.gz rspamd-590b8ae34ecf00467feb698c1bdfc85ccb7de878.zip |
[Minor] Fix errors handling
-rw-r--r-- | src/lua/lua_spf.c | 13 | ||||
-rw-r--r-- | src/plugins/lua/spf.lua | 4 | ||||
-rw-r--r-- | test/functional/configs/dmarc.conf | 1 |
3 files changed, 13 insertions, 5 deletions
diff --git a/src/lua/lua_spf.c b/src/lua/lua_spf.c index cf88bc838..e6dc579d6 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 ce7296c68..26a47fdd8 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 ddfc1ac61..0d931b7d3 100644 --- a/test/functional/configs/dmarc.conf +++ b/test/functional/configs/dmarc.conf @@ -1 +1,2 @@ dmarc { } +spf { } |