aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-09-02 16:54:38 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-09-02 16:54:38 +0100
commit3b02843db83d69c08eacf4010a5abd7fb674b835 (patch)
tree0ac5239f94f4bf84dbddf0e574036d24795030a7 /src
parent4680e7c733f51c8c6f36f63dd9e67f4acadbd127 (diff)
downloadrspamd-3b02843db83d69c08eacf4010a5abd7fb674b835.tar.gz
rspamd-3b02843db83d69c08eacf4010a5abd7fb674b835.zip
[Minor] Rbl: Final fixes to support surbl/emails modules options
Diffstat (limited to 'src')
-rw-r--r--src/plugins/lua/rbl.lua24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua
index ab1ba23e9..f2a53de78 100644
--- a/src/plugins/lua/rbl.lua
+++ b/src/plugins/lua/rbl.lua
@@ -760,7 +760,7 @@ local function gen_rbl_callback(rule)
return callback_f,string.format('checks: %s', table.concat(description, ','))
end
-local function add_rbl(key, rbl)
+local function add_rbl(key, rbl, global_opts)
if not rbl.symbol then
rbl.symbol = key:upper()
end
@@ -822,6 +822,13 @@ local function add_rbl(key, rbl)
'RBL whitelist for ' .. rbl.symbol)
end
+ if not rbl.whitelist and global_opts.url_whitelist and
+ (rbl.urls or rbl.emails or rbl.dkim) then
+ local def_type = 'set'
+ rbl.whitelist = lua_maps.map_add_from_ucl(global_opts.url_whitelist, def_type,
+ 'RBL url whitelist for ' .. rbl.symbol)
+ end
+
local callback,description = gen_rbl_callback(rbl)
if callback then
@@ -848,11 +855,14 @@ local function add_rbl(key, rbl)
}
local function process_return_code(s)
- rspamd_config:register_symbol({
- name = s,
- parent = id,
- type = 'virtual'
- })
+ if s ~= rbl.symbol then
+ -- hack
+ rspamd_config:register_symbol({
+ name = s,
+ parent = id,
+ type = 'virtual'
+ })
+ end
if rbl.is_whitelist then
if rbl.whitelist_exception then
@@ -1010,7 +1020,7 @@ for key,rbl in pairs(opts.rbls or opts.rules) do
rspamd_logger.errx(rspamd_config, 'invalid config for %s: %s, RBL is DISABLED',
key, err)
else
- add_rbl(key, res)
+ add_rbl(key, res, opts)
end
end -- rbl.enabled
end