]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-mail: Fixed istream-header-filter callback's matched with eoh
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sun, 15 May 2016 11:53:24 +0000 (14:53 +0300)
committerGitLab <gitlab@git.dovecot.net>
Mon, 16 May 2016 18:39:43 +0000 (21:39 +0300)
Reversed the matched-parameter handling for hdr->eoh, so it's consistent
with non-eoh headers.

src/lib-mail/istream-header-filter.c
src/lib-mail/test-istream-header-filter.c
src/plugins/pop3-migration/pop3-migration-plugin.c

index 6f87db95008d9f75839e91b7e476a6721164d8fa..184782273586706c78760c140f8d97a3668acb6b 100644 (file)
@@ -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;
index 0523390d8cda3ee3c678ca73ffb30fd8b3cd9d27..017c40d364e39fc23da57522ad993d4b0244fc10 100644 (file)
@@ -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)
index 9a45814afd6635e839adc4e8c73ce68426328fc9..c5fb44a4b926ddab11b5fdcb49f3e9f5cbda3d17 100644 (file)
@@ -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