diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-06-25 00:07:49 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-06-25 00:07:49 +0100 |
commit | fd74eaf0dbf946902dac25357a3218e67afda6b7 (patch) | |
tree | 7af7225c56f989236f56e412045e55fcd13ce891 | |
parent | 1ccdd82ab8e63ad41b1e77486d2f95ac31d162d9 (diff) | |
download | rspamd-fd74eaf0dbf946902dac25357a3218e67afda6b7.tar.gz rspamd-fd74eaf0dbf946902dac25357a3218e67afda6b7.zip |
[Fix] Fix folding for arc headers when milter interface is used
-rw-r--r-- | src/lua/lua_util.c | 4 | ||||
-rw-r--r-- | src/plugins/lua/arc.lua | 11 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/lua/lua_util.c b/src/lua/lua_util.c index ec825c30f..6f9ded3cc 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 91cf7739d..f8ff800e0 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)) |