Merge pull request #3714 from ignasr/fix/ldaps-port-3713

use the correct LDAPS port

(cherry picked from commit 8fc467ca3c)
Signed-off-by: Johannes Meyer <johannes.meyer@icinga.com>
This commit is contained in:
Johannes Meyer 2019-04-12 09:36:33 +02:00
parent dd1fd2eb71
commit 991bdcdbec
1 changed files with 4 additions and 1 deletions

View File

@ -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;
}
}