From: Andrew Lewis Date: Thu, 20 Jul 2017 11:26:10 +0000 (+0200) Subject: [Feature] Multimap: checking of symbol options X-Git-Tag: 1.7.0~826 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a55442e29e20b52ad4f6148c45664005898feaa7;p=rspamd.git [Feature] Multimap: checking of symbol options --- diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua index ca32a8d21..edfe4c7f6 100644 --- a/src/plugins/lua/multimap.lua +++ b/src/plugins/lua/multimap.lua @@ -79,6 +79,9 @@ local value_types = { mempool = { get_value = function(val) return val end, }, + symbol_options = { + get_value = function(val) return val end, + }, } local function ip_to_rbl(ip, rbl) @@ -344,6 +347,7 @@ local multimap_filters = { from = apply_addr_filter, rcpt = apply_addr_filter, helo = apply_hostname_filter, + symbol_options = apply_regexp_filter, header = apply_addr_filter, url = apply_url_filter, filename = apply_filename_filter, @@ -759,6 +763,14 @@ local function multimap_callback(task, rule) match_rule(rule, var) end end, + symbol_options = function() + local sym = task:get_symbol(rule['target_symbol']) + if sym and sym[1].options then + for _, o in ipairs(sym[1].options) do + match_rule(rule, o) + end + end + end, received = function() local hdrs = task:get_received_headers() if hdrs and hdrs[1] then @@ -913,6 +925,7 @@ local function add_multimap_rule(key, newrule) or newrule['type'] == 'rcpt' or newrule['type'] == 'from' or newrule['type'] == 'helo' + or newrule['type'] == 'symbol_options' or newrule['type'] == 'filename' or newrule['type'] == 'url' or newrule['type'] == 'content' @@ -959,6 +972,9 @@ local function add_multimap_rule(key, newrule) end if ret then + if newrule['type'] == 'symbol_options' then + rspamd_config:register_dependency(newrule['symbol'], newrule['target_symbol']) + end if newrule['require_symbols'] and not newrule['prefilter'] then local atoms = {}