The following functions provide the most convenient interface to perform LDAP operations. All of them open a connection to a host, perform an operation (add/search/modify/delete) on one or several entries and cleanly close the connection thus insulating the user from all the details of the low-level interface such as LDAP Lisp objects see The Low-Level LDAP API.
Note that ldap-search which used to be the name of the high-level
search function in SXEmacs 22.1 is now obsolete. For consistency in the
naming as well as backward compatibility, that function now acts as a
wrapper that calls either ldap-search-basic (low-level search
function) or ldap-search-entries (high-level search function)
according to the actual parameters. A direct call to one of these two
functions is preferred since it is faster and unambiguous.
Perform an LDAP search. filter is the search filter see Syntax of Search Filters host is the LDAP host on which to perform the search. attributes is the specific attributes to retrieve,
nilmeans retrieve all. attrsonly if non-nilretrieves the attributes only without their associated values. If withdn is non-nileach entry in the result will be prepended with its distinguished name DN. Additional search parameters can be specified throughldap-host-parameters-alist. The function returns a list of matching entries. Each entry is itself an alist of attribute/value pairs optionally preceded by the DN of the entry according to the value of withdn.
Add entries to an LDAP directory. entries is a list of entry specifications of the form
(DN (ATTR . VALUE) (ATTR . VALUE) ...)where dn the distinguished name of an entry to add, the following are cons cells containing attribute/value string pairs. host is the LDAP host, defaulting toldap-default-host. binddn is the DN to bind as to the server. passwd is the corresponding password.
Modify entries of an LDAP directory. entry_mods is a list of entry modifications of the form
(DN MOD-SPEC1 MOD-SPEC2 ...)where dn is the distinguished name of the entry to modify, the following are modification specifications. A modification specification is itself a list of the form(MOD-OP ATTR VALUE1 VALUE2 ...)mod-op and attr are mandatory, values are optional depending on mod-op. mod-op is the type of modification, one of the symbolsadd,deleteorreplace. attr is the LDAP attribute type to modify. host is the LDAP host, defaulting toldap-default-host. binddn is the DN to bind as to the server. passwd is the corresponding password.
Delete an entry from an LDAP directory. dn is the distinguished name of an entry to delete or a list of those. host is the LDAP host, defaulting to
ldap-default-host. binddn is the DN to bind as to the server. passwd is the corresponding password.