Mercurial > dovecot > core-2.2
changeset 22451:e2b9cadf91e4
pop3-migration: Strip away invalid header lines.
If there's no ":" in the header, remove it. Fixes matching mails with
Zimbra.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Mon, 04 Sep 2017 12:40:49 +0300 |
parents | 1ff8f91dafba |
children | 566bd6b3b348 |
files | src/plugins/pop3-migration/pop3-migration-plugin.c src/plugins/pop3-migration/test-pop3-migration-plugin.c |
diffstat | 2 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/pop3-migration/pop3-migration-plugin.c Fri Aug 25 13:38:35 2017 +0300 +++ b/src/plugins/pop3-migration/pop3-migration-plugin.c Mon Sep 04 12:40:49 2017 +0300 @@ -186,6 +186,10 @@ here while others don't. To make sure they can be matched correctly we want to stop here entirely. */ ctx->stop = TRUE; + } else if (!hdr->continued && hdr->middle_len == 0) { + /* not a valid "key: value" header - + Zimbra's BODY[HEADER] strips this line away. */ + *matched = TRUE; } else if (hdr->continued && header_value_want_skip(hdr)) { *matched = TRUE; }
--- a/src/plugins/pop3-migration/test-pop3-migration-plugin.c Fri Aug 25 13:38:35 2017 +0300 +++ b/src/plugins/pop3-migration/test-pop3-migration-plugin.c Mon Sep 04 12:40:49 2017 +0300 @@ -28,6 +28,11 @@ { "a: b\r\n \r\n", "44ef6a20971148dd54a161f79814e22e2d098ddb", FALSE }, { "a: b\r\n\t\r\n", "44ef6a20971148dd54a161f79814e22e2d098ddb", FALSE }, { "a: b\t\t\t\t\r\n", "44ef6a20971148dd54a161f79814e22e2d098ddb", FALSE }, + { "a: b\nfoo\n", "44ef6a20971148dd54a161f79814e22e2d098ddb", FALSE }, + + { "a: b\nc: d\n", "4dbea2c1bdd1323e15931382c1835200d9286230", FALSE }, + { "a:b\nc:d\n", "4dbea2c1bdd1323e15931382c1835200d9286230", FALSE }, + { "a: b\nfoo\nc: d\n", "4dbea2c1bdd1323e15931382c1835200d9286230", FALSE }, }; struct istream *input; unsigned char digest[SHA1_RESULTLEN];