Skip to content
Snippets Groups Projects
Commit 5735c204 authored by Olav Morken's avatar Olav Morken
Browse files

SimpleSAML_Auth_LDAP: Also include the cause in exceptions.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2919 44740490-163a-0410-bde0-09ae8108e29a
parent 9f09eabf
No related branches found
No related tags found
No related merge requests found
......@@ -141,18 +141,21 @@ class SimpleSAML_Auth_LDAP {
return new SimpleSAML_Error_AuthSource('ldap', $description);
}
}else{
if ($errNo !== 0) {
$description .= '; cause: \'' . ldap_error($this->ldap) . '\' (0x' . dechex($errNo) . ')';
}
switch ($errNo){
case 0x20://LDAP_NO_SUCH_OBJECT
SimpleSAML_Logger::warning($description . '; cause: \'' . ldap_error($this->ldap) . '\' (0x' . dechex($errNo) . ')');
SimpleSAML_Logger::warning($description);
return new SimpleSAML_Error_UserNotFound($description, $errNo);
case 0x31://LDAP_INVALID_CREDENTIALS
SimpleSAML_Logger::info($description . '; cause: \'' . ldap_error($this->ldap) . '\' (0x' . dechex($errNo) . ')');
SimpleSAML_Logger::info($description);
return new SimpleSAML_Error_InvalidCredential($description, $errNo);
case -1://NO_SERVER_CONNECTION
SimpleSAML_Logger::error($description . '; cause: \'' . ldap_error($this->ldap) . '\' (0x' . dechex($errNo) . ')');
SimpleSAML_Logger::error($description);
return new SimpleSAML_Error_AuthSource('ldap', $description);
default:
SimpleSAML_Logger::error($description . '; cause: \'' . ldap_error($this->ldap) . '\' (0x' . dechex($errNo) . ')');
SimpleSAML_Logger::error($description);
return new SimpleSAML_Error_AuthSource('ldap', $description);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment