aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-09-23 13:34:46 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-09-23 13:34:46 +0100
commitf4bf42266b6fc8e2e994e5fdbbb8f0d60a4808d9 (patch)
treeff8b8180bb5887a589ae93fe69be45e2fbbd5225 /src/libserver
parent1b33ef8ab63be63ba712a456c846fe427c347d37 (diff)
downloadrspamd-f4bf42266b6fc8e2e994e5fdbbb8f0d60a4808d9.tar.gz
rspamd-f4bf42266b6fc8e2e994e5fdbbb8f0d60a4808d9.zip
[Fix] More spaces fix in DKIM signature
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/dkim.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/libserver/dkim.c b/src/libserver/dkim.c
index f017a2b24..0219e5fe3 100644
--- a/src/libserver/dkim.c
+++ b/src/libserver/dkim.c
@@ -1351,7 +1351,7 @@ rspamd_dkim_skip_empty_lines (const gchar *start, const gchar *end,
else if (*p == '\n') {
state = got_lf;
}
- else if (type == DKIM_CANON_RELAXED && *p == ' ') {
+ else if (type == DKIM_CANON_RELAXED && (*p == ' ' || *p == '\t')) {
skip = 0;
state = test_spaces;
}
@@ -1377,7 +1377,8 @@ rspamd_dkim_skip_empty_lines (const gchar *start, const gchar *end,
state = got_lf;
}
}
- else if (type == DKIM_CANON_RELAXED && *(p - 1) == ' ') {
+ else if (type == DKIM_CANON_RELAXED && (*(p - 1) == ' ' ||
+ *(p - 1) == '\t')) {
skip = 1;
state = test_spaces;
}
@@ -1386,8 +1387,10 @@ rspamd_dkim_skip_empty_lines (const gchar *start, const gchar *end,
}
}
else {
- if (type == DKIM_CANON_RELAXED) {
- p -= 1;
+ if (g_ascii_isspace (*(p - 1))) {
+ if (type == DKIM_CANON_RELAXED) {
+ p -= 1;
+ }
}
goto end;
}
@@ -1402,7 +1405,8 @@ rspamd_dkim_skip_empty_lines (const gchar *start, const gchar *end,
p --;
state = got_lf;
}
- else if (type == DKIM_CANON_RELAXED && *(p - 1) == ' ') {
+ else if (type == DKIM_CANON_RELAXED && (*(p - 1) == ' ' ||
+ *(p - 1) == '\t')) {
skip = 1;
state = test_spaces;
}
@@ -1411,8 +1415,10 @@ rspamd_dkim_skip_empty_lines (const gchar *start, const gchar *end,
}
}
else {
- if (type == DKIM_CANON_RELAXED) {
- p -= 1;
+ if (g_ascii_isspace (*(p - 1))) {
+ if (type == DKIM_CANON_RELAXED) {
+ p -= 1;
+ }
}
goto end;
}
@@ -1427,7 +1433,8 @@ rspamd_dkim_skip_empty_lines (const gchar *start, const gchar *end,
p -= 2;
state = got_lf;
}
- else if (type == DKIM_CANON_RELAXED && *(p - 3) == ' ') {
+ else if (type == DKIM_CANON_RELAXED && (*(p - 3) == ' ' ||
+ *(p - 3) == '\t')) {
skip = 2;
state = test_spaces;
}
@@ -1436,8 +1443,10 @@ rspamd_dkim_skip_empty_lines (const gchar *start, const gchar *end,
}
}
else {
- if (type == DKIM_CANON_RELAXED) {
- p -= 2;
+ if (g_ascii_isspace (*(p - 2))) {
+ if (type == DKIM_CANON_RELAXED) {
+ p -= 2;
+ }
}
goto end;
}
@@ -1445,7 +1454,7 @@ rspamd_dkim_skip_empty_lines (const gchar *start, const gchar *end,
case test_spaces:
t = p - skip;
- while (t > start + 2 && *t == ' ') {
+ while (t > start + 2 && (*t == ' ' || *t == '\t')) {
t --;
}