Skip to content

Commit 0343d59

Browse files
authored
Merge pull request #10227 from nextcloud/bugfix/10160/ldap-bind-loop
Only bind to ldap if configuration for the first server is set
2 parents f2b92c4 + 858bd67 commit 0343d59

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

apps/user_ldap/lib/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,8 @@ private function establishConnection() {
576576
if (!$isOverrideMainServer) {
577577
$this->doConnect($this->configuration->ldapHost,
578578
$this->configuration->ldapPort);
579+
return $this->bind();
579580
}
580-
return $this->bind();
581581
} catch (ServerNotAvailableException $e) {
582582
if(!$isBackupHost) {
583583
throw $e;

apps/user_ldap/tests/ConnectionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function testUseBackupServer() {
110110
->method('setOption')
111111
->will($this->returnValue(true));
112112

113-
$this->ldap->expects($this->exactly(2))
113+
$this->ldap->expects($this->exactly(3))
114114
->method('connect')
115115
->will($this->returnValue('ldapResource'));
116116

@@ -119,7 +119,7 @@ public function testUseBackupServer() {
119119
->will($this->returnValue(0));
120120

121121
// Not called often enough? Then, the fallback to the backup server is broken.
122-
$this->connection->expects($this->exactly(3))
122+
$this->connection->expects($this->exactly(4))
123123
->method('getFromCache')
124124
->with('overrideMainServer')
125125
->will($this->onConsecutiveCalls(false, false, true, true));

0 commit comments

Comments
 (0)