ldap_url_search

Uses the specified URL to perform an asynchronous search operation.

LDAP Version:v3
Library:*ldapsdk.*
NDS Version:7.xx or higher
Platform:NLM, Windows (NT, 95, 98, 2000, XP, Vista 32-bit and 64-bit ), Linux (32-bit and 64-bit), Solaris, AIX, and HP-UX

Syntax

  #include <ldap.h>
  
  int ldap_url_search (
     LDAP         *ld,
     const char   *url,
     int           attrsonly);
  
  

Parameters

ld

(IN) Points to the handle for the LDAP session.

url

(IN) Points to the URL to use in the search operation.

attrsonly

(IN) Specifies whether attribute values are returned with the specified attributes.

  • 0—return attributes and values

  • 1—return only attributes

Return Values

Returns the message ID of the search operation.

Remarks

To check the results of the operation, use the ldap_result or the ldap_result2error function.

Server timeouts and size limits for this function are set using the LDAP_OPT_TIMELIMIT and LDAP_OPT_SIZELIMIT options on the LDAP handle. This function has no client time or size limits.

An LDAP URL has the following format:

  ldap[s]://<hostname>:<port>/<base_dn>?<attributes>?<scope>? <filter>?<extensions>
  

ldap://

Specifies a clear-text connection.

ldaps://

Specifies an SSL connection.

<hostname>

Specifies the LDAP server.

<port>

Specifies the port number. Defaults to zero if unspecified. Port 0 causes the appropriate port (389 for clear-text and 636 for SSL) to be selected when the connection is made.

<base_dn>

Specifies the distinguished name of an entry in the directory where the search begins. Defaults to an empty string which starts the search at the top level of the directory.

<attributes>

Specifies a comma-separated list of attributes to return. If missing, all attributes are returned.

<scope>

Specifies the scope of the search:

  • base—search just base entry
  • one—search the immediate subordinates of the base entry
  • sub—search the entire subtree of the base entry

Defaults to base.

<filter>

Specifies a search filter. If empty, defaults to (objectclass=*).

<extensions>

Specifies a comma-separated list of extension in one of the following formats:

  • [!]type=value
  • [!]type

Extensions prefixed with "!" are considered critical extensions.

The following examples illustrate this URL format:

  • ldap://acme.com/ou=sales,o=acme?sn,telephoneNumber?sub? (objectclass=inetOrgPerson)?ext1=value1,ext2=value2

  • ldaps://1.2.3.4:636/o=novell??one

See Also

ldap_free_urldesc, ldap_url_search_s, ldap_url_search_st