]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Fix errors handling
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 2 Dec 2019 13:35:15 +0000 (13:35 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 2 Dec 2019 13:35:15 +0000 (13:35 +0000)
src/lua/lua_spf.c
src/plugins/lua/spf.lua
test/functional/configs/dmarc.conf

index cf88bc838abc98d61e0cf9f7ffb7c5c3dc5fe426..e6dc579d6876758f70bf4ab63151aa7ddc3c6b50 100644 (file)
@@ -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);
                }
        }
index ce7296c6883504d81b2595b711c80d2a4d176373..26a47fdd8f6eb4cc8903ac1536e8717eabdf85fa 100644 (file)
@@ -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
index ddfc1ac6168979679ec9e350b8fbb2da8bf22258..0d931b7d3ec1659d307c1bdd603c0de15bb83532 100644 (file)
@@ -1 +1,2 @@
 dmarc { }
+spf { }