diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-11-17 14:58:44 +0100 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-11-17 14:58:44 +0100 |
commit | 3e15ea6cd043218ec27780c39b869e4dac163682 (patch) | |
tree | 752d30b3cf59c1a92ee4069d14ecf0256c33291a /apps/user_ldap | |
parent | 301af07e2f4cb506512899b7b4783db8b7975ee9 (diff) | |
download | nextcloud-server-3e15ea6cd043218ec27780c39b869e4dac163682.tar.gz nextcloud-server-3e15ea6cd043218ec27780c39b869e4dac163682.zip |
Log switching to LDAP backup host because main one is not available
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/user_ldap')
-rw-r--r-- | apps/user_ldap/lib/Connection.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php index 89b58b7ebfd..1d504675e09 100644 --- a/apps/user_ldap/lib/Connection.php +++ b/apps/user_ldap/lib/Connection.php @@ -167,7 +167,7 @@ class Connection extends LDAPUtility { */ public function __clone() { $this->configuration = new Configuration($this->configPrefix, - !is_null($this->configID)); + !is_null($this->configID)); if (count($this->bindResult) !== 0 && $this->bindResult['result'] === true) { $this->bindResult = []; } @@ -408,7 +408,7 @@ class Connection extends LDAPUtility { $uuidAttributes = Access::UUID_ATTRIBUTES; array_unshift($uuidAttributes, 'auto'); if (!in_array($this->configuration->$effectiveSetting, - $uuidAttributes) + $uuidAttributes) && (!is_null($this->configID))) { $this->configuration->$effectiveSetting = 'auto'; $this->configuration->saveConfiguration(); @@ -606,12 +606,18 @@ class Connection extends LDAPUtility { if (!$isBackupHost) { throw $e; } + $this->logger->info( + 'Main LDAP not reachable, connecting to backup', + [ + 'app' => 'user_ldap' + ] + ); } //if LDAP server is not reachable, try the Backup (Replica!) Server if ($isBackupHost || $isOverrideMainServer) { $this->doConnect($this->configuration->ldapBackupHost, - $this->configuration->ldapBackupPort); + $this->configuration->ldapBackupPort); $this->bindResult = []; $bindStatus = $this->bind(); $error = $this->ldap->isResource($this->ldapConnectionRes) ? @@ -681,8 +687,8 @@ class Connection extends LDAPUtility { } $ldapLogin = @$this->ldap->bind($cr, - $this->configuration->ldapAgentName, - $this->configuration->ldapAgentPassword); + $this->configuration->ldapAgentName, + $this->configuration->ldapAgentPassword); $this->bindResult = [ 'sum' => md5($this->configuration->ldapAgentName . $this->configPrefix . $this->configuration->ldapAgentPassword), |