commit 74d1128: [Fix] Re-use milter_headers settings when doing arc signing

Vsevolod Stakhov vsevolod at highsecure.ru
Mon May 13 11:42:03 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-05-13 12:38:26 +0100
URL: https://github.com/rspamd/rspamd/commit/74d11283d93c1f9a39e95ae1da59db11ccd444fa (HEAD -> master)

[Fix] Re-use milter_headers settings when doing arc signing
Issue: #2073

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

diff --git a/src/plugins/lua/arc.lua b/src/plugins/lua/arc.lua
index 53d1779b5..496e8c21e 100644
--- a/src/plugins/lua/arc.lua
+++ b/src/plugins/lua/arc.lua
@@ -90,6 +90,12 @@ local settings = {
   reuse_auth_results = false, -- Reuse the existing authentication results
 }
 
+-- To match normal AR
+local ar_settings = {
+  add_smtp_user = true,
+  stop_chars = ';'
+}
+
 local function parse_arc_header(hdr, target)
   -- Split elements by ';' and trim spaces
   local arr = fun.totable(fun.map(
@@ -425,10 +431,10 @@ local function arc_sign_seal(task, params, header)
       cur_auth_results = ar_header
     else
       rspamd_logger.debugm(N, task, 'cannot reuse authentication results, header is missing')
-      cur_auth_results = auth_results.gen_auth_results(task) or ''
+      cur_auth_results = auth_results.gen_auth_results(task, ar_settings) or ''
     end
   else
-    cur_auth_results = auth_results.gen_auth_results(task) or ''
+    cur_auth_results = auth_results.gen_auth_results(task, ar_settings) or ''
   end
 
   local sha_ctx = hash.create_specific('sha256')
@@ -621,6 +627,17 @@ if not dkim_sign_tools.validate_signing_settings(settings) then
   return
 end
 
+local ar_opts = rspamd_config:get_all_opt('milter_headers')
+
+if ar_opts and ar_opts.routines then
+  local routines = ar_opts.routines
+
+  if routines['authentication-results'] then
+    ar_settings = lua_util.override_defaults(ar_settings,
+        routines['authentication-results'])
+  end
+end
+
 if settings.use_redis then
   redis_params = rspamd_parse_redis_server('arc')
 


More information about the Commits mailing list