aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-06 13:13:03 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-06 13:13:03 +0100
commite21d167388737cf771958da1004adc29ce5f171b (patch)
treef3d4ba997f84c82ccd4a4d71c21503e92f80384e /src/libserver
parent26e0a85618d704cfa79277da629930b587e9d4f9 (diff)
downloadrspamd-e21d167388737cf771958da1004adc29ce5f171b.tar.gz
rspamd-e21d167388737cf771958da1004adc29ce5f171b.zip
[Fix] Fix body start position
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/dkim.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/libserver/dkim.c b/src/libserver/dkim.c
index 2031f39fd..db916e837 100644
--- a/src/libserver/dkim.c
+++ b/src/libserver/dkim.c
@@ -1907,6 +1907,11 @@ rspamd_dkim_check (rspamd_dkim_context_t *ctx,
body_end = task->msg.begin + task->msg.len;
headers_end = task->msg.begin + task->raw_headers_content.len;
+ while ((*headers_end == '\r' || *headers_end == '\n') &&
+ headers_end < body_end) {
+ headers_end ++;
+ }
+
/* Start canonization of body part */
if (!rspamd_dkim_canonize_body (&ctx->common, headers_end, body_end)) {
return DKIM_RECORD_ERROR;
@@ -2186,11 +2191,14 @@ rspamd_dkim_sign (struct rspamd_task *task,
/* Now canonize headers */
for (i = 0; i < ctx->common.hlist->len; i++) {
dh = g_ptr_array_index (ctx->common.hlist, i);
- rspamd_dkim_canonize_header (&ctx->common, task, dh->name, dh->count,
- NULL, NULL);
- for (j = 0; j < dh->count; j++) {
- rspamd_printf_gstring (hdr, "%s:", dh->name);
+ if (g_hash_table_lookup (task->raw_headers, dh->name)) {
+ rspamd_dkim_canonize_header (&ctx->common, task, dh->name, dh->count,
+ NULL, NULL);
+
+ for (j = 0; j < dh->count; j++) {
+ rspamd_printf_gstring (hdr, "%s:", dh->name);
+ }
}
}