MAN page from Mandrake Other ldap-devel-3.3-3.i386.rpm
LDAP_SEARCH
Section: C Library Functions (3)
Updated: 23 November 1994
Index NAME
ldap_search, ldap_search_s, ldap_search_st - Perform an LDAP search operation
SYNOPSIS
#include <sys/time.h> /* for struct timeval definition */#include <lber.h>#include <ldap.h>int ldap_search(ld, base, scope, filter, attrs, attrsonly)LDAP *ld;char *base;int scope;char *filter, *attrs[];int attrsonly;int ldap_search_s(ld, base, scope, filter, attrs, attrsonly, res)LDAP *ld;char *base;int scope;char *filter, *attrs[]int attrsonly;LDAPMessage **res;int ldap_search_st(ld, base, scope, filter, attrs, attrsonly, timeout, res)LDAP *ld;char *base;int scope;char *filter, *attrs[]int attrsonly;struct timeval *timeout;LDAPMessage **res;
DESCRIPTION
These routines are used to perform LDAP search operations.
ldap_search_s()does the search synchronously (i.e., notreturning until the operation completes).
ldap_search_st()doesthe same, but allows a
timeout to be specified.
ldap_search()is the asynchronous version, initiating the search and returningthe message id of the operation it initiated.
Base is the DN of the entry at which to start the search.
Scope is the scope of the search and should be one of LDAP_SCOPE_BASE,to search the object itself,LDAP_SCOPE_ONELEVEL, to search the object's immediate children,or LDAP_SCOPE_SUBTREE, to search the object and all its descendents.
Filter is a stringrepresentation of the filter to apply in the search. Simple filterscan be specified as attributetype=attributevalue. More complexfilters are specified using a prefix notation according to the followingBNF:
<filter> ::= '(' <filtercomp> ')' <filtercomp> ::= <and> | <or> | <not> | <simple> <and> ::= '&' <filterlist> <or> ::= '|' <filterlist> <not> ::= '!' <filter> <filterlist> ::= <filter> | <filter> <filterlist> <simple> ::= <attributetype> <filtertype> <attributevalue> <filtertype> ::= '=' | '~=' | '<=' | '>='The '~=' construct is used to specify approximate matching. Therepresentation for <attributetype> and <attributevalue> are asdescribed in RFC 1778. In addition, <attributevalue> can be a single *to achieve an attribute existence test, or can contain text and *'sinterspersed to achieve substring matching.
For example, the filter "mail=*" will find any entries that have a mailattribute. The filter "mail=*@terminator.rs.itd.umich.edu" will findany entries that have a mail attribute ending in the specified string.To put parentheses in a filter, escape them with a backslash '\'character. See RFC 1588 for a more complete description of allowablefilters. Seeldap_getfilter(3)for routines to help in constructing search filters automatically.
Attrs is a null-terminated array of attribute types to returnfrom entries that match filter. If NULL is specified, allattributes will be returned. Attrsonly should be set to 1 ifonly attribute types are wanted. It should be set to 0 if bothattributes types and attribute values are wanted.
ERRORS
ldap_search_s()and
ldap_search_st()will return the LDAP error code resulting from the search operation.See
ldap_error(3)for details.
ldap_search()returns -1 in case of trouble.
NOTES
Note that both readand list functionality are subsumed by these routines,by using a filter like "objectclass=*" and a scope of LDAP_SCOPE_BASE (toemulate read) or LDAP_SCOPE_ONELEVEL (to emulate list).
These routines may malloc memory. Return values are containedin <ldap.h>.
SEE ALSO
ldap(3),
ldap_result(3),
ldap_getfilter(3),
ldap_error(3)
Index
- NAME
- SYNOPSIS
- DESCRIPTION
- ERRORS
- NOTES
- SEE ALSO
This document was created byman2html,using the manual pages.