function LdapServer::ldapQuery in Lightweight Directory Access Protocol (LDAP) 7
Same name and namespace in other branches
- 8.2 ldap_servers/LdapServer.class.php \LdapServer::ldapQuery()
- 7.2 ldap_servers/LdapServer.class.php \LdapServer::ldapQuery()
2 calls to LdapServer::ldapQuery()
- 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 486 - Defines server classes and related functions.
Class
- LdapServer
- LDAP Server Class
Code
function ldapQuery($scope, $params) {
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;
}