ldap_search_ext --Asynchronously Search the Directory Using Controls



  Syntax
 #include <ldap.h>
 
 int ldap_search_ext(
       LDAP             *ld,
       const char       *base,
       int               scope,
       const char       *filter,
       char            **attrs,
       int               attrsonly,
       LDAPControl     **serverctrls,
       LDAPControl     **clientctrls,
       struct timeval   *timeout,
       int               sizelimit,
       int              *msgidp)


  Default Public Authority: *USE

  Library Name/Service Program: QSYS/QGLDCLNT

  Threadsafe: Yes

The ldap_search_ext() routine initiates an asynchronous search operation.


Authorities and Locks

No i5/OS authority is required. All authority checking is done by the LDAP server.


Parameters

ld
(Input) Specifies the LDAP pointer returned by a previous call to ldap_init(), ldap_ssl_init(), or ldap_open().
base
(Input) Specifies the DN of the entry at which to start the search.
scope
(Input) Specifies the scope of the search. It can be LDAP_SCOPE_BASE (to search the base object itself), or LDAP_SCOPE_ONELEVEL (to search the base object's immediate children), or LDAP_SCOPE_SUBTREE (to search the base object and all its descendents).
filter
(Input) Specifies a string representation of the filter to apply in the search. Simple filters can be specified as attributetype=attributevalue. More complex filters are specified using a prefix notation according to the following BNF:
      <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. The representation for <attributetype> and <attributevalue> are as described in RFC 2252, "Lightweight Directory Access Protocol (v3): Attribute Syntax Definitions." In addition, <attributevalue> can be a single * to achieve an attribute existence test, or can contain text and *'s interspersed to achieve substring matching.

For example, the filter "(mail=*)" will find any entries that have a mail attribute. The filter "(mail=*@student.of.life.edu)" will find any entries that have a mail attribute ending in the specified string.

More complex filters are created using the & and | operators. For example, the filter "(&(objectclass=person)(mail=*))" will find any entries that have an objectclass of person and a mail attribute. To put parentheses or asterisks in a filter, escape them with a backslash '\' character. See RFC 2254, "A String Representation of LDAP Search Filters," for a more complete description of allowable filters.

attrs
(Input) Specifies a null-terminated array of character string attribute types to return from entries that match filter. If NULL is specified, all attributes will be returned.
attrsonly
(Input) Specifies attribute information. Attrsonly should be set to 1 to request attribute types only. Set to 0 to request both attributes types and attribute values.
serverctrls
(Input) Specifies a list of LDAP server controls. This parameter may be set to null. See LDAP Controls for more information about server controls.
clientctrls
(Input) Specifies a list of LDAP client controls. This parameter may be set to null. See LDAP Controls for more information about client controls.
sizelimit
(Input) Specifies the maximum number of entries to return. Note that the server may set a lower limit which is enforced at the server.
timeout
(Input) The local search timeout value and the operation time limit that is sent to the server within the search request.
msgidp
(Output) This result parameter is set to the message id of the request if the ldap_search_ext() call succeeds.

Return Value

Message ID of the Operation Initiated
if the request was successful. A subsequent call to ldap_result() can be used to obtain the result.

another LDAP error code
if the request was not successful.

Error Conditions

If ldap_search_ext() is not successful, an error code will be returned. See LDAP Client API Error Conditions for possible LDAP error codes.


Error Messages

The following message may be sent from this function.

Message ID Error Message Text
CPF3CF2 E Error(s) occurred during running of ldap_search_ext API.


Related Information

The ldap_search_ext() API supports LDAP V3 server controls, client controls, and allow varying size and time limits to be easily specified for each search operation.



API introduced: V4R5
Top | LDAP APIs | APIs by category