From: Andrew Lewis Date: Mon, 12 Jun 2017 12:53:36 +0000 (+0200) Subject: [Minor] Milter headers: fix extended_spam_headers X-Git-Tag: 1.6.0~4 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=36e8aaf4c8221a4760a72e3b86e7edee7a8595eb;p=rspamd.git [Minor] Milter headers: fix extended_spam_headers --- 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')