get extended LDAP error message

This commit is contained in:
Roland Gruber 2013-09-15 14:57:55 +00:00
parent 0554872b2f
commit 2740e4451a
1 changed files with 15 additions and 0 deletions

View File

@ -1118,4 +1118,19 @@ function getLDAPSSLCertificate($server, $port) {
return $finalPEM;
}
/**
* Returns the extended LDAP error message if any.
*
* @param handle $server LDAP server handle
* @return String error message
*/
function getExtendedLDAPErrorMessage($server) {
$ldapMsg = null;
ldap_get_option($server, LDAP_OPT_ERROR_STRING, $ldapMsg);
if (empty($ldapMsg)) {
return null;
}
return _('LDAP error, server says:') . ' ' . $ldapMsg;
}
?>