]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Match domain name for simple dkim signatures.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 16 Sep 2015 14:14:09 +0000 (15:14 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 16 Sep 2015 14:14:09 +0000 (15:14 +0100)
src/libserver/dkim.c

index 0263eeb2074fda6944fc29c13f5dc42e7be1f396..dd4242393bcc32281813aeacc8b11268ce4ecf59 100644 (file)
@@ -1502,7 +1502,17 @@ rspamd_dkim_canonize_header_simple (rspamd_dkim_context_t *ctx,
                        }
                }
                else {
-                       elt = &g_array_index (to_sign, struct rspamd_dkim_sign_chunk, 0);
+                       /* Try to find the proper header by domain */
+                       for (i = to_sign->len - 1; i >= 0; i--) {
+                               elt = &g_array_index (to_sign,
+                                               struct rspamd_dkim_sign_chunk,
+                                               i);
+                               if (rspamd_substring_search (elt->begin, elt->len,
+                                                       ctx->domain, strlen (ctx->domain)) != -1) {
+                                       break;
+                               }
+                       }
+
                        if (elt->append_crlf) {
                                rspamd_dkim_signature_update (ctx, elt->begin, elt->len + 1);
                        }