Merge pull request #10227 from nextcloud/bugfix/10160/ldap-bind-loop

Only bind to ldap if configuration for the first server is set
This commit is contained in:
Morris Jobke 2018-07-13 15:12:34 +02:00 committed by GitHub
commit 0343d59c65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -576,8 +576,8 @@ class Connection extends LDAPUtility {
if (!$isOverrideMainServer) {
$this->doConnect($this->configuration->ldapHost,
$this->configuration->ldapPort);
return $this->bind();
}
return $this->bind();
} catch (ServerNotAvailableException $e) {
if(!$isBackupHost) {
throw $e;

View File

@ -110,7 +110,7 @@ class ConnectionTest extends \Test\TestCase {
->method('setOption')
->will($this->returnValue(true));
$this->ldap->expects($this->exactly(2))
$this->ldap->expects($this->exactly(3))
->method('connect')
->will($this->returnValue('ldapResource'));
@ -119,7 +119,7 @@ class ConnectionTest extends \Test\TestCase {
->will($this->returnValue(0));
// Not called often enough? Then, the fallback to the backup server is broken.
$this->connection->expects($this->exactly(3))
$this->connection->expects($this->exactly(4))
->method('getFromCache')
->with('overrideMainServer')
->will($this->onConsecutiveCalls(false, false, true, true));