From: Vsevolod Stakhov Date: Mon, 8 Dec 2025 10:22:12 +0000 (+0000) Subject: [Fix] Fix hierarchical domain matching in remove_ar_from map lookups X-Git-Tag: 3.14.2~5^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c78d2280ebaf432a70140dcad80a1c8ee5214076;p=thirdparty%2Frspamd.git [Fix] Fix hierarchical domain matching in remove_ar_from map lookups --- diff --git a/src/plugins/lua/milter_headers.lua b/src/plugins/lua/milter_headers.lua index 0894480cfb..52a6093f29 100644 --- a/src/plugins/lua/milter_headers.lua +++ b/src/plugins/lua/milter_headers.lua @@ -557,9 +557,13 @@ local function milter_headers(task) if local_mod.remove_ar_from:get_key(ar_hostname) then should_remove = true else - local domain_part = ar_hostname:match('%.(.+)$') - if domain_part and local_mod.remove_ar_from:get_key('.' .. domain_part) then - should_remove = true + for i = 1, #ar_hostname do + if ar_hostname:sub(i, i) == '.' then + if local_mod.remove_ar_from:get_key(ar_hostname:sub(i)) then + should_remove = true + break + end + end end end elseif type(local_mod.remove_ar_from) == 'table' then