From: Jan Smutny Date: Mon, 20 Mar 2023 08:48:26 +0000 (+0100) Subject: arc.lua: fix usage of ARC-Authentication-Results in arc_sign_seal func X-Git-Tag: 3.6~156^2~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7a71edd3f5c6b270c900b102bfc54085d443316a;p=rspamd.git 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. --- 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