]> source.dussan.org Git - nextcloud-server.git/commitdiff
LDAP: fix handling when LDAP Host is offline
authorArthur Schiwon <blizzz@owncloud.com>
Sat, 25 May 2013 09:02:51 +0000 (11:02 +0200)
committerArthur Schiwon <blizzz@owncloud.com>
Sat, 25 May 2013 09:02:51 +0000 (11:02 +0200)
apps/user_ldap/lib/connection.php

index ba4de1353412dbb6756a74f9de54d2cefaf4ea03..8a61775a6f2315ef14b6a86c9aa9d9ae66d88054 100644 (file)
@@ -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);