]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Header+body searches might not have searched the body in some cases.
authorTimo Sirainen <tss@iki.fi>
Fri, 11 Oct 2013 09:22:56 +0000 (12:22 +0300)
committerTimo Sirainen <tss@iki.fi>
Fri, 11 Oct 2013 09:22:56 +0000 (12:22 +0300)
Only the header was requested for the search stream, which with imapc and
pop3c could have caused the body not to be in the stream, although it
usually was because of the "fetch body" hint.

src/lib-storage/index/index-search.c

index 0f10a04d15a177f2f72a95164bf070b8598d467e..a25a1be3e8bc98cd9d8f07d480b1a2319ffe5c00 100644 (file)
@@ -679,7 +679,10 @@ static int search_arg_match_text(struct mail_search_arg *args,
                input = NULL;
        } else if (have_headers) {
                /* we need to read the entire header */
-               if (mail_get_hdr_stream(ctx->cur_mail, NULL, &input) < 0)
+               ret = have_body ?
+                       mail_get_stream(ctx->cur_mail, NULL, NULL, &input) :
+                       mail_get_hdr_stream(ctx->cur_mail, NULL, &input);
+               if (ret < 0)
                        failed = TRUE;
                else {
                        hdr_ctx.parse_headers =