diff --git a/src/lib-mail/istream-header-filter.c b/src/lib-mail/istream-header-filter.c index 6f87db9500..1847822735 100644 --- a/src/lib-mail/istream-header-filter.c +++ b/src/lib-mail/istream-header-filter.c @@ -197,7 +197,7 @@ static ssize_t read_header(struct header_filter_istream *mstream) mstream->cur_line++; if (hdr->eoh) { mstream->seen_eoh = TRUE; - matched = TRUE; + matched = FALSE; if (mstream->header_parsed && !mstream->headers_edited) { if (mstream->eoh_not_matched) matched = !matched; @@ -206,7 +206,7 @@ static ssize_t read_header(struct header_filter_istream *mstream) mstream->context); } - if (!matched) { + if (matched) { mstream->seen_eoh = FALSE; mstream->eoh_not_matched = TRUE; continue; diff --git a/src/lib-mail/test-istream-header-filter.c b/src/lib-mail/test-istream-header-filter.c index 0523390d8c..017c40d364 100644 --- a/src/lib-mail/test-istream-header-filter.c +++ b/src/lib-mail/test-istream-header-filter.c @@ -266,7 +266,7 @@ edit_callback(struct header_filter_istream *input, /* add a new header */ const char *new_hdr = "Added: header\n\n"; i_stream_header_filter_add(input, new_hdr, strlen(new_hdr)); - *matched = FALSE; + *matched = TRUE; } else if (strcasecmp(hdr->name, "To") == 0) { /* modify To header */ const char *new_to = "To: 123\n"; @@ -434,7 +434,7 @@ strip_eoh_callback(struct header_filter_istream *input ATTR_UNUSED, bool *matched, void *context ATTR_UNUSED) { if (hdr != NULL && hdr->eoh) - *matched = FALSE; + *matched = TRUE; } static void test_istream_strip_eoh(void) diff --git a/src/plugins/pop3-migration/pop3-migration-plugin.c b/src/plugins/pop3-migration/pop3-migration-plugin.c index 9a45814afd..c5fb44a4b9 100644 --- a/src/plugins/pop3-migration/pop3-migration-plugin.c +++ b/src/plugins/pop3-migration/pop3-migration-plugin.c @@ -153,11 +153,8 @@ pop3_header_filter_callback(struct header_filter_istream *input ATTR_UNUSED, return; if (hdr->eoh) { ctx->have_eoh = TRUE; - if (ctx->stop) { - /* matched is handled differently for eoh by - istream-header-filter. a design bug I guess.. */ - *matched = FALSE; - } + if (ctx->stop) + *matched = TRUE; } else { if (strspn(hdr->name, "\r") == hdr->name_len) { /* CR+CR+LF - some servers stop the header processing