aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2017-10-30 16:28:18 +0200
committerAndrew Lewis <nerf@judo.za.org>2017-10-30 16:29:40 +0200
commitb66b4693c26c1177e055c3a7d27f12e45e71e666 (patch)
tree9f53c95d1c23b902005b17bd9c1c1c6b10d84cca /src
parent3e155850244b8c7a93fca5ba1052547e3f7d3ccf (diff)
downloadrspamd-b66b4693c26c1177e055c3a7d27f12e45e71e666.tar.gz
rspamd-b66b4693c26c1177e055c3a7d27f12e45e71e666.zip
[Minor] Multimap: support matching Received header flags
Diffstat (limited to 'src')
-rw-r--r--src/plugins/lua/multimap.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua
index edfe4c7f6..6b27f5ff8 100644
--- a/src/plugins/lua/multimap.lua
+++ b/src/plugins/lua/multimap.lua
@@ -612,6 +612,21 @@ local function multimap_callback(task, rule)
end
end
end
+ local match_flags = r['flags']
+ local nmatch_flags = r['nflags']
+ if match_flags or nmatch_flags then
+ local got_flags = h['flags']
+ if match_flags then
+ for _, flag in ipairs(match_flags) do
+ if not got_flags[flag] then return end
+ end
+ end
+ if nmatch_flags then
+ for _, flag in ipairs(nmatch_flags) do
+ if got_flags[flag] then return end
+ end
+ end
+ end
if filter == 'real_ip' or filter == 'from_ip' then
if type(v) == 'string' then
v = rspamd_ip.from_string(v)
@@ -883,6 +898,16 @@ local function add_multimap_rule(key, newrule)
newrule['map'])
end
elseif newrule['type'] == 'received' then
+ if type(newrule['flags']) == 'table' and newrule['flags'][1] then
+ newrule['flags'] = newrule['flags']
+ elseif type(newrule['flags']) == 'string' then
+ newrule['flags'] = {newrule['flags']}
+ end
+ if type(newrule['nflags']) == 'table' and newrule['nflags'][1] then
+ newrule['nflags'] = newrule['nflags']
+ elseif type(newrule['nflags']) == 'string' then
+ newrule['nflags'] = {newrule['nflags']}
+ end
local filter = newrule['filter'] or 'real_ip'
if filter == 'real_ip' or filter == 'from_ip' then
newrule['radix'] = rspamd_config:add_map ({