From c78d2280ebaf432a70140dcad80a1c8ee5214076 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 8 Dec 2025 10:22:12 +0000 Subject: [PATCH] [Fix] Fix hierarchical domain matching in remove_ar_from map lookups --- src/plugins/lua/milter_headers.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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 -- 2.47.3