ldap - OpenLDAP Lightweight Directory Access Protocol API


SYNOPSIS

       #include <ldap.h>


DESCRIPTION

       The  Lightweight Directory Access Protocol provides access
       to  X.500  directory  services.   The  services   may   be
       stand-alone part of a distributed directory service.  This
       API supports LDAP over TCP, LDAP over SSL, and  LDAP  over
       IPC (UNIX domain sockets).

       The OpenLDAP LDAP package includes a stand-alone server in
       slapd(8), various LDAP clients, and an LDAP client library
       used  to provide programmatic access to the LDAP protocol.
       This man page gives an overview of the LDAP  library  rou­
       tines.

       Both synchronous and asynchronous APIs are provided.  Also
       included  are  various  routines  to  parse  the   results
       returned from these routines.  These routines are found in
       the -lldap library.

       The basic interaction is as  follows.   A  session  handle
       associated  with created using ldap_init(3).  The underly­
       ing session is established upon first use  which  is  com­
       monly  an LDAP bind operation.  The LDAP bind operation is
       performed by calling one of ldap_sasl_bind(3) and friends.
       Next, other operations are performed by calling one of the
       synchronous    or     asynchronous     routines     (e.g.,
       ldap_search_ext_s(3)  or  ldap_search_ext(3)  followed  by
       ldap_result(3)).  Results returned from these routines are
       interpreted  by  calling the LDAP parsing routines such as
       ldap_parse_result(3).  The LDAP association and underlying
       connection  is  terminated  by calling ldap_unbind_ext(3).
       Errors can be interpreted by calling ldap_err2string(3).


SEARCH FILTERS

       Search filters to be passed to the  ldap  search  routines
       can be constructed by hand, or by calling the ldap_getfil­
       ter(3) routines, which use the ldapgetfilter.conf(5)  file
       to turn a string (presumably that a user has typed) into a
       series of search filters.


DISPLAYING RESULTS

       Results obtained from the ldap search routines can be out­
       put   by   hand,   by   calling   ldap_first_entry(3)  and
       ldap_next_entry(3) to step through the  entries  returned,
       ldap_first_attribute(3) and ldap_next_attribute(3) to step
       through an entry's attributes, and  ldap_get_values(3)  to
       retrieve  a given attribute's value.  Attribute values may
       or may not be displayable.

       calling the ldap_entry2text(3), ldap_entry2text_search(3),
       ldap_entry2html(3), or ldap_entry2html_search(3) routines.
       These  routines look up the object class of the entry they
       are passed in the  ldaptemplates.conf(5)  file  to  decide
       which attributes to display and how to display them.  Out­
       put is handled via a routine passed in as a parameter.


UNIFORM RESOURCE LOCATORS (URLS)

       The ldap_url(3) routines can be used test a URL to see  if
       it is an LDAP URL, to parse LDAP URLs into their component
       pieces, and to initiate searches directly  using  an  LDAP
       URL.


USER FRIENDLY NAMING

       The  ldap_ufn(3) routines implement a user friendly naming
       scheme via LDAP.   This  scheme  allows  you  to  look  up
       entries using fuzzy, untyped names like "john smith, exam­
       ple corp, ca, us".


CACHING

       The  ldap_cache(3)  routines  implement  a  local   client
       caching   scheme,   providing  a  substantial  performance
       increase for repeated queries.


UTILITY ROUTINES

       Also  provided  are   various   utility   routines.    The
       ldap_sort(3)  routines  are  used  to sort the entries and
       values  returned  via  the  ldap  search  routines.    The
       ldap_friendly(3)  routines  are used to map from short two
       letter  country  codes  (or  other  strings)   to   longer
       "friendlier" names.


BER LIBRARY

       Also  included in the distribution is a set of lightweight
       Basic Encoding Rules routines.  These routines are used by
       the LDAP library routines to encode and decode LDAP proto­
       col elements using the (slightly simplified) Basic  Encod­
       ing  Rules  defined  by  LDAP.  They are not normally used
       directly by an LDAP application program excepting  in  the
       handling  of  controls  and extended operations.  The rou­
       tines provide a printf and scanf-like interface,  as  well
       as  lower-level  access.   These routines are found in the
       -llber library.


INDEX

       ldap_open(3)        open a connection to an LDAP server

       ldap_init(3)        initialize the  LDAP  library  without
                           opening a connection to a server

       ldap_result(3)      wait  for  the  result  from  an asyn­
                           chronous operation

                           tion

       ldap_add(3)         asynchronously add an entry

       ldap_add_s(3)       synchronously add an entry

       ldap_bind(3)        asynchronously bind to the directory

       ldap_bind_s(3)      synchronously bind to the directory

       ldap_simple_bind(3) asynchronously  bind  to the directory
                           using simple authentication

       ldap_simple_bind_s(3)
                           synchronously bind  to  the  directory
                           using simple authentication

       ldap_kerberos_bind_s(3)
                           synchronously  bind  to  the directory
                           using kerberos authentication

       ldap_kerberos_bind1(3)
                           asynchronously bind to the LDAP server
                           using kerberos authentication

       ldap_kerberos_bind1_s(3)
                           synchronously  bind to the LDAP server
                           using kerberos authentication

       ldap_kerberos_bind2(3)
                           asynchronously bind to the  DSA  using
                           kerberos authentication

       ldap_kerberos_bind2_s(3)
                           synchronously  bind  to  the DSA using
                           kerberos authentication

       ldap_unbind(3)      synchronously  unbind  from  the  LDAP
                           server and close the connection

       ldap_unbind_s(3)    equivalent to ldap_unbind(3)

       ldap_memfree (3)    dispose  of  memory  allocated by LDAP
                           routines.

       ldap_enable_cache(3)
                           enable LDAP client caching

       ldap_disable_cache(3)
                           disable LDAP client caching

       ldap_destroy_cache(3)
                           disable  LDAP   client   caching   and


       ldap_flush_cache(3) flush LDAP client cache

       ldap_uncache_entry(3)
                           uncache   requests  pertaining  to  an
                           entry

       ldap_uncache_request(3)
                           uncache a request

       ldap_set_cache_options(3)
                           set cache options

       ldap_compare(3)     asynchronous compare  to  a  directory
                           entry

       ldap_compare_s(3)   synchronous  compare  to  a  directory
                           entry

       ldap_delete(3)      asynchronously delete an entry

       ldap_delete_s(3)    synchronously delete an entry

       ldap_init_templates(3)
                           initialize display  template  routines
                           from a file

       ldap_init_templates_buf(3)
                           initialize  display  template routines
                           from a buffer

       ldap_free_templates(3)
                           free display template routine memory

       ldap_first_disptmpl(3)
                           get first display template

       ldap_next_disptmpl(3)
                           get next display template

       ldap_oc2template(3) return   template   appropriate    for
                           objectclass

       ldap_name2template(3)
                           return named template

       ldap_tmplattrs(3)   return attributes needed by template

       ldap_first_tmplrow(3)
                           return  first row of displayable items
                           in a template

                           return next row of  displayable  items
                           in a template

       ldap_first_tmplcol(3)
                           return  first  column  of  displayable
                           items in a template

       ldap_next_tmplcol(3)
                           return  next  column  of   displayable
                           items in a template

       ldap_entry2text(3)  display  an entry as text using a dis­
                           play template

       ldap_entry2text_search(3)
                           search for and  display  an  entry  as
                           text using a display template

       ldap_vals2text(3)   display values as text

       ldap_entry2html(3)  display  an  entry  as HTML (HyperText
                           Markup Language) using a display  tem­
                           plate

       ldap_entry2html_search(3)
                           search  for  and  display  an entry as
                           HTML using a display template

       ldap_vals2html(3)   display values as HTML

       ldap_perror(3)      print  an  LDAP  error  indication  to
                           standard error

       ld_errno(3)         LDAP error indication

       ldap_result2error(3)
                           extract  LDAP  error  indication  from
                           LDAP result

       ldap_errlist(3)     list of ldap errors and their meanings

       ldap_err2string(3)  convert  LDAP  error  indication  to a
                           string

       ldap_first_attribute(3)
                           return  first  attribute  name  in  an
                           entry

       ldap_next_attribute(3)
                           return next attribute name in an entry

       ldap_first_entry(3) return  first  entry  in  a  chain  of
                           search results

                           results

       ldap_count_entries(3)
                           return number of entries in  a  search
                           result

       ldap_friendly_name(3)
                           map from unfriendly to friendly names

       ldap_free_friendlymap(3)
                           free       resources      used      by
                           ldap_friendly(3)

       ldap_get_dn(3)      extract the DN from an entry

       ldap_explode_dn(3)  convert a DN into its component parts

       ldap_explode_rdn(3) convert a RDN into its component parts

       ldap_dn2ufn(3)      convert a DN into user friendly form

       ldap_get_values(3)  return an attribute's values

       ldap_get_values_len(3)
                           return   an   attribute   values  with
                           lengths

       ldap_value_free(3)  free memory allocated by ldap_get_val­
                           ues(3)

       ldap_value_free_len(3)
                           free memory allocated by ldap_get_val­
                           ues_len(3)

       ldap_count_values(3)
                           return number of values

       ldap_count_values_len(3)
                           return number of values

       ldap_init_getfilter(3)
                           initialize getfilter routines  from  a
                           file

       ldap_init_getfilter_buf(3)
                           initialize  getfilter  routines from a
                           buffer

       ldap_getfilter_free(3)
                           free    resources     allocated     by
                           ldap_init_getfilter(3)

                           return first search filter

       ldap_getnextfilter(3)
                           return next search filter

       ldap_build_filter(3)
                           construct an LDAP search filter from a
                           pattern

       ldap_setfilteraffixes(3)
                           set prefix and suffix for search  fil­
                           ters

       ldap_modify(3)      asynchronously modify an entry

       ldap_modify_s(3)    synchronously modify an entry

       ldap_mods_free(3)   free  array  of pointers to mod struc­
                           tures used by ldap_modify(3)

       ldap_modrdn2(3)     asynchronously modify the  RDN  of  an
                           entry

       ldap_modrdn2_s(3)   synchronously  modify  the  RDN  of an
                           entry

       ldap_modrdn(3)      depreciated - use ldap_modrdn2(3)

       ldap_modrdn_s(3)    depreciated - use ldap_modrdn2_s(3)

       ldap_msgfree(3)     free     results     allocated      by
                           ldap_result(3)

       ldap_msgtype(3)     return  the  message type of a message
                           from ldap_result(3)

       ldap_msgid(3)       return the message  id  of  a  message
                           from ldap_result(3)

       ldap_search(3)      asynchronously search the directory

       ldap_search_s(3)    synchronously search the directory

       ldap_search_st(3)   synchronously   search  the  directory
                           with timeout

       ldap_ufn_search_s(3)
                           user friendly search the directory

       ldap_ufn_search_c(3)
                           user  friendly  search  the  directory
                           with cancel

                           user  friendly  search  the  directory
                           with cancel and timeout

       ldap_ufn_setfilter(3)
                           set filter file  used  by  ldap_ufn(3)
                           routines

       ldap_ufn_setprefix(3)
                           set  prefix  used  by ldap_ufn(3) rou­
                           tines

       ldap_ufn_timeout(3) set timeout used by  ldap_ufn(3)  rou­
                           tines

       ldap_is_ldap_url(3) check  a URL string to see if it is an
                           LDAP URL

       ldap_url_parse(3)   break up an LDAP URL string  into  its
                           components

       ldap_url_search(3)  asynchronously  search  using  an LDAP
                           URL

       ldap_url_search_s(3)
                           synchronously search using an LDAP URL

       ldap_url_search_st(3)
                           synchronously search using an LDAP URL
                           and a timeout

       ldap_init_searchprefs(3)
                           initialize searchprefs routines from a
                           file

       ldap_init_searchprefs_buf(3)
                           initialize searchprefs routines from a
                           buffer

       ldap_free_searchprefs(3)
                           free memory allocated  by  searchprefs
                           routines

       ldap_first_searchobj(3)
                           return first searchpref object

       ldap_next_searchobj(3)
                           return next searchpref object

       ldap_sort_entries(3)
                           sort a list of search results

       ldap_sort_values(3) sort a list of attribute values

                           case insensitive string comparison


SEE ALSO

       slapd(8)


ACKNOWLEDGEMENTS

       OpenLDAP  is developed and maintained by The OpenLDAP Pro­
       ject (http://www.openldap.org/).  OpenLDAP is derived from
       University of Michigan LDAP 3.3 Release.


Man(1) output converted with man2html