From: Timo Sirainen Date: Sat, 31 Jan 2026 15:55:30 +0000 (+0200) Subject: imap-login: imap-proxy - Handle ID command failures X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15afc49c71af0e6f4f693e450b9fa79e64152b47;p=thirdparty%2Fdovecot%2Fcore.git imap-login: imap-proxy - Handle ID command failures If it fails with SERVERBUG, abort the login. This is used now by Dovecot to indicate that the settings reload failed, and the client will be disconnected next anyway. By aborting earlier, we can log the failure better. If the ID command fails in other ways, log it as a debug message. --- diff --git a/src/imap-login/imap-proxy.c b/src/imap-login/imap-proxy.c index 677d7b5845..34ed1b24e8 100644 --- a/src/imap-login/imap-proxy.c +++ b/src/imap-login/imap-proxy.c @@ -483,13 +483,25 @@ int imap_proxy_parse_line(struct client *client, const char *line) return 1; } return 0; - } else if (str_begins_icase_with(line, "I ")) { + } else if (str_begins_icase(line, "I ", &line)) { /* Reply to ID command we sent, ignore it unless pipelining is disabled, in which case send either STARTTLS or login */ imap_client->proxy_sent_state &= ENUM_NEGATE(IMAP_PROXY_SENT_STATE_ID); imap_client->proxy_rcvd_state = IMAP_PROXY_RCVD_STATE_ID; + if (str_begins_icase(line, "NO ["IMAP_RESP_CODE_SERVERBUG"] ", &line)) { + login_proxy_failed(client->login_proxy, + login_proxy_get_event(client->login_proxy), + LOGIN_PROXY_FAILURE_TYPE_REMOTE_CONFIG, + t_strdup_printf("ID command failed: %s", line)); + return -1; + } else if (!str_begins_icase(line, "OK", &line)) { + e_debug(login_proxy_get_event(client->login_proxy), + "ID command failed, ignoring: %s", + str_sanitize(line, 160)); + } + if (client->proxy_nopipelining) { str = t_str_new(128); if ((ret = proxy_write_starttls(imap_client, str)) < 0) {