aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-07-07 19:38:21 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-07-07 19:38:21 +0100
commit7bf9003fbfdfb07c6634768ec11a700e492c1415 (patch)
treee3dcc632dac309b8187b4fd939f15ec4d1df3f0e
parentf47ed96a0889b957e666854a9d752ab9ec92e0db (diff)
downloadrspamd-7bf9003fbfdfb07c6634768ec11a700e492c1415.tar.gz
rspamd-7bf9003fbfdfb07c6634768ec11a700e492c1415.zip
[Fix] Fix emails module configuration
-rw-r--r--src/plugins/lua/emails.lua50
1 files changed, 23 insertions, 27 deletions
diff --git a/src/plugins/lua/emails.lua b/src/plugins/lua/emails.lua
index cd632b85e..97378924f 100644
--- a/src/plugins/lua/emails.lua
+++ b/src/plugins/lua/emails.lua
@@ -147,36 +147,32 @@ local function gen_check_emails(rule)
end
end
-local opts = rspamd_config:get_all_opt('emails', 'rule')
+local opts = rspamd_config:get_module_opt('emails', 'rules')
if opts and type(opts) == 'table' then
- local r = opts['rule']
-
- if r then
- for k,v in pairs(r) do
- local rule = v
- if not rule['symbol'] then
- rule['symbol'] = k
- end
+ for k,v in pairs(opts) do
+ local rule = v
+ if not rule['symbol'] then
+ rule['symbol'] = k
+ end
- if not rule['delimiter'] then
- rule['delimiter'] = "@"
- end
+ if not rule['delimiter'] then
+ rule['delimiter'] = "@"
+ end
- if rule['map'] then
- rule['name'] = rule['map']
- rule['map'] = rspamd_config:add_map({
- url = rule['name'],
- description = string.format('Emails rule %s', rule['symbol']),
- type = 'regexp'
- })
- end
- if not rule['symbol'] or (not rule['map'] and not rule['dnsbl']) then
- logger.errx(rspamd_config, 'incomplete rule')
- else
- table.insert(rules, rule)
- logger.infox(rspamd_config, 'add emails rule %s',
- rule['dnsbl'] or rule['name'] or '???')
- end
+ if rule['map'] then
+ rule['name'] = rule['map']
+ rule['map'] = rspamd_config:add_map({
+ url = rule['name'],
+ description = string.format('Emails rule %s', rule['symbol']),
+ type = 'regexp'
+ })
+ end
+ if not rule['symbol'] or (not rule['map'] and not rule['dnsbl']) then
+ logger.errx(rspamd_config, 'incomplete rule: %s', rule)
+ else
+ table.insert(rules, rule)
+ logger.infox(rspamd_config, 'add emails rule %s',
+ rule['dnsbl'] or rule['name'] or '???')
end
end
end