]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix folding for arc headers when milter interface is used
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 24 Jun 2017 23:07:49 +0000 (00:07 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 24 Jun 2017 23:07:49 +0000 (00:07 +0100)
src/lua/lua_util.c
src/plugins/lua/arc.lua

index ec825c30f35adef33484361d4b9bfeb5f12aa774..6f9ded3cc76165fa3cd820229994be9f74f77387 100644 (file)
@@ -1138,11 +1138,11 @@ lua_util_fold_header (lua_State *L)
                if (lua_isstring (L, 3)) {
                        how = lua_tostring (L, 3);
 
-                       if (g_ascii_strcasecmp (how, "cr") == 0) {
+                       if (strcmp (how, "cr") == 0) {
                                folded = rspamd_header_value_fold (name, value, 0,
                                                RSPAMD_TASK_NEWLINES_CR);
                        }
-                       else if (g_ascii_strcasecmp (how, "lf") == 0) {
+                       else if (strcmp (how, "lf") == 0) {
                                folded = rspamd_header_value_fold (name, value, 0,
                                                RSPAMD_TASK_NEWLINES_LF);
                        }
index 91cf7739d67270dc9fb20d1cbfbb3c3e09f9fd56..f8ff800e037176106fdae35a0dedc5bd9531b6f3 100644 (file)
@@ -344,12 +344,17 @@ rspamd_config:register_dependency(id, symbols['spf_allow_symbol'])
 rspamd_config:register_dependency(id, symbols['dkim_allow_symbol'])
 
 local function arc_sign_seal(task, params, header)
+  local fold_type = "crlf"
   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 cur_auth_results = auth_results.gen_auth_results(task) or ''
   local privkey
 
+  if task:has_flag("milter") then
+    fold_type = "lf"
+  end
+
   if params.rawkey then
     privkey = rspamd_rsa_privkey.load_pem(params.rawkey)
   elseif params.key then
@@ -390,11 +395,11 @@ local function arc_sign_seal(task, params, header)
 
   header = rspamd_util.fold_header(
     'ARC-Message-Signature',
-    header)
+    header, fold_type)
 
   cur_auth_results = rspamd_util.fold_header(
     'ARC-Authentication-Results',
-    cur_auth_results)
+    cur_auth_results, fold_type)
 
   cur_auth_results = string.format('i=%d; %s', cur_idx, cur_auth_results)
   local s = dkim_canonicalize('ARC-Authentication-Results',
@@ -421,7 +426,7 @@ local function arc_sign_seal(task, params, header)
       ['ARC-Message-Signature'] = header,
       ['ARC-Seal'] = rspamd_util.fold_header(
         'ARC-Seal',
-        cur_arc_seal),
+        cur_arc_seal, fold_type),
     }
   })
   task:insert_result(settings.sign_symbol, 1.0, string.format('i=%d', cur_idx))