From 5fc66f182ff6941639d30372b414c1b39ae1e67e Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 20 May 2021 13:22:18 +0300 Subject: [PATCH] imap: Send initial tagged reply and capability after rawlogs are initialized This way the initial tagged reply and capability is written to the rawlog. Broken by 16328738d35370685387ec51d20657265855e770 --- src/imap/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/imap/main.c b/src/imap/main.c index 3769534386..38c9e7cd19 100644 --- a/src/imap/main.c +++ b/src/imap/main.c @@ -349,9 +349,9 @@ static void main_stdio_run(const char *username) &request); } - client_send_login_reply(client, &request); if (client_create_finish(client, &error) < 0) i_fatal("%s", error); + client_send_login_reply(client, &request); client_add_input_finalize(client); /* client may be destroyed now */ } @@ -401,8 +401,10 @@ login_client_connected(const struct master_login_client *login_client, login_client->auth_req.data_size, &request); /* finish initializing the user (see comment in main()) */ - client_send_login_reply(client, &request); if (client_create_finish(client, &error) < 0) { + /* Even though client initialization failed, send the login + OK reply so client doesn't think that the login failed. */ + client_send_login_reply(client, &request); if (write_full(login_client->fd, MSG_BYE_INTERNAL_ERROR, strlen(MSG_BYE_INTERNAL_ERROR)) < 0) if (errno != EAGAIN && errno != EPIPE) @@ -413,6 +415,7 @@ login_client_connected(const struct master_login_client *login_client, client_destroy(client, error); return; } + client_send_login_reply(client, &request); client_add_input_finalize(client); /* client may be destroyed now */ -- 2.47.3