LDAP Functions

Privilege Management for Unix and Linux LDAP support is based on the LDAP version 2 API, as defined in RFC 1823. Specific parts of the LDAP API are mapped to a series of Privilege Management for Unix and Linux functions.

The following table summarizes the Privilege Management for Unix and Linux LDAP functions.

Function Description
ldap_attributes() Returns the attributes that are associated with an LDAP entry.
ldap_bind() Binds an open LDAP connection to a user.
ldap_dn2ufn() Converts a DN to a user-friendly naming format.
ldap_entry_count() Returns the number of entries that are returned by an LDAP search.
ldap_explodedn() Returns the components of a DN in a list.
ldap_firstentry() Returns the first entry that is returned by a search.
ldap_getdn() Returns the DN of an LDAP entry.
ldap_getvalues() Returns values that are associated with an LDAP entry.
ldap_init()

Connects to an LDAP server.

Version 3.5 and earlier: function available.

Version 4.0 and later: function deprecated.

ldap_nextentry() Returns the next entry that is returned by a search.
ldap_open() Opens a connection to an LDAP server.
ldap_search() Opens a connection to an LDAP server.
ldap_search() Searches an LDAP tree.
ldap_unbind() Unbinds and disconnects a connection from an LDAP directory.

Perform an LDAP Search

The general process for performing an LDAP search is outlined below.

  1. Use the ldap_open() function to establish an LDAP server connection.
  2. Bind the LDAP server connection to the user by using the ldap_bind() function.
  3. Use the function ldap_search() to search an LDAP directory.
  4. Use the ldap_entry_count() function to determine the number of entries that were found by the query.
  5. Loop through the entries that were found by the query by using the ldap_firstentry() and ldap_ nextentry() functions.
  6. Use the function ldap_attributes() to obtain a list of attributes that are available for an entry.
  7. Use the ldap_getvalues() function to retrieve the actual attribute values that are associated with an entry.
  8. Process the next entry. Repeat steps 5 through 7 until all entries are processed.
  9. Use the function ldap_unbind() to unbind and close the LDAP Server connection.

For more information on using LDAP, refer to your LDAP documentation.