From 7c8cec808ff0fe83995551b2f656771012147898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Fri, 13 Jul 2018 08:25:02 +0200 Subject: [PATCH 1/2] Only bind if configuration for the first server is available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/user_ldap/lib/Connection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php index 039e46aeef..8bbe034585 100644 --- a/apps/user_ldap/lib/Connection.php +++ b/apps/user_ldap/lib/Connection.php @@ -564,8 +564,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; From 9f9f1d8cb073bf8ad7edd0853244e91493834c09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Fri, 13 Jul 2018 09:16:57 +0200 Subject: [PATCH 2/2] Fix tests for backup ldap server connection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/user_ldap/tests/ConnectionTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/user_ldap/tests/ConnectionTest.php b/apps/user_ldap/tests/ConnectionTest.php index c6c1fe1192..7a5da72fcd 100644 --- a/apps/user_ldap/tests/ConnectionTest.php +++ b/apps/user_ldap/tests/ConnectionTest.php @@ -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));