Merge pull request #7717 from nextcloud/stable12-7662
[stable12] throw ServerNotAvailableException when LDAP is caught shutting down
This commit is contained in:
commit
116e4e415e
|
@ -63,8 +63,8 @@ class LDAP implements ILDAPWrapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param LDAP $link
|
* @param resource $link
|
||||||
* @param LDAP $result
|
* @param resource $result
|
||||||
* @param string $cookie
|
* @param string $cookie
|
||||||
* @return bool|LDAP
|
* @return bool|LDAP
|
||||||
*/
|
*/
|
||||||
|
@ -331,6 +331,8 @@ class LDAP implements ILDAPWrapper {
|
||||||
//referrals, we switch them off, but then there is AD :)
|
//referrals, we switch them off, but then there is AD :)
|
||||||
} else if ($errorCode === -1) {
|
} else if ($errorCode === -1) {
|
||||||
throw new ServerNotAvailableException('Lost connection to LDAP server.');
|
throw new ServerNotAvailableException('Lost connection to LDAP server.');
|
||||||
|
} else if ($errorCode === 52) {
|
||||||
|
throw new ServerNotAvailableException('LDAP server is shutting down.');
|
||||||
} else if ($errorCode === 48) {
|
} else if ($errorCode === 48) {
|
||||||
throw new \Exception('LDAP authentication method rejected', $errorCode);
|
throw new \Exception('LDAP authentication method rejected', $errorCode);
|
||||||
} else if ($errorCode === 1) {
|
} else if ($errorCode === 1) {
|
||||||
|
@ -339,11 +341,12 @@ class LDAP implements ILDAPWrapper {
|
||||||
ldap_get_option($this->curArgs[0], LDAP_OPT_ERROR_STRING, $extended_error);
|
ldap_get_option($this->curArgs[0], LDAP_OPT_ERROR_STRING, $extended_error);
|
||||||
throw new ConstraintViolationException(!empty($extended_error)?$extended_error:$errorMsg, $errorCode);
|
throw new ConstraintViolationException(!empty($extended_error)?$extended_error:$errorMsg, $errorCode);
|
||||||
} else {
|
} else {
|
||||||
\OCP\Util::writeLog('user_ldap',
|
\OC::$server->getLogger()->debug('LDAP error {message} ({code}) after calling {func}', [
|
||||||
'LDAP error '.$errorMsg.' (' .
|
'app' => 'user_ldap',
|
||||||
$errorCode.') after calling '.
|
'message' => $errorMsg,
|
||||||
$this->curFunc,
|
'code' => $errorCode,
|
||||||
\OCP\Util::DEBUG);
|
'func' => $this->curFunc,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue