LDAP: fix handling when LDAP Host is offline
This commit is contained in:
parent
698862519d
commit
bfa715768a
|
@ -601,14 +601,13 @@ class Connection {
|
||||||
$error = null;
|
$error = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$error = null;
|
|
||||||
//if LDAP server is not reachable, try the Backup (Replica!) Server
|
//if LDAP server is not reachable, try the Backup (Replica!) Server
|
||||||
if((!$bindStatus && ($error === -1))
|
if((!$bindStatus && ($error !== 0))
|
||||||
|| $this->config['ldapOverrideMainServer']
|
|| $this->config['ldapOverrideMainServer']
|
||||||
|| $this->getFromCache('overrideMainServer')) {
|
|| $this->getFromCache('overrideMainServer')) {
|
||||||
$this->doConnect($this->config['ldapBackupHost'], $this->config['ldapBackupPort']);
|
$this->doConnect($this->config['ldapBackupHost'], $this->config['ldapBackupPort']);
|
||||||
$bindStatus = $this->bind();
|
$bindStatus = $this->bind();
|
||||||
if($bindStatus && $error === -1) {
|
if(!$bindStatus && $error === -1) {
|
||||||
//when bind to backup server succeeded and failed to main server,
|
//when bind to backup server succeeded and failed to main server,
|
||||||
//skip contacting him until next cache refresh
|
//skip contacting him until next cache refresh
|
||||||
$this->writeToCache('overrideMainServer', true);
|
$this->writeToCache('overrideMainServer', true);
|
||||||
|
|
Loading…
Reference in New Issue