]> source.dussan.org Git - nextcloud-server.git/commitdiff
Backport bfa7157
authorArthur Schiwon <blizzz@owncloud.com>
Sat, 25 May 2013 09:02:51 +0000 (11:02 +0200)
committerArthur Schiwon <blizzz@owncloud.com>
Fri, 31 May 2013 18:13:22 +0000 (20:13 +0200)
apps/user_ldap/lib/connection.php

index 7292ca15e78d1e5d24737353f138e4ba5fe0c605..24ee80fbbf8f0913c446e5cc536177c2eceaa3a4 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);