LDAP: check if search was successful (fixes a PHP warning), provide meaningful log output

This commit is contained in:
Arthur Schiwon 2012-11-09 22:53:56 +01:00
parent b3245ac327
commit 2d110f25f7
1 changed files with 6 additions and 0 deletions

View File

@ -516,6 +516,12 @@ abstract class Access {
$link_resource = $this->connection->getConnectionResource();
if(is_resource($link_resource)) {
$sr = ldap_search($link_resource, $base, $filter, $attr);
if(!is_resource($sr)) {
$errmsg = '('.ldap_errno($link_resource).') ' . ldap_error($link_resource);
$errmsg .= ', search filter: ' . $filter;
\OCP\Util::writeLog('user_ldap', 'Search: no result resource, LDAP error message: ' . $errmsg, \OCP\Util::ERROR);
return array();
}
$findings = ldap_get_entries($link_resource, $sr );
// if we're here, probably no connection resource is returned.