]> source.dussan.org Git - rspamd.git/commitdiff
Fix relaxed body canonization algorithm for several complex cases.
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Tue, 14 Aug 2012 13:27:32 +0000 (17:27 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Tue, 14 Aug 2012 13:27:32 +0000 (17:27 +0400)
src/dkim.c

index cc45f28a30136b3da118303874e23d6994fbe2ac..d042f3f7a3724c9e2cfc1715ca25b8ebaf74e6ff 100644 (file)
@@ -854,6 +854,10 @@ rspamd_dkim_relaxed_body_step (GChecksum *ck, const gchar **start, guint remain)
 
        *start = h;
 
+       if (!finished && *(t - 1) == ' ' && g_ascii_isspace (*h)) {
+               /* Avoid border problems */
+               t --;
+       }
 #if 0
        msg_debug ("update signature with buffer: %*s", t - buf, buf);
 #endif
@@ -875,6 +879,12 @@ rspamd_dkim_canonize_body (rspamd_dkim_context_t *ctx, const gchar *start, const
                        if (*end == '\n' && *(end - 1) == '\r' && *(end - 2) == '\n') {
                                end -= 2;
                        }
+                       else if (*end == '\n' && *(end - 1) == '\n') {
+                               end --;
+                       }
+                       else if (*end == '\r' && *(end - 1) == '\r') {
+                               end --;
+                       }
                        else {
                                break;
                        }