From: Vsevolod Stakhov Date: Sat, 24 Jun 2017 23:07:49 +0000 (+0100) Subject: [Fix] Fix folding for arc headers when milter interface is used X-Git-Tag: 1.6.2~72 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd74eaf0dbf946902dac25357a3218e67afda6b7;p=thirdparty%2Frspamd.git [Fix] Fix folding for arc headers when milter interface is used --- diff --git a/src/lua/lua_util.c b/src/lua/lua_util.c index ec825c30f3..6f9ded3cc7 100644 --- a/src/lua/lua_util.c +++ b/src/lua/lua_util.c @@ -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); } diff --git a/src/plugins/lua/arc.lua b/src/plugins/lua/arc.lua index 91cf7739d6..f8ff800e03 100644 --- a/src/plugins/lua/arc.lua +++ b/src/plugins/lua/arc.lua @@ -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))