]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix DKIM signing for messages with no newline at the end
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 23 Sep 2016 13:38:48 +0000 (14:38 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 23 Sep 2016 13:38:48 +0000 (14:38 +0100)
src/libserver/dkim.c

index 0219e5fe33523e10e90ece550d2be285f7056527..cc11e5074ac62c43ca03823c450162134c1e0f48 100644 (file)
@@ -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;