Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable12] throw ServerNotAvailableException when LDAP is caught shutting down #7717

Merged
merged 1 commit into from
Jan 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions apps/user_ldap/lib/LDAP.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public function connect($host, $port) {
}

/**
* @param LDAP $link
* @param LDAP $result
* @param resource $link
* @param resource $result
* @param string $cookie
* @return bool|LDAP
*/
Expand Down Expand Up @@ -331,6 +331,8 @@ private function processLDAPError($resource) {
//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) {
Expand All @@ -339,11 +341,12 @@ private function processLDAPError($resource) {
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,
]);
}
}

Expand Down