# HG changeset patch # User Timo Sirainen # Date 1452009686 18000 # Node ID 504104af673f6047653bde1911d68a75fb2a942b # Parent dfee8dea71b69dbbcd9b1cddff9f487a88d9e01e imap: Don't hang at ambiguous commands when they were pipelined already before login For example if all of these are sent in a single IP packet: a login user pass b select inbox c noop d unselect diff -r dfee8dea71b6 -r 504104af673f src/imap/main.c --- a/src/imap/main.c Mon Jan 04 14:34:01 2016 -0500 +++ b/src/imap/main.c Tue Jan 05 11:01:26 2016 -0500 @@ -202,6 +202,13 @@ (void)client_handle_input(client); o_stream_uncork(output); o_stream_unref(&output); + + /* we could have already handled LOGOUT, or we might need to continue + pending ambigious commands. */ + if (client->disconnected) + client_destroy(client, NULL); + else + client_continue_pending_input(client); } int client_create_from_input(const struct mail_storage_service_input *input, @@ -280,6 +287,7 @@ const buffer_t *input_buf = t_base64_decode_str(input_base64); client_add_input(client, input_buf->data, input_buf->used); } + /* client may be destroyed now */ } static void @@ -314,12 +322,12 @@ master_service_client_connection_destroyed(master_service); return; } - client_add_input(client, login_client->data, - login_client->auth_req.data_size); - flags = login_client->auth_req.flags; if ((flags & MAIL_AUTH_REQUEST_FLAG_TLS_COMPRESSION) != 0) client->tls_compression = TRUE; + client_add_input(client, login_client->data, + login_client->auth_req.data_size); + /* client may be destroyed now */ } static void login_client_failed(const struct master_login_client *client,