]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imapc: Fix handling SEARCH failures
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 3 Dec 2025 00:27:35 +0000 (02:27 +0200)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 3 Dec 2025 20:02:34 +0000 (22:02 +0200)
Previously if the remote SEARCH failed, the failure was simply ignored and
empty results returned.

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

index 768d78be73401903487b8f2898bb94a74e9c6f9d..22b279c248499f21c2735fad1a2ef81dbc51dbf4 100644 (file)
@@ -278,12 +278,17 @@ bool imapc_search_next_update_seq(struct mail_search_context *ctx)
 int imapc_search_deinit(struct mail_search_context *ctx)
 {
        struct imapc_search_context *ictx = IMAPC_SEARCHCTX(ctx);
+       int ret = 0;
 
        if (ictx != NULL) {
+               if (!ictx->success)
+                       ret = -1;
                array_free(&ictx->rseqs);
                i_free(ictx);
        }
-       return index_storage_search_deinit(ctx);
+       if (index_storage_search_deinit(ctx) < 0)
+               return -1;
+       return ret;
 }
 
 void imapc_search_reply_search(const struct imap_arg *args,