commit 61a7090: [Minor] Rbl: Fix flattening defaults

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Feb 16 14:28:06 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-02-16 14:26:23 +0000
URL: https://github.com/rspamd/rspamd/commit/61a70903cc1a37c51fda5a80ee5bd0a1c838a1fe (HEAD -> master)

[Minor] Rbl: Fix flattening defaults

---
 src/plugins/lua/rbl.lua | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua
index 87b97e171..9a2cf9a8b 100644
--- a/src/plugins/lua/rbl.lua
+++ b/src/plugins/lua/rbl.lua
@@ -600,7 +600,7 @@ local function gen_rbl_callback(rule)
     for selector_label, selector in pairs(rule.selectors) do
       local res = selector(task)
 
-      if res then
+      if res and type(res) == 'table' then
         if rule.selector_flatten then
           add_dns_request(task, table.concat(res, ''), false, false,
                   requests_table, selector_label, whitelist)
@@ -610,6 +610,9 @@ local function gen_rbl_callback(rule)
                     selector_label, whitelist)
           end
         end
+      elseif res then
+        add_dns_request(task, res, false, false,
+                requests_table, selector_label, whitelist)
       end
     end
 
@@ -910,6 +913,10 @@ local function add_rbl(key, rbl, global_opts)
         rbl.selectors[selector_label] = known_selectors[selector].selector
       else
 
+        if type(rbl.selector_flatten) ~= 'boolean' then
+          -- Fail-safety
+          rbl.selector_flatten = true
+        end
         local sel = selectors.create_selector_closure(rspamd_config, selector, '',
                 rbl.selector_flatten)
 


More information about the Commits mailing list