From: Andrew Lewis Date: Mon, 19 Jun 2017 15:02:13 +0000 (+0200) Subject: [Feature] Multimap: received filters for extracting TLDs from hostnames X-Git-Tag: 1.6.2~99 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9e3e6a789caa56a7d2286f1fa75b154d56ecacae;p=rspamd.git [Feature] Multimap: received filters for extracting TLDs from hostnames --- diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua index e2bde2a32..0e7da23e1 100644 --- a/src/plugins/lua/multimap.lua +++ b/src/plugins/lua/multimap.lua @@ -551,7 +551,12 @@ local function multimap_callback(task, rule) end local function match_received_header(r, pos, total, h) + local use_tld = false local filter = r['filter'] or 'real_ip' + if filter:match('^tld:') then + filter = filter:sub(5) + use_tld = true + end local v = h[filter] if v then local min_pos = tonumber(r['min_pos']) @@ -590,6 +595,9 @@ local function multimap_callback(task, rule) match_rule(r, v) end else + if use_tld and type(v) == 'string' then + v = util.get_tld(v) + end match_rule(r, v) end end