From: Vsevolod Stakhov Date: Fri, 8 Jul 2016 16:30:54 +0000 (+0100) Subject: [Fix] Fix dkim signing X-Git-Tag: 1.3.0~132 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ab37087c4efa784688fbb5055655de4e2a938a5c;p=rspamd.git [Fix] Fix dkim signing --- diff --git a/src/libserver/dkim.c b/src/libserver/dkim.c index fadee81c4..16cb7f371 100644 --- a/src/libserver/dkim.c +++ b/src/libserver/dkim.c @@ -2104,6 +2104,24 @@ rspamd_dkim_sign (struct rspamd_task *task, rspamd_printf_gstring (hdr, "bh=%s;b=", b64_data); g_free (b64_data); + if (ctx->common.header_canon_type == DKIM_CANON_RELAXED) { + if (!rspamd_dkim_canonize_header_relaxed (&ctx->common, + hdr->str, + DKIM_SIGNHEADER, + TRUE)) { + + g_string_free (hdr, TRUE); + return NULL; + } + } + else { + /* Will likely have issues with folding */ + rspamd_dkim_hash_update (ctx->common.headers_hash, hdr->str, + hdr->len); + msg_debug_task ("update signature with header: %*s", + (gint)hdr->len, hdr->str); + } + dlen = EVP_MD_CTX_size (ctx->common.headers_hash); EVP_DigestFinal_ex (ctx->common.headers_hash, raw_digest, NULL); rsa_len = RSA_size (ctx->key->key_rsa);