slapi_search_internal()

Purpose

Issue a SEARCH request.

Format

#include <slapi-plugin.h>

Slapi_PBlock * slapi_search_internal (
	const char *							  base,
	int											       scope,
	const char *							  filter,
	LDAPControl **							controls,
	char **									     attrs,
	int											       attrsonly)

Parameters

Input:

base
The base DN for the search.
scope
The scope for the search must be:
  • LDAP_SCOPE_BASE
  • LDAP_SCOPE_ONELEVEL
  • LDAP_SCOPE_SUBTREE
filter
The filter for the search. The filter is set to (objectClass=*) if NULL is specified for this parameter.
controls
A NULL-terminated array of server controls for the SEARCH request. Specify NULL if there are no server controls. The pagedResults (OID 1.2.840.113556.1.4.319) server control is not supported on an internal SEARCH request.
attrs
A NULL-terminated array of attributes is returned for the search entries. Specify NULL if all attributes are returned. Note that operational attributes are returned only if they are explicitly listed in the attrs parameter.
attrsonly
Specify 1 if just the attribute types are to be returned or 0 if both attribute types and attribute values are to be returned.

Usage

The slapi_search_internal() routine issues a SEARCH request and returns the results to the plug-in for processing. The LDAP Version 3 protocol and the current client authentication are used for the SEARCH request. The request is unauthenticated if a client request is not being processed. Call the slapi_pblock_get() routine to obtain the search results from the returned parameter block. The following values can be retrieved from the parameter block:
  • SLAPI_PLUGIN_INTOP_RESULT - The result code from the result message
  • SLAPI_PLUGIN_INTOP_ERRMSG - The error message from the result message
  • SLAPI_PLUGIN_INTOP_MATCHED_DN - The matched DN from the result message
  • SLAPI_PLUGIN_INTOP_REFERRALS - The referrals from the result message
  • SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES - The search entries
  • SLAPI_PLUGIN_INTOP_SEARCH_REFERRALS - The search references

Related topics

The function return value is the address of the plug-in parameter block or NULL if the SEARCH request is not issued. Call the slapi_pblock_destroy() routine to release the plug-in parameter block when it is no longer needed. The errno variable is set to one of the following values when the function return value is NULL:
EINVAL
A parameter is not valid
EIO
Unable to process the SEARCH request
ENOMEM
Insufficient storage is available