aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2017-09-28 16:36:01 +0200
committerAndrew Lewis <nerf@judo.za.org>2017-09-28 16:36:01 +0200
commit2f3be59570f855bc786a6524f5b08c0761cd4221 (patch)
treebe38e006f9f92fe08d51b174d9f87f24f066f714 /src/plugins
parentc9b7fa1d24f8b9f1168ecca2b8cf4f1214e16345 (diff)
downloadrspamd-2f3be59570f855bc786a6524f5b08c0761cd4221.tar.gz
rspamd-2f3be59570f855bc786a6524f5b08c0761cd4221.zip
[Fix] Milter headers: X-Spamd-Result header if X-Virus ran first
- Fixes: #1851 - Reported by: @iflyhigh - MFH: rspamd-1.6
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/lua/milter_headers.lua32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/plugins/lua/milter_headers.lua b/src/plugins/lua/milter_headers.lua
index 9a0eb23a0..bd2afe22c 100644
--- a/src/plugins/lua/milter_headers.lua
+++ b/src/plugins/lua/milter_headers.lua
@@ -170,7 +170,11 @@ local function milter_headers(task)
if skip_wanted('x-spamd-result') then return end
if not common.symbols then
common.symbols = task:get_symbols_all()
+ end
+ if not common['metric_score'] then
common['metric_score'] = task:get_metric_score('default')
+ end
+ if not common['metric_action'] then
common['metric_action'] = task:get_metric_action('default')
end
if settings.routines['x-spamd-result'].remove then
@@ -293,26 +297,26 @@ local function milter_headers(task)
routines['x-virus'] = function()
if skip_wanted('x-virus') then return end
- if not common.symbols then
- common.symbols = {}
+ if not common.symbols_hash then
+ if not common.symbols then
+ common.symbols = task:get_symbols_all()
+ end
+ local h = {}
+ for _, s in ipairs(common.symbols) do
+ h[s.name] = s
+ end
+ common.symbols_hash = h
end
if settings.routines['x-virus'].remove then
remove[settings.routines['x-virus'].header] = settings.routines['x-virus'].remove
end
local virii = {}
for _, sym in ipairs(settings.routines['x-virus'].symbols) do
- if not (common.symbols[sym] == false) then
- local s = task:get_symbol(sym)
- if not s then
- common.symbols[sym] = false
- else
- common.symbols[sym] = s
- if (((s or E)[1] or E).options or E)[1] then
- table.insert(virii, s[1].options[1])
- else
- table.insert(virii, 'unknown')
- end
- end
+ local s = common.symbols_hash[sym]
+ if ((s or E).options or E)[1] then
+ table.insert(virii, table.concat(s.options, ','))
+ elseif s then
+ table.insert(virii, 'unknown')
end
end
if #virii > 0 then