]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Fix potential hang if client disconnects with pipelined ambiguous commands
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 29 Oct 2020 10:55:21 +0000 (12:55 +0200)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Tue, 1 Dec 2020 08:40:45 +0000 (08:40 +0000)
For example if client pipelines FETCH+LOGOUT commands and disconnects during
a large FETCH output, the LOGOUT command is processed as waiting for
unambiguity. This code path however doesn't detect a client disconnection,
and input IO handler is removed so it can't detect it either. So the imap
process hangs.

src/imap/imap-client.c

index ca5db576b2066fca8c4460f9d765486da978c70a..2c7681d6d64a1f0b08379d093a9e74d4233454e5 100644 (file)
@@ -1117,7 +1117,9 @@ void client_continue_pending_input(struct client *client)
                if (!ret)
                        break;
        }
-       if (!client->input->closed && !client->output->closed)
+       if (client->input->closed || client->output->closed)
+               client_destroy(client, NULL);
+       else
                client_check_command_hangs(client);
 }