From: Timo Sirainen Date: Thu, 20 May 2021 10:22:18 +0000 (+0300) Subject: imap: Send initial tagged reply and capability after rawlogs are initialized X-Git-Tag: 2.3.16~134 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5fc66f182ff6941639d30372b414c1b39ae1e67e;p=thirdparty%2Fdovecot%2Fcore.git 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 --- 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 */