summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib/Connection.php
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2018-06-27 23:09:44 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2018-06-27 23:12:07 +0200
commit7a728f2154a1d0670b1f073315983b2969fafb07 (patch)
treed0d61cfb90f8f8eda810adfa4e6a9bbc18b013ae /apps/user_ldap/lib/Connection.php
parentad2ef3a81fd0dff07eaec63223829a17dd9c771f (diff)
downloadnextcloud-server-7a728f2154a1d0670b1f073315983b2969fafb07.tar.gz
nextcloud-server-7a728f2154a1d0670b1f073315983b2969fafb07.zip
LDAP backup server should not be queried when auth fails
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/lib/Connection.php')
-rw-r--r--apps/user_ldap/lib/Connection.php12
1 files changed, 4 insertions, 8 deletions
diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php
index e6a01a17d25..6140aa297b4 100644
--- a/apps/user_ldap/lib/Connection.php
+++ b/apps/user_ldap/lib/Connection.php
@@ -511,6 +511,8 @@ class Connection extends LDAPUtility {
/**
* Connects and Binds to LDAP
+ *
+ * @throws ServerNotAvailableException
*/
private function establishConnection() {
if(!$this->configuration->ldapConfigurationActive) {
@@ -557,18 +559,12 @@ class Connection extends LDAPUtility {
|| $this->getFromCache('overrideMainServer'));
$isBackupHost = (trim($this->configuration->ldapBackupHost) !== "");
$bindStatus = false;
- $error = -1;
try {
if (!$isOverrideMainServer) {
$this->doConnect($this->configuration->ldapHost,
$this->configuration->ldapPort);
- $bindStatus = $this->bind();
- $error = $this->ldap->isResource($this->ldapConnectionRes) ?
- $this->ldap->errno($this->ldapConnectionRes) : -1;
- }
- if($bindStatus === true) {
- return $bindStatus;
}
+ return $this->bind();
} catch (ServerNotAvailableException $e) {
if(!$isBackupHost) {
throw $e;
@@ -576,7 +572,7 @@ class Connection extends LDAPUtility {
}
//if LDAP server is not reachable, try the Backup (Replica!) Server
- if($isBackupHost && ($error !== 0 || $isOverrideMainServer)) {
+ if($isBackupHost || $isOverrideMainServer) {
$this->doConnect($this->configuration->ldapBackupHost,
$this->configuration->ldapBackupPort);
$this->bindResult = [];