diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-06-05 11:10:37 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-06-05 11:10:37 +0200 |
commit | c747a58978ffd1985c547f94cedec29663d73496 (patch) | |
tree | 5fe4292007bc6a034d55890d4e8a2babfb7731d9 /apps | |
parent | e544d5b2c66f4b9a894bfdc92b2ae869f742b087 (diff) | |
parent | 6f69fab38407cc40877904ad49a4906527f8f606 (diff) | |
download | nextcloud-server-c747a58978ffd1985c547f94cedec29663d73496.tar.gz nextcloud-server-c747a58978ffd1985c547f94cedec29663d73496.zip |
Merge pull request #16748 from owncloud/fix-ldap-port-detection-regression
port detection needs to take care of now thrown exceptions when LDAP …
Diffstat (limited to 'apps')
-rw-r--r-- | apps/user_ldap/lib/wizard.php | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/apps/user_ldap/lib/wizard.php b/apps/user_ldap/lib/wizard.php index 6c39f406e83..49cbe6d72bd 100644 --- a/apps/user_ldap/lib/wizard.php +++ b/apps/user_ldap/lib/wizard.php @@ -31,6 +31,8 @@ namespace OCA\user_ldap\lib; +use OC\ServerNotAvailableException; + class Wizard extends LDAPUtility { static protected $l; protected $access; @@ -1065,18 +1067,27 @@ class Wizard extends LDAPUtility { $this->ldap->setOption($cr, LDAP_OPT_PROTOCOL_VERSION, 3); $this->ldap->setOption($cr, LDAP_OPT_REFERRALS, 0); $this->ldap->setOption($cr, LDAP_OPT_NETWORK_TIMEOUT, self::LDAP_NW_TIMEOUT); - if($tls) { - $isTlsWorking = @$this->ldap->startTls($cr); - if(!$isTlsWorking) { - return false; + + try { + if($tls) { + $isTlsWorking = @$this->ldap->startTls($cr); + if(!$isTlsWorking) { + return false; + } } - } - \OCP\Util::writeLog('user_ldap', 'Wiz: Attemping to Bind ', \OCP\Util::DEBUG); - //interesting part: do the bind! - $login = $this->ldap->bind($cr, - $this->configuration->ldapAgentName, - $this->configuration->ldapAgentPassword); + \OCP\Util::writeLog('user_ldap', 'Wiz: Attemping to Bind ', \OCP\Util::DEBUG); + //interesting part: do the bind! + $login = $this->ldap->bind($cr, + $this->configuration->ldapAgentName, + $this->configuration->ldapAgentPassword + ); + $errNo = $this->ldap->errno($cr); + $error = ldap_error($cr); + $this->ldap->unbind($cr); + } catch(ServerNotAvailableException $e) { + return false; + } if($login === true) { $this->ldap->unbind($cr); @@ -1087,9 +1098,6 @@ class Wizard extends LDAPUtility { return true; } - $errNo = $this->ldap->errno($cr); - $error = ldap_error($cr); - $this->ldap->unbind($cr); if($errNo === -1 || ($errNo === 2 && $ncc)) { //host, port or TLS wrong return false; |