From bfa715768a22430273db956a14ed1a3cb964c743 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Sat, 25 May 2013 11:02:51 +0200 Subject: [PATCH] LDAP: fix handling when LDAP Host is offline --- apps/user_ldap/lib/connection.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/user_ldap/lib/connection.php b/apps/user_ldap/lib/connection.php index ba4de135341..8a61775a6f2 100644 --- a/apps/user_ldap/lib/connection.php +++ b/apps/user_ldap/lib/connection.php @@ -601,14 +601,13 @@ class Connection { $error = null; } - $error = null; //if LDAP server is not reachable, try the Backup (Replica!) Server - if((!$bindStatus && ($error === -1)) + if((!$bindStatus && ($error !== 0)) || $this->config['ldapOverrideMainServer'] || $this->getFromCache('overrideMainServer')) { $this->doConnect($this->config['ldapBackupHost'], $this->config['ldapBackupPort']); $bindStatus = $this->bind(); - if($bindStatus && $error === -1) { + if(!$bindStatus && $error === -1) { //when bind to backup server succeeded and failed to main server, //skip contacting him until next cache refresh $this->writeToCache('overrideMainServer', true); -- 2.39.5