]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap-login: proxy: Fix STARTTLS failure message
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 14 Oct 2021 22:11:06 +0000 (00:11 +0200)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Wed, 23 Mar 2022 10:25:06 +0000 (10:25 +0000)
The error message blindly skipped over 3 bytes after the tagged "S " reply.
This was okay if the reply was "NO", but wrong if the reply was "BAD". Also
nothing really guarantees that a broken server couldn't have just returned
a truncated "S " string, in which case the error would point to garbage.

src/imap-login/imap-proxy.c

index 75f874e9b30ffaf14746a51e23afd6fe7a8f0539..042b24a76f3d78030fe3882c1a7f767f6756532f 100644 (file)
@@ -367,7 +367,7 @@ int imap_proxy_parse_line(struct client *client, const char *line)
                        /* STARTTLS failed */
                        const char *reason = t_strdup_printf(
                                "STARTTLS failed: %s",
-                               str_sanitize(line + 5, 160));
+                               str_sanitize(line + 2, 160));
                        login_proxy_failed(client->login_proxy,
                                login_proxy_get_event(client->login_proxy),
                                LOGIN_PROXY_FAILURE_TYPE_REMOTE, reason);