summaryrefslogtreecommitdiffstats
path: root/src/dkim.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2012-08-14 17:27:32 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2012-08-14 17:27:32 +0400
commitab9580bdd74e787b943954f7ff1e8bca9c37ff0a (patch)
tree4ec3b3d5503f7cd8688528db0658bc893fbc65c0 /src/dkim.c
parentabd0676c12cc00ff121d1cc55f5cc8c14cee39ca (diff)
downloadrspamd-ab9580bdd74e787b943954f7ff1e8bca9c37ff0a.tar.gz
rspamd-ab9580bdd74e787b943954f7ff1e8bca9c37ff0a.zip
Fix relaxed body canonization algorithm for several complex cases.
Diffstat (limited to 'src/dkim.c')
-rw-r--r--src/dkim.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/dkim.c b/src/dkim.c
index cc45f28a3..d042f3f7a 100644
--- a/src/dkim.c
+++ b/src/dkim.c
@@ -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;
}