# HG changeset patch # User Timo Sirainen # Date 1504518049 -10800 # Node ID e2b9cadf91e4d039010e420740383a3d324e862a # Parent 1ff8f91dafba8ccbe5431a90d9855ba469546cd1 pop3-migration: Strip away invalid header lines. If there's no ":" in the header, remove it. Fixes matching mails with Zimbra. diff -r 1ff8f91dafba -r e2b9cadf91e4 src/plugins/pop3-migration/pop3-migration-plugin.c --- 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; } diff -r 1ff8f91dafba -r e2b9cadf91e4 src/plugins/pop3-migration/test-pop3-migration-plugin.c --- 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];