]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] aliases: correct to_local when no recipients present
authorVsevolod Stakhov <vsevolod@rspamd.com>
Mon, 6 Oct 2025 10:27:43 +0000 (11:27 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Mon, 6 Oct 2025 10:27:43 +0000 (11:27 +0100)
lualib/lua_aliases.lua

index f5a467983ef4e242eaf5fce6bb5fdb4e63a1f4c5..3a98316b9c53a4290b85e846b1210ec6d819724b 100644 (file)
@@ -863,15 +863,14 @@ local function classify_message(task, opts)
   local rcpts_smtp = task:get_recipients('smtp')
   if rcpts_smtp then
     local any_local = false
-    local all_local = true
+    local rcpt_count = 0
 
     for _, rcpt in ipairs(rcpts_smtp) do
+      rcpt_count = rcpt_count + 1
       -- Check if recipient is local
       local rcpt_is_local = is_local_address(rcpt)
       if rcpt_is_local then
         any_local = true
-      else
-        all_local = false
       end
 
       -- Resolve recipient
@@ -896,7 +895,7 @@ local function classify_message(task, opts)
       })
     end
 
-    classification.to_local = any_local or all_local
+    classification.to_local = (rcpt_count > 0) and any_local
   end
 
   -- Determine direction