aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/lua_cfg_transform.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-09-12 16:17:10 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-09-12 16:17:10 +0100
commit7ead4cad6e0661bb7cc669a5c436ccf211649a27 (patch)
treecb8beb108ee582cd0d3bb6a9366318717e428eb9 /lualib/lua_cfg_transform.lua
parent394d0dc1b6551862d382f156675d0dd1edf179d5 (diff)
downloadrspamd-7ead4cad6e0661bb7cc669a5c436ccf211649a27.tar.gz
rspamd-7ead4cad6e0661bb7cc669a5c436ccf211649a27.zip
[Fix] Prefer surbl/emails rule on rbl to preserve compatibility
Diffstat (limited to 'lualib/lua_cfg_transform.lua')
-rw-r--r--lualib/lua_cfg_transform.lua118
1 files changed, 59 insertions, 59 deletions
diff --git a/lualib/lua_cfg_transform.lua b/lualib/lua_cfg_transform.lua
index e17ce12ca..6ee83a117 100644
--- a/lualib/lua_cfg_transform.lua
+++ b/lualib/lua_cfg_transform.lua
@@ -238,43 +238,43 @@ local function surbl_section_convert(cfg, section)
local rbl_section = cfg.rbl.rbls
local wl = section.whitelist
for name,value in pairs(section.rules or {}) do
- if not rbl_section[name] then
- local converted = {
- urls = true,
- ignore_defaults = true,
- }
-
- if wl then
- converted.whitelist = wl
- end
+ if rbl_section[name] then
+ logger.warnx(rspamd_config, 'conflicting names in surbl and rbl rules: %s, ignore rbl rule!',
+ name)
+ rbl_section[name] = {}
+ end
+ local converted = {
+ urls = true,
+ ignore_defaults = true,
+ }
- for k,v in pairs(value) do
- -- Rename
- if k == 'suffix' then k = 'rbl' end
- if k == 'ips' then k = 'returncodes' end
- if k == 'bits' then k = 'returnbits' end
- if k:match('check_') then
- local n = k:match('check_(.*)')
- k = n
- end
+ if wl then
+ converted.whitelist = wl
+ end
- if k == 'dkim' and v then
- converted.dkim_domainonly = false
- converted.dkim_match_from = true
- end
+ for k,v in pairs(value) do
+ -- Rename
+ if k == 'suffix' then k = 'rbl' end
+ if k == 'ips' then k = 'returncodes' end
+ if k == 'bits' then k = 'returnbits' end
+ if k:match('check_') then
+ local n = k:match('check_(.*)')
+ k = n
+ end
- if k == 'emails' and v then
- -- To match surbl behaviour
- converted.emails_domainonly = true
- end
+ if k == 'dkim' and v then
+ converted.dkim_domainonly = false
+ converted.dkim_match_from = true
+ end
- converted[k] = lua_util.deepcopy(v)
+ if k == 'emails' and v then
+ -- To match surbl behaviour
+ converted.emails_domainonly = true
end
- rbl_section[name] = converted
- else
- logger.warnx(rspamd_config, 'conflicting names in surbl and rbl rules: %s, ignore surbl rule',
- name)
+
+ converted[k] = lua_util.deepcopy(v)
end
+ rbl_section[name] = converted
end
end
@@ -283,39 +283,39 @@ local function emails_section_convert(cfg, section)
local rbl_section = cfg.rbl.rbls
local wl = section.whitelist
for name,value in pairs(section.rules or {}) do
- if not rbl_section[name] then
- local converted = {
- emails = true,
- ignore_defaults = true,
- }
+ if rbl_section[name] then
+ logger.warnx(rspamd_config, 'conflicting names in emails and rbl rules: %s, ignore rbl rule!',
+ name)
+ rbl_section[name] = {}
+ end
+ local converted = {
+ emails = true,
+ ignore_defaults = true,
+ }
- if wl then
- converted.whitelist = wl
- end
+ if wl then
+ converted.whitelist = wl
+ end
- for k,v in pairs(value) do
- -- Rename
- if k == 'dnsbl' then k = 'rbl' end
- if k == 'check_replyto' then k = 'replyto' end
- if k == 'hashlen' then k = 'hash_len' end
- if k == 'encoding' then k = 'hash_format' end
- if k == 'domain_only' then k = 'emails_domainonly' end
- if k == 'delimiter' then k = 'emails_delimiter' end
- if k == 'skip_body' then
- if v then
- -- Hack
- converted.emails = false
- converted.replyto = true
- end
+ for k,v in pairs(value) do
+ -- Rename
+ if k == 'dnsbl' then k = 'rbl' end
+ if k == 'check_replyto' then k = 'replyto' end
+ if k == 'hashlen' then k = 'hash_len' end
+ if k == 'encoding' then k = 'hash_format' end
+ if k == 'domain_only' then k = 'emails_domainonly' end
+ if k == 'delimiter' then k = 'emails_delimiter' end
+ if k == 'skip_body' then
+ if v then
+ -- Hack
+ converted.emails = false
+ converted.replyto = true
end
-
- converted[k] = lua_util.deepcopy(v)
end
- rbl_section[name] = converted
- else
- logger.warnx(rspamd_config, 'conflicting names in emails and rbl rules: %s, ignore emails rule',
- name)
+
+ converted[k] = lua_util.deepcopy(v)
end
+ rbl_section[name] = converted
end
end