LDAP: fix handling when LDAP Host is offline

This commit is contained in:
Arthur Schiwon 2013-05-25 11:02:51 +02:00
parent 698862519d
commit bfa715768a
1 changed files with 2 additions and 3 deletions

View 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);