]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: NOTIFY - Fix crash if client disconnects while sending FETCH notification
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 10 Feb 2021 11:13:34 +0000 (13:13 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 17 Feb 2021 11:25:41 +0000 (11:25 +0000)
Fixes:
Panic: Trying to close mailbox INBOX with open transactions

src/imap/imap-notify.c
src/imap/imap-sync.c

index 481caad6e0255599a5c022557214ec91d05c48eb..ca6303adc78c8d4e20666a16d96de23740bfe3e8 100644 (file)
@@ -273,12 +273,12 @@ imap_client_notify_selected(struct client *client)
        if (!fetch_ctx->state.fetching)
                return 1;
 
-       if ((ret = imap_fetch_more_no_lock_update(fetch_ctx)) <= 0)
-               return ret;
+       if ((ret = imap_fetch_more_no_lock_update(fetch_ctx)) == 0)
+               return 0;
        /* finished the FETCH */
        if (imap_fetch_end(fetch_ctx) < 0)
                return -1;
-       return 1;
+       return ret;
 }
 
 static int imap_client_notify_more(struct client *client)
index 2a6b02d3a7db076f5819f1a4b0ef22968313de82..13b61017870eee6104898e2ea78d053de08ec4af 100644 (file)
@@ -42,12 +42,12 @@ static int search_update_fetch_more(const struct imap_search_update *update)
 {
        int ret;
 
-       if ((ret = imap_fetch_more_no_lock_update(update->fetch_ctx)) <= 0)
-               return ret;
+       if ((ret = imap_fetch_more_no_lock_update(update->fetch_ctx)) == 0)
+               return 0;
        /* finished the FETCH */
        if (imap_fetch_end(update->fetch_ctx) < 0)
                return -1;
-       return 1;
+       return ret;
 }
 
 static int