From 8eeaf11d41aff403f13e423dae260aa2ad17b674 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 29 Oct 2015 16:21:02 +0100 Subject: [PATCH] add port to host only, if an URL is used instead of a plain hostname --- apps/user_ldap/lib/wizard.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/user_ldap/lib/wizard.php b/apps/user_ldap/lib/wizard.php index 0c7fecfdb6..e53ff35cfd 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);