Mercurial > dovecot > core-2.2
changeset 22265:66e02e3235d3
pop3-migration: Drop lines with only spaces or tabs from comparison
Zimbra drops out those lines from IMAP BODY[HEADER] replies.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Wed, 28 Jun 2017 15:50:11 +0300 |
parents | e95435889161 |
children | d165150e8883 |
files | src/plugins/pop3-migration/pop3-migration-plugin.c src/plugins/pop3-migration/test-pop3-migration-plugin.c |
diffstat | 2 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/pop3-migration/pop3-migration-plugin.c Fri Jun 23 11:15:32 2017 +0300 +++ b/src/plugins/pop3-migration/pop3-migration-plugin.c Wed Jun 28 15:50:11 2017 +0300 @@ -144,6 +144,16 @@ return TRUE; } +static bool header_value_want_skip(const struct message_header_line *hdr) +{ + for (size_t i = 0; i < hdr->value_len; i++) { + if (hdr->value[i] != ' ' && hdr->value[i] != '\t') + return FALSE; + } + /* "header: \r\n \r\n" - Zimbra's BODY[HEADER] strips this line away. */ + return TRUE; +} + static void pop3_header_filter_callback(struct header_filter_istream *input ATTR_UNUSED, struct message_header_line *hdr, @@ -164,6 +174,8 @@ 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 && header_value_want_skip(hdr)) { + *matched = TRUE; } if (ctx->stop) *matched = TRUE;
--- a/src/plugins/pop3-migration/test-pop3-migration-plugin.c Fri Jun 23 11:15:32 2017 +0300 +++ b/src/plugins/pop3-migration/test-pop3-migration-plugin.c Wed Jun 28 15:50:11 2017 +0300 @@ -23,7 +23,10 @@ { "a: b \r\n", "44ef6a20971148dd54a161f79814e22e2d098ddb", FALSE }, { "a: b\r\n\r\n", "938b96404495cced816e3a4f6031734eab4e71b3", TRUE }, { "a: b\r\n\r\r\n", "44ef6a20971148dd54a161f79814e22e2d098ddb", FALSE }, - { "a: b\r\n\r\r\nc: d\r\n\r\n", "44ef6a20971148dd54a161f79814e22e2d098ddb", TRUE } + { "a: b\r\n\r\r\nc: d\r\n\r\n", "44ef6a20971148dd54a161f79814e22e2d098ddb", TRUE }, + { "a: b\r\n \r\n", "44ef6a20971148dd54a161f79814e22e2d098ddb", FALSE }, + { "a: b\r\n \r\n", "44ef6a20971148dd54a161f79814e22e2d098ddb", FALSE }, + { "a: b\r\n\t\r\n", "44ef6a20971148dd54a161f79814e22e2d098ddb", FALSE }, }; struct istream *input; unsigned char digest[SHA1_RESULTLEN];