]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Fix hierarchical domain matching in remove_ar_from map lookups 5784/head
authorVsevolod Stakhov <vsevolod@rspamd.com>
Mon, 8 Dec 2025 10:22:12 +0000 (10:22 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Mon, 8 Dec 2025 10:22:12 +0000 (10:22 +0000)
src/plugins/lua/milter_headers.lua

index 0894480cfbfc828ee2c72b188a3e4755603ec5ea..52a6093f29261051dc1418397a126c53a8cf41f8 100644 (file)
@@ -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