[Web] Fix transport check for IPv6 addresses, thanks to marekschneider

This commit is contained in:
andryyy 2021-05-20 11:35:01 +02:00
parent d6a3094bcc
commit 8e38adf2f6
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF

View File

@ -42,7 +42,7 @@ if (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == "admi
$port = substr($hostname_w_port, strrpos($hostname_w_port, ':') + 1); $port = substr($hostname_w_port, strrpos($hostname_w_port, ':') + 1);
$hostname = preg_replace('/'. preg_quote(':' . $port, '/') . '$/', '', $hostname_w_port); $hostname = preg_replace('/'. preg_quote(':' . $port, '/') . '$/', '', $hostname_w_port);
if (filter_var($hostname, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { if (filter_var($hostname, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
$hostname = '[' . $hostname . ']:'; $hostname = '[' . $hostname . ']';
} }
} }
else { else {