From: Timo Sirainen Date: Wed, 6 Oct 2021 12:43:09 +0000 (+0300) Subject: imap-login: proxy: Don't forward untagged BYE responses to the client X-Git-Tag: 2.3.17~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6f664bd5a47717bbe8c2168b1010d3367841d877;p=thirdparty%2Fdovecot%2Fcore.git imap-login: proxy: Don't forward untagged BYE responses to the client It will just cause confusion, especially when connections are retried. It could end up looking like: x login user pass * BYE Internal error occurred. Refer to server log for more information. * BYE Internal error occurred. Refer to server log for more information. * BYE Internal error occurred. Refer to server log for more information. * BYE Internal error occurred. Refer to server log for more information. x NO [UNAVAILABLE] Account is temporarily unavailable. --- diff --git a/src/imap-login/imap-proxy.c b/src/imap-login/imap-proxy.c index e06996083a..aa5a5aaf54 100644 --- a/src/imap-login/imap-proxy.c +++ b/src/imap-login/imap-proxy.c @@ -438,6 +438,13 @@ int imap_proxy_parse_line(struct client *client, const char *line) } else if (strncasecmp(line, "* ID ", 5) == 0) { /* Reply to ID command we sent, ignore it */ return 0; + } else if (str_begins(line, "* BYE ")) { + /* Login unexpectedly failed (due to some internal error). + Don't forward the BYE to the client, since we're not going + to disconnect it. It could be a possibility to convert these + to NO replies, but they're likely not going to provide + anything useful. */ + return 0; } else if (str_begins(line, "* ")) { /* untagged reply. just forward it. */ client_send_raw(client, t_strconcat(line, "\r\n", NULL));