summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-11-04 14:02:43 +0100
committerMorris Jobke <hey@morrisjobke.de>2015-11-04 14:02:43 +0100
commit09436e95c47a74f3e17f1c7ea2e2ad8c5b6807d7 (patch)
treecbc8398a734cb885c18f26fbef5fc4a477a901ab
parent475b52c93b052fbe5ab563330af4e0abcef0b87c (diff)
parent8eeaf11d41aff403f13e423dae260aa2ad17b674 (diff)
downloadnextcloud-server-09436e95c47a74f3e17f1c7ea2e2ad8c5b6807d7.tar.gz
nextcloud-server-09436e95c47a74f3e17f1c7ea2e2ad8c5b6807d7.zip
Merge pull request #20155 from owncloud/fix-20020
add port to host only, if an URL is used instead of a plain hostname
-rw-r--r--apps/user_ldap/lib/wizard.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/apps/user_ldap/lib/wizard.php b/apps/user_ldap/lib/wizard.php
index 0c7fecfdb64..e53ff35cfd6 100644
--- a/apps/user_ldap/lib/wizard.php
+++ b/apps/user_ldap/lib/wizard.php
@@ -1290,9 +1290,13 @@ class Wizard extends LDAPUtility {
if(!is_null($this->cr)) {
return $this->cr;
}
- $cr = $this->ldap->connect(
- $this->configuration->ldapHost.':'.$this->configuration->ldapPort,
- $this->configuration->ldapPort);
+
+ $host = $this->configuration->ldapHost;
+ if(strpos($host, '://') !== false) {
+ //ldap_connect ignores port parameter when URLs are passed
+ $host .= ':' . $this->configuration->ldapPort;
+ }
+ $cr = $this->ldap->connect($host, $this->configuration->ldapPort);
$this->ldap->setOption($cr, LDAP_OPT_PROTOCOL_VERSION, 3);
$this->ldap->setOption($cr, LDAP_OPT_REFERRALS, 0);