diff options
author | Côme Chilliet <91878298+come-nc@users.noreply.github.com> | 2022-11-24 18:20:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-24 18:20:36 +0100 |
commit | e00740ea38ebd4965797e8b7c63aac258405b3cc (patch) | |
tree | 5ade405b350c5080229e99adea57d4cec74f69e6 | |
parent | e04fcea6b698f5d0d95039f3e92beeeeb9cdf00c (diff) | |
parent | 90165309e1c0cf0be2f56aa3b4a438266801ba98 (diff) | |
download | nextcloud-server-e00740ea38ebd4965797e8b7c63aac258405b3cc.tar.gz nextcloud-server-e00740ea38ebd4965797e8b7c63aac258405b3cc.zip |
Merge pull request #35230 from nextcloud/fix/user_ldap-log-backup-switch
Log switching to LDAP backup host because main one is not available
-rw-r--r-- | apps/user_ldap/lib/Connection.php | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php index 89b58b7ebfd..82d0374c759 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 = []; } @@ -407,9 +407,8 @@ class Connection extends LDAPUtility { } else { $uuidAttributes = Access::UUID_ATTRIBUTES; array_unshift($uuidAttributes, 'auto'); - if (!in_array($this->configuration->$effectiveSetting, - $uuidAttributes) - && (!is_null($this->configID))) { + if (!in_array($this->configuration->$effectiveSetting, $uuidAttributes) + && !is_null($this->configID)) { $this->configuration->$effectiveSetting = 'auto'; $this->configuration->saveConfiguration(); $this->logger->info( @@ -606,12 +605,18 @@ class Connection extends LDAPUtility { if (!$isBackupHost) { throw $e; } + $this->logger->warning( + '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 +686,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), |