Allow connecting to IPv6 (fix #1095)

This commit is contained in:
Jakub Vrana
2025-09-08 08:18:23 +02:00
parent d1831641a9
commit f921dafa61
7 changed files with 27 additions and 9 deletions

View File

@@ -25,7 +25,8 @@ if (isset($_GET["imap"])) {
private $imap;
function attach($server, $username, $password): string {
$this->mailbox = "{" . "$server:993/ssl}"; // Adminer disallows specifying privileged port in server name
list($host, $port) = host_port($server);
$this->mailbox = "{" . "$host:" . ($port ?: 993) . "/ssl}"; // Adminer disallows specifying privileged port in server name
$this->imap = @imap_open($this->mailbox, $username, $password, OP_HALFOPEN, 1);
return ($this->imap ? '' : imap_last_error());
}