diff options
author | Andrew Lewis <nerf@judo.za.org> | 2017-06-12 14:53:36 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2017-06-12 14:53:36 +0200 |
commit | 36e8aaf4c8221a4760a72e3b86e7edee7a8595eb (patch) | |
tree | 29f1b0255fa92286d6ad24ce4f2a34bbd456c4e0 /src/plugins/lua/milter_headers.lua | |
parent | 39816ee9345e13bbbd04e63e511238e74c0a286e (diff) | |
download | rspamd-36e8aaf4c8221a4760a72e3b86e7edee7a8595eb.tar.gz rspamd-36e8aaf4c8221a4760a72e3b86e7edee7a8595eb.zip |
[Minor] Milter headers: fix extended_spam_headers
Diffstat (limited to 'src/plugins/lua/milter_headers.lua')
-rw-r--r-- | src/plugins/lua/milter_headers.lua | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/src/plugins/lua/milter_headers.lua b/src/plugins/lua/milter_headers.lua index 163b05501..a4c83cee1 100644 --- a/src/plugins/lua/milter_headers.lua +++ b/src/plugins/lua/milter_headers.lua @@ -341,9 +341,30 @@ end local opts = rspamd_config:get_all_opt(N) or rspamd_config:get_all_opt('rmilter_headers') if not opts then return end +local have_routine = {} +local function activate_routine(s) + if settings.routines[s] or custom_routines[s] then + if not have_routine[s] then + have_routine[s] = true + table.insert(active_routines, s) + if (opts.routines and opts.routines[s]) then + for k, v in pairs(opts.routines[s]) do + settings.routines[s][k] = v + end + end + end + else + logger.errx(rspamd_config, 'routine "%s" does not exist', s) + end +end +if opts['extended_spam_headers'] then + activate_routine('x-spamd-result') + activate_routine('x-rspamd-server') + activate_routine('x-rspamd-queue-id') +end if type(opts['use']) == 'string' then opts['use'] = {opts['use']} -elseif (type(opts['use']) == 'table' and not opts['use'][1]) then +elseif (type(opts['use']) == 'table' and not opts['use'][1] and not next(active_routines)) then logger.debugm(N, rspamd_config, 'no functions are enabled') return end @@ -371,20 +392,6 @@ if type(opts['custom']) == 'table' then end end end -local have_routine = {} -local function activate_routine(s) - if settings.routines[s] or custom_routines[s] then - have_routine[s] = true - table.insert(active_routines, s) - if (opts.routines and opts.routines[s]) then - for k, v in pairs(opts.routines[s]) do - settings.routines[s][k] = v - end - end - else - logger.errx(rspamd_config, 'routine "%s" does not exist', s) - end -end if opts['extended_spam_headers'] then activate_routine('x-spamd-result') activate_routine('x-rspamd-server') |