function LdapServer::ldapQuery in Lightweight Directory Access Protocol (LDAP) 8.2
Same name and namespace in other branches
- 7.2 ldap_servers/LdapServer.class.php \LdapServer::ldapQuery()
- 7 ldap_servers/LdapServer.class.php \LdapServer::ldapQuery()
execute ldap query and return ldap records
@params see pagedLdapQuery $params
Parameters
scope:
Return value
array of ldap entries
3 calls to LdapServer::ldapQuery()
- LdapServer::dnExists in ldap_servers/
LdapServer.class.php - does dn exist for this server? [ ] Finished [ ] Test Coverage. Test ID: [ ] Case insensitive
- LdapServer::pagedLdapQuery in ldap_servers/
LdapServer.class.php - execute a paged ldap query and return entries as one aggregated array
- LdapServer::search in ldap_servers/
LdapServer.class.php - Perform an LDAP search.
File
- ldap_servers/
LdapServer.class.php, line 841 - Defines server classes and related functions.
Class
- LdapServer
- LDAP Server Class
Code
function ldapQuery($scope, $params) {
$this
->connectAndBindIfNotAlready();
switch ($scope) {
case LDAP_SCOPE_SUBTREE:
$result = @ldap_search($this->connection, $params['base_dn'], $params['filter'], $params['attributes'], $params['attrsonly'], $params['sizelimit'], $params['timelimit'], $params['deref']);
if ($params['sizelimit'] && $this
->ldapErrorNumber() == LDAP_SIZELIMIT_EXCEEDED) {
// false positive error thrown. do not return result limit error when $sizelimit specified
}
elseif ($this
->hasError()) {
watchdog('ldap_server', 'ldap_search() function error. LDAP Error: %message, ldap_search() parameters: %query', array(
'%message' => $this
->errorMsg('ldap'),
'%query' => $params['query_display'],
), WATCHDOG_ERROR);
}
break;
case LDAP_SCOPE_BASE:
$result = @ldap_read($this->connection, $params['base_dn'], $params['filter'], $params['attributes'], $params['attrsonly'], $params['sizelimit'], $params['timelimit'], $params['deref']);
if ($params['sizelimit'] && $this
->ldapErrorNumber() == LDAP_SIZELIMIT_EXCEEDED) {
// false positive error thrown. do not result limit error when $sizelimit specified
}
elseif ($this
->hasError()) {
watchdog('ldap_server', 'ldap_read() function error. LDAP Error: %message, ldap_read() parameters: %query', array(
'%message' => $this
->errorMsg('ldap'),
'%query' => @$params['query_display'],
), WATCHDOG_ERROR);
}
break;
case LDAP_SCOPE_ONELEVEL:
$result = @ldap_list($this->connection, $params['base_dn'], $params['filter'], $params['attributes'], $params['attrsonly'], $params['sizelimit'], $params['timelimit'], $params['deref']);
if ($params['sizelimit'] && $this
->ldapErrorNumber() == LDAP_SIZELIMIT_EXCEEDED) {
// false positive error thrown. do not result limit error when $sizelimit specified
}
elseif ($this
->hasError()) {
watchdog('ldap_server', 'ldap_list() function error. LDAP Error: %message, ldap_list() parameters: %query', array(
'%message' => $this
->errorMsg('ldap'),
'%query' => $params['query_display'],
), WATCHDOG_ERROR);
}
break;
}
return $result;
}