commit 590b8ae: [Minor] Fix errors handling
Vsevolod Stakhov
vsevolod at highsecure.ru
Mon Dec 2 17:07:10 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-12-02 13:35:15 +0000
URL: https://github.com/rspamd/rspamd/commit/590b8ae34ecf00467feb698c1bdfc85ccb7de878
[Minor] Fix errors handling
---
src/lua/lua_spf.c | 13 ++++++++++---
src/plugins/lua/spf.lua | 4 ++--
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 { }
More information about the Commits
mailing list