]> 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>
Mon, 19 Apr 2021 09:46:44 +0000 (12:46 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 19 Apr 2021 09:50:03 +0000 (12:50 +0300)
Continues the incomplete fix for c4f4058d16096f23eea0b3182205d6653f5954dd

Fixes:
Panic: Trying to close mailbox INBOX with open transactions

src/imap/imap-client.c

index ffb1fdc7488b8bcdcb81309b456b598949d91031..1ae8c45963e3960cb62f8e51e821c16ae3f9c4bb 100644 (file)
@@ -463,12 +463,14 @@ static void client_default_destroy(struct client *client, const char *reason)
        if (client->input_lock != NULL)
                client_command_cancel(&client->input_lock);
 
-       if (client->mailbox != NULL)
-               imap_client_close_mailbox(client);
        if (client->notify_ctx != NULL)
                imap_notify_deinit(&client->notify_ctx);
        if (client->urlauth_ctx != NULL)
                imap_urlauth_deinit(&client->urlauth_ctx);
+       /* Keep mailbox closing close to last, so anything that could
+          potentially have transactions open will close them first. */
+       if (client->mailbox != NULL)
+               imap_client_close_mailbox(client);
        if (client->anvil_sent) {
                master_service_anvil_send(master_service, t_strconcat(
                        "DISCONNECT\t", my_pid, "\timap/",