summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2018-01-02 19:57:11 +0100
committerGitHub <noreply@github.com>2018-01-02 19:57:11 +0100
commit194e955c8831124ce8b4a82b2b93cf820da7c74b (patch)
tree3411a725185fbd2fa47948b546d99b45f2905291
parent588b0085dd023932e15599713851251914d3a2b9 (diff)
parentc8851e24a848a4f93655f10dd3103e10ac678e9b (diff)
downloadnextcloud-server-194e955c8831124ce8b4a82b2b93cf820da7c74b.tar.gz
nextcloud-server-194e955c8831124ce8b4a82b2b93cf820da7c74b.zip
Merge pull request #7662 from nextcloud/ldap-shutdown
throw ServerNotAvailableException when LDAP is caught shutting down
-rw-r--r--apps/user_ldap/lib/LDAP.php17
1 files changed, 10 insertions, 7 deletions
diff --git a/apps/user_ldap/lib/LDAP.php b/apps/user_ldap/lib/LDAP.php
index eafd8eacd06..bdc2f204225 100644
--- a/apps/user_ldap/lib/LDAP.php
+++ b/apps/user_ldap/lib/LDAP.php
@@ -63,8 +63,8 @@ class LDAP implements ILDAPWrapper {
}
/**
- * @param LDAP $link
- * @param LDAP $result
+ * @param resource $link
+ * @param resource $result
* @param string $cookie
* @return bool|LDAP
*/
@@ -331,6 +331,8 @@ class LDAP implements ILDAPWrapper {
//referrals, we switch them off, but then there is AD :)
} else if ($errorCode === -1) {
throw new ServerNotAvailableException('Lost connection to LDAP server.');
+ } else if ($errorCode === 52) {
+ throw new ServerNotAvailableException('LDAP server is shutting down.');
} else if ($errorCode === 48) {
throw new \Exception('LDAP authentication method rejected', $errorCode);
} else if ($errorCode === 1) {
@@ -339,11 +341,12 @@ class LDAP implements ILDAPWrapper {
ldap_get_option($this->curArgs[0], LDAP_OPT_ERROR_STRING, $extended_error);
throw new ConstraintViolationException(!empty($extended_error)?$extended_error:$errorMsg, $errorCode);
} else {
- \OCP\Util::writeLog('user_ldap',
- 'LDAP error '.$errorMsg.' (' .
- $errorCode.') after calling '.
- $this->curFunc,
- \OCP\Util::DEBUG);
+ \OC::$server->getLogger()->debug('LDAP error {message} ({code}) after calling {func}', [
+ 'app' => 'user_ldap',
+ 'message' => $errorMsg,
+ 'code' => $errorCode,
+ 'func' => $this->curFunc,
+ ]);
}
}