mirror of https://github.com/nextcloud/server
Merge pull request #35230 from nextcloud/fix/user_ldap-log-backup-switch
Log switching to LDAP backup host because main one is not available
This commit is contained in:
commit
e00740ea38
|
@ -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),
|
||||
|
|
Loading…
Reference in New Issue