]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
submission-login: submission-proxy - Properly handle IPv6 in redirect.
authorStephan Bosch <stephan.bosch@open-xchange.com>
Sat, 20 Nov 2021 22:43:28 +0000 (23:43 +0100)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 17 Jan 2022 11:52:10 +0000 (13:52 +0200)
src/submission-login/submission-proxy.c

index 6cef403a93a46852863eee9b5743aaa5fa52ff60..8cb4fefbce4d1a5cf46101641a75e17648644744 100644 (file)
@@ -399,7 +399,12 @@ submission_proxy_parse_redirect(const char *resp, const char **userhostport_r,
        if (destuser != NULL)
                str_append(str, destuser);
        str_append_c(str, '@');
-       str_append(str, host);
+       if (ip.family == AF_INET)
+               str_append(str, net_ip2addr(&ip));
+       else if (ip.family == AF_INET6)
+               str_printfa(str, "[%s]", net_ip2addr(&ip));
+       else
+               str_append(str, host);
        if (port != 0)
                str_printfa(str, ":%u", port);
        *userhostport_r = str_c(str);