]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Fix potential hang/crash when unhibernating
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 14 Oct 2024 09:53:33 +0000 (12:53 +0300)
committerDovecot Automation <automation@dovecot.org>
Fri, 18 Oct 2024 08:43:16 +0000 (08:43 +0000)
This fixes two potential bugs:

a) Unhibernation is triggered by new mailbox changes. While sending these
to IMAP client, Dovecot notices that the client has disconnected. The
process will stay IDLEing for 30 minutes until it gets disconnected with
"Disconnected: Inactivity - no input for 1800 secs"

b) Unhibernation is triggered by DONE command with some further pipelined
commands. During unhibernation new mailbox changes are noticed, and
again IMAP client is found to be disconnected while sending the changes.
This causes a segfault.

src/imap/cmd-idle.c

index 2b31dc714e1f23d75a5ca1172a8aef10552bb173..e1f492779aaa16053733b843c744cd035489a140 100644 (file)
@@ -302,7 +302,9 @@ bool cmd_idle(struct client_command_context *cmd)
 
        /* check immediately if there are changes. if they came before we
           added mailbox-notifier, we wouldn't see them otherwise. */
-       if (client->mailbox != NULL)
-               idle_sync_now(client->mailbox, ctx);
+       if (client->mailbox != NULL) {
+               if (idle_sync_now(client->mailbox, ctx))
+                       return TRUE;
+       }
        return idle_client_handle_input(ctx, FALSE);
 }