]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] dmarc: floor connect timestamp before os.date for PUC Lua
authorVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 2 May 2026 12:39:07 +0000 (13:39 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 2 May 2026 12:39:07 +0000 (13:39 +0100)
task:get_date returns a fractional double; PUC-Rio Lua 5.3+ rejects
non-integer floats as the second argument to os.date with "number has
no integer representation". LuaJIT accepts it, so the bug only fires
on the Fedora CI build.

src/plugins/lua/dmarc.lua

index 64e7a6f15ea8bd86c292a8e86d5d6b9784b9a25f..6c7c1e0cdcfef0eab6c49943b460865421bb0ef7 100644 (file)
@@ -295,8 +295,10 @@ local function dmarc_validate_policy(task, policy, hdrfromdom, dmarc_esld)
       end
 
       -- Prepare and send redis report element
+      -- math.floor is required: task:get_date returns a fractional double and
+      -- PUC-Rio Lua 5.3+ rejects non-integer floats as the second arg to os.date
       local period = os.date('%Y%m%d',
-        task:get_date({ format = 'connect', gmt = false }))
+        math.floor(task:get_date({ format = 'connect', gmt = false })))
 
       -- Dmarc domain key must include dmarc domain, rua and period
       local dmarc_domain_key = table.concat(