diff options
author | Andrew Lewis <nerf@judo.za.org> | 2017-06-19 17:02:13 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2017-06-19 17:02:13 +0200 |
commit | 9e3e6a789caa56a7d2286f1fa75b154d56ecacae (patch) | |
tree | 1b311e53911c9100a1bb6e5ac279008b6205de3d | |
parent | 011de521fb453cc3621ea673a6b758624d7511cb (diff) | |
download | rspamd-9e3e6a789caa56a7d2286f1fa75b154d56ecacae.tar.gz rspamd-9e3e6a789caa56a7d2286f1fa75b154d56ecacae.zip |
[Feature] Multimap: received filters for extracting TLDs from hostnames
-rw-r--r-- | src/plugins/lua/multimap.lua | 8 |
1 files changed, 8 insertions, 0 deletions
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 |