aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-08-15 16:26:24 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-08-15 16:26:24 +0100
commit96df62e1b8e6f72fbecb38f9354691a490aa5f90 (patch)
tree8390c610b8a1c2851e1bdefcf7233632fe329063
parent30499880c6f215e1be4e79a6de1e945b1df7ae42 (diff)
downloadrspamd-96df62e1b8e6f72fbecb38f9354691a490aa5f90.tar.gz
rspamd-96df62e1b8e6f72fbecb38f9354691a490aa5f90.zip
[Feature] Fold DKIM-Signature header
-rw-r--r--src/client/rspamc.c8
-rw-r--r--src/libserver/dkim.c2
-rw-r--r--src/libserver/protocol.c9
3 files changed, 10 insertions, 9 deletions
diff --git a/src/client/rspamc.c b/src/client/rspamc.c
index bad266b9e..7a3e2061c 100644
--- a/src/client/rspamc.c
+++ b/src/client/rspamc.c
@@ -1130,12 +1130,8 @@ rspamc_mime_output (FILE *out, ucl_object_t *result, GString *input,
g_string_free (symbuf, TRUE);
if (ucl_object_lookup (result, "dkim-signature")) {
- folded_symbuf = rspamd_header_value_fold ("DKIM-Signature",
- ucl_object_tostring (ucl_object_lookup (result, "dkim-signature")),
- 0);
- rspamd_printf_gstring (added_headers, "DKIM-Signature: %v\r\n",
- folded_symbuf);
- g_string_free (folded_symbuf, TRUE);
+ rspamd_printf_gstring (added_headers, "DKIM-Signature: %s\r\n",
+ ucl_object_tostring (ucl_object_lookup (result, "dkim-signature")));
}
if (json || raw || compact) {
diff --git a/src/libserver/dkim.c b/src/libserver/dkim.c
index 057d7b33b..51f366179 100644
--- a/src/libserver/dkim.c
+++ b/src/libserver/dkim.c
@@ -2136,7 +2136,7 @@ rspamd_dkim_sign (struct rspamd_task *task,
return NULL;
}
- b64_data = rspamd_encode_base64 (rsa_buf, rsa_len, 0, NULL);
+ b64_data = rspamd_encode_base64_fold (rsa_buf, rsa_len, 70, NULL);
rspamd_printf_gstring (hdr, "%s", b64_data);
g_free (b64_data);
diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c
index 371a5de29..201142c17 100644
--- a/src/libserver/protocol.c
+++ b/src/libserver/protocol.c
@@ -1027,8 +1027,13 @@ rspamd_protocol_write_ucl (struct rspamd_task *task)
dkim_sig = rspamd_mempool_get_variable (task->task_pool, "dkim-signature");
if (dkim_sig) {
- ucl_object_insert_key (top, ucl_object_fromstring (dkim_sig->str),
- "dkim-signature", 0, false);
+ GString *folded_header = rspamd_header_value_fold ("DKIM-Signature",
+ dkim_sig->str, 80);
+ ucl_object_insert_key (top,
+ ucl_object_fromstring_common (folded_header->str,
+ folded_header->len, UCL_STRING_RAW),
+ "dkim-signature", 0, false);
+ g_string_free (folded_header, TRUE);
}
rmilter_reply = rspamd_mempool_get_variable (task->task_pool, "rmilter-reply");