]> 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:41:24 +0000 (10:41 +0200)
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 e617979738631b3886d559afa6dfc749abdd418a..f29f01061f18ff4327cd22fb16501cd761ab03d4 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);
 }