commit 7a71edd: arc.lua: fix usage of ARC-Authentication-Results in arc_sign_seal func

Jan Smutny js at excello.cz
Sat Apr 15 06:56:03 UTC 2023


Author: Jan Smutny
Date: 2023-03-20 09:48:26 +0100
URL: https://github.com/rspamd/rspamd/commit/7a71edd3f5c6b270c900b102bfc54085d443316a

arc.lua: fix usage of ARC-Authentication-Results in arc_sign_seal func
The ARC-Authentication-Results header field was gathered in function arc_sign_seal
directly from headers.
This commit adds the sorted ARC-Authentication-Results header to cache
which is then reused in arc_sign_seal function.

---
 src/plugins/lua/arc.lua | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/plugins/lua/arc.lua b/src/plugins/lua/arc.lua
index 95f2c28b5..33ae3dba2 100644
--- a/src/plugins/lua/arc.lua
+++ b/src/plugins/lua/arc.lua
@@ -253,6 +253,7 @@ local function arc_callback(task)
 
   task:cache_set('arc-sigs', cbdata.sigs)
   task:cache_set('arc-seals', cbdata.seals)
+  task:cache_set('arc-authres', cbdata.ars)
 
   if validation_error then
     -- ARC rejection but no strong failure for signing
@@ -489,7 +490,7 @@ rspamd_config:register_dependency('ARC_CHECK', 'DKIM_CHECK')
 local function arc_sign_seal(task, params, header)
   local arc_sigs = task:cache_get('arc-sigs')
   local arc_seals = task:cache_get('arc-seals')
-  local arc_auth_results = task:get_header_full('ARC-Authentication-Results') or {}
+  local arc_auth_results = task:cache_get('arc-authres')
   local cur_auth_results
   local privkey
 
@@ -532,7 +533,7 @@ local function arc_sign_seal(task, params, header)
     for i = (cur_idx - 1), 1, (-1) do
       if arc_auth_results[i] then
         local s = dkim_canonicalize('ARC-Authentication-Results',
-          arc_auth_results[i].value)
+          arc_auth_results[i].raw_header)
         sha_ctx:update(s)
         lua_util.debugm(N, task, 'update signature with header: %s', s)
       end


More information about the Commits mailing list