aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2016-08-22 12:24:15 +0200
committerAndrew Lewis <nerf@judo.za.org>2016-08-22 12:24:15 +0200
commit1c1306b1ea02106d7a6eb3e11009e595911a25b3 (patch)
tree7041d6f4bf6d126ac1eedb21fd784179843805ff /src/plugins
parent54c97cf64fe6a22687040d58b18fef791ffb2816 (diff)
downloadrspamd-1c1306b1ea02106d7a6eb3e11009e595911a25b3.tar.gz
rspamd-1c1306b1ea02106d7a6eb3e11009e595911a25b3.zip
[Minor] Fix registration of prefilters in multimap (#878)
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/lua/multimap.lua71
1 files changed, 35 insertions, 36 deletions
diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua
index 10e727ef7..f21bc5b11 100644
--- a/src/plugins/lua/multimap.lua
+++ b/src/plugins/lua/multimap.lua
@@ -786,44 +786,43 @@ if opts and type(opts) == 'table' then
end
end
-- add fake symbol to check all maps inside a single callback
- if any(function(r) return not r['prefilter'] end, rules) then
- for i,rule in ipairs(rules) do
- local id = rspamd_config:register_symbol({
- type = 'normal',
- name = rule['symbol'],
- callback = gen_multimap_callback(rule),
- })
- if rule['symbols'] then
- -- Find allowed symbols by this map
- rule['symbols_set'] = {}
- each(function(s)
- rspamd_config:register_symbol({
- type = 'virtual',
- name = s,
- parent = id
- })
- rule['symbols_set'][s] = 1
- end, rule['symbols'])
- end
- if rule['score'] then
- -- Register metric symbol
- local description = 'multimap symbol'
- local group = 'multimap'
- if rule['description'] then
- description = rule['description']
- end
- if rule['group'] then
- group = rule['group']
- end
- rspamd_config:set_metric_symbol({
- name = rule['symbol'],
- score = rule['score'],
- description = description,
- group = group
+ each(function(rule)
+ local id = rspamd_config:register_symbol({
+ type = 'normal',
+ name = rule['symbol'],
+ callback = gen_multimap_callback(rule),
+ })
+ if rule['symbols'] then
+ -- Find allowed symbols by this map
+ rule['symbols_set'] = {}
+ each(function(s)
+ rspamd_config:register_symbol({
+ type = 'virtual',
+ name = s,
+ parent = id
})
- end
+ rule['symbols_set'][s] = 1
+ end, rule['symbols'])
+ end
+ if rule['score'] then
+ -- Register metric symbol
+ local description = 'multimap symbol'
+ local group = 'multimap'
+ if rule['description'] then
+ description = rule['description']
+ end
+ if rule['group'] then
+ group = rule['group']
+ end
+ rspamd_config:set_metric_symbol({
+ name = rule['symbol'],
+ score = rule['score'],
+ description = description,
+ group = group
+ })
end
- end
+ end,
+ filter(function(r) return not r['prefilter'] end, rules))
each(function(r)
rspamd_config:register_symbol({