Skip to content

Commit 0a085ef

Browse files
authored
Merge pull request #521 from nextcloud/fix/noid/deprecated-connect-call
supply uri to ldap_connect
2 parents 12afebc + 95501e4 commit 0a085ef

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/LDAPConnect.php

+9-1
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,16 @@ public function connect() {
4949
$ldapHost = $this->ldapConfig->ldapHost;
5050
$ldapPort = $this->ldapConfig->ldapPort;
5151

52+
// shamelessly copied from OCA\User_LDAP\LDAP::connect()
53+
if (strpos($ldapHost, '://') === false) {
54+
$ldapHost = 'ldap://' . $ldapHost;
55+
}
56+
if (strpos($ldapHost, ':', strpos($ldapHost, '://') + 1) === false) {
57+
$ldapHost .= ':' . $ldapPort;
58+
}
59+
5260
// Connecting to LDAP - TODO: connect directly via LDAP plugin
53-
$cr = ldap_connect($ldapHost, $ldapPort);
61+
$cr = ldap_connect($ldapHost);
5462
if(!is_resource($cr) && !is_object($cr)) {
5563
throw new ServerNotAvailableException('LDAP server not available');
5664
}

0 commit comments

Comments
 (0)