]> 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)
committerAki Tuomi <aki.tuomi@dovecot.fi>
Tue, 5 Sep 2017 06:34:07 +0000 (09:34 +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 4f5f877f4cf7344232c0c34c3f85833829794a48..85d884fcb985db38185fb12967e895e0a1f96f51 100644 (file)
@@ -184,6 +184,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 c4c00e0f823d8ec935eb9b1f270651e24a629f61..439e3e087d77c88a186f550000fb0d5147c1f548 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];