]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
pop3-migration: Strip away invalid header lines.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 4 Sep 2017 09:40:49 +0000 (12:40 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 5 Sep 2017 07:13:58 +0000 (10:13 +0300)
If there's no ":" in the header, remove it. Fixes matching mails with
Zimbra.

src/plugins/pop3-migration/pop3-migration-plugin.c
src/plugins/pop3-migration/test-pop3-migration-plugin.c

index b1c8da57846a86613991b96351d86f81bff2fac6..4a4bc614f7c7953188324434987a5f79227b9ae7 100644 (file)
@@ -186,6 +186,10 @@ pop3_header_filter_callback(struct header_filter_istream *input ATTR_UNUSED,
                         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;
                }
index 0a8ddc71468559a46808df6616e593a30f04e6a8..b3765b5feeeecf3a72aed6016aafab48b8849ac8 100644 (file)
@@ -28,6 +28,11 @@ static void test_pop3_migration_get_hdr_sha1(void)
                { "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];