From: Vsevolod Stakhov Date: Fri, 23 Sep 2016 13:38:48 +0000 (+0100) Subject: [Fix] Fix DKIM signing for messages with no newline at the end X-Git-Tag: 1.4.0~386 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e7572192bf90631ba745fdc07c505f6935e52708;p=rspamd.git [Fix] Fix DKIM signing for messages with no newline at the end --- diff --git a/src/libserver/dkim.c b/src/libserver/dkim.c index 0219e5fe3..cc11e5074 100644 --- a/src/libserver/dkim.c +++ b/src/libserver/dkim.c @@ -1337,9 +1337,7 @@ rspamd_dkim_skip_empty_lines (const gchar *start, const gchar *end, state = test_spaces; } else { - if (type == DKIM_CANON_SIMPLE) { - *need_crlf = TRUE; - } + *need_crlf = TRUE; goto end; } @@ -1526,6 +1524,13 @@ rspamd_dkim_canonize_body (struct rspamd_dkim_common_ctx *ctx, else { while (rspamd_dkim_relaxed_body_step (ctx, ctx->body_hash, &start, end - start, &remain)) ; + if (need_crlf) { + start = "\r\n"; + end = start + 2; + remain = 2; + rspamd_dkim_relaxed_body_step (ctx, ctx->body_hash, + &start, end - start, &remain); + } } } return TRUE;