From: Vsevolod Stakhov Date: Sat, 20 Aug 2016 15:39:34 +0000 (+0100) Subject: [Feature] Show the exact value matched for multima symbols X-Git-Tag: 1.3.4~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1238bf915ec6b35225181e32649065784b36bb6c;p=thirdparty%2Frspamd.git [Feature] Show the exact value matched for multima symbols --- diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua index 99576a511c..d913f7619f 100644 --- a/src/plugins/lua/multimap.lua +++ b/src/plugins/lua/multimap.lua @@ -28,6 +28,48 @@ require "fun" () local urls = {} +local value_types = { + ip = { + get_value = function(ip) return ip:to_string() end, + }, + from = { + get_value = function(val) return val end, + }, + header = { + get_value = function(val) return val end, + }, + rcpt = { + get_value = function(val) return val end, + }, + user = { + get_value = function(val) return val end, + }, + url = { + get_value = function(url) return url:get_tld() end, + }, + dnsbl = { + get_value = function(ip) return ip:to_string() end, + }, + filename = { + get_value = function(val) return val end, + }, + content = { + get_value = function(val) return nil end, + }, + hostname = { + get_value = function(val) return val end, + }, + asn = { + get_value = function(val) return val end, + }, + country = { + get_value = function(val) return val end, + }, + mempool = { + get_value = function(val) return val end, + }, +} + local function ip_to_rbl(ip, rbl) return table.concat(ip:inversed_str_octets(), ".") .. '.' .. rbl end @@ -386,7 +428,13 @@ local function multimap_callback(task, rule) else symbol = r['symbol'] end - task:insert_result(symbol, score) + + local opt = value_types[r['type']].get_value(value) + if opt then + task:insert_result(symbol, score, opt) + else + task:insert_result(symbol, score) + end if pre_filter then task:set_pre_result(r['action'], 'Matched map: ' .. r['symbol'])