summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorblizzz <blizzz@owncloud.com>2013-05-31 11:10:33 -0700
committerblizzz <blizzz@owncloud.com>2013-05-31 11:10:33 -0700
commiteafb241068c9d2ca591e37580722101ea548ef88 (patch)
tree2cec23e0828df2b79cb408e3f6a5e2064fbb79bc /apps
parent35e83f8fedfe9ca33b2464760eae1d0ccdd5902a (diff)
parent86d72b9a61f5e8a9b57c6f0bb431eb6722aa12a3 (diff)
downloadnextcloud-server-eafb241068c9d2ca591e37580722101ea548ef88.tar.gz
nextcloud-server-eafb241068c9d2ca591e37580722101ea548ef88.zip
Merge pull request #3562 from owncloud/fix_ldap_offline_host_handling
Fix ldap offline host handling
Diffstat (limited to 'apps')
-rw-r--r--apps/user_ldap/lib/connection.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/apps/user_ldap/lib/connection.php b/apps/user_ldap/lib/connection.php
index ba4de135341..409f3758792 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);
@@ -636,10 +635,17 @@ class Connection {
* Binds to LDAP
*/
public function bind() {
+ static $getConnectionResourceAttempt = false;
if(!$this->config['ldapConfigurationActive']) {
return false;
}
+ if($getConnectionResourceAttempt) {
+ $getConnectionResourceAttempt = false;
+ return false;
+ }
+ $getConnectionResourceAttempt = true;
$cr = $this->getConnectionResource();
+ $getConnectionResourceAttempt = false;
if(!is_resource($cr)) {
return false;
}