diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2013-01-17 13:56:37 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2013-01-17 13:56:37 +0100 |
commit | d8be83029b107359884f9e23dd5bded71fea8999 (patch) | |
tree | d3adbd597824d194d5ad85865cbb749911afb8e2 /apps/user_ldap/lib | |
parent | 59a6068246c4012955e3b2b49e44426eedcc923b (diff) | |
download | nextcloud-server-d8be83029b107359884f9e23dd5bded71fea8999.tar.gz nextcloud-server-d8be83029b107359884f9e23dd5bded71fea8999.zip |
make sure port is used as backup port if not specified. documentation. determine connection error earlier.
Diffstat (limited to 'apps/user_ldap/lib')
-rw-r--r-- | apps/user_ldap/lib/connection.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/apps/user_ldap/lib/connection.php b/apps/user_ldap/lib/connection.php index 9eab692bef8..55234f4ac08 100644 --- a/apps/user_ldap/lib/connection.php +++ b/apps/user_ldap/lib/connection.php @@ -279,6 +279,10 @@ class Connection { \OCP\Config::setAppValue($this->configID, $this->configPrefix.'ldap_uuid_attribute', 'auto'); \OCP\Util::writeLog('user_ldap', 'Illegal value for the UUID Attribute, reset to autodetect.', \OCP\Util::INFO); } + if(empty($this->config['ldapBackupPort'])) { + //force default + $this->config['ldapBackupPort'] = $this->config['ldapPort']; + } //second step: critical checks. If left empty or filled wrong, set as unconfigured and give a warning. @@ -351,18 +355,22 @@ class Connection { if(!$this->config['ldapOverrideMainServer'] && !$this->getFromCache('overrideMainServer')) { $this->doConnect($this->config['ldapHost'], $this->config['ldapPort']); $bindStatus = $this->bind(); + $error = ldap_errno($this->ldapConnectionRes); } else { $bindStatus = false; + $error = null; } $error = null; //if LDAP server is not reachable, try the Backup (Replica!) Server - if((!$bindStatus && ($error = ldap_errno($this->ldapConnectionRes)) == -1) + if((!$bindStatus && ($error == -1)) || $this->config['ldapOverrideMainServer'] || $this->getFromCache('overrideMainServer')) { $this->doConnect($this->config['ldapBackupHost'], $this->config['ldapBackupPort']); $bindStatus = $this->bind(); 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); } } |