diff options
author | Andrew Lewis <nerf@judo.za.org> | 2017-07-20 13:26:10 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2017-07-20 13:26:10 +0200 |
commit | a55442e29e20b52ad4f6148c45664005898feaa7 (patch) | |
tree | 7190b9c12138a02ddb92050a37596135ff8a243e | |
parent | 43e6c87d4fd16d3662949278e427b7d8723a4f4f (diff) | |
download | rspamd-a55442e29e20b52ad4f6148c45664005898feaa7.tar.gz rspamd-a55442e29e20b52ad4f6148c45664005898feaa7.zip |
[Feature] Multimap: checking of symbol options
-rw-r--r-- | src/plugins/lua/multimap.lua | 16 |
1 files changed, 16 insertions, 0 deletions
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 = {} |