diff --git a/library/Icinga/Protocol/Ldap/LdapConnection.php b/library/Icinga/Protocol/Ldap/LdapConnection.php index dd6c9b161..2b51ee4d7 100644 --- a/library/Icinga/Protocol/Ldap/LdapConnection.php +++ b/library/Icinga/Protocol/Ldap/LdapConnection.php @@ -1185,6 +1185,9 @@ class LdapConnection implements Selectable, Inspectable $ldapUrls = explode(' ', $hostname); if (count($ldapUrls) > 1) { foreach ($ldapUrls as & $uri) { + if (preg_match('/:\d+$/', $uri) === 0) { + $uri = $uri . ':' . $this->port; + } if (strpos($uri, '://') === false) { $uri = 'ldaps://' . $uri; } @@ -1192,7 +1195,7 @@ class LdapConnection implements Selectable, Inspectable $hostname = implode(' ', $ldapUrls); } else { - $hostname = 'ldaps://' . $hostname; + $hostname = 'ldaps://' . $hostname . ':' . $this->port; } }