Intro(3ldap)


Intro -- Lightweight Directory Access Protocol library functions

Synopsis

#include <lber.h> 
#include <ldap.h> 

Description

The Lightweight Directory Access Protocol (LDAP) provides TCP/IP access to the X.500 directory or to a stand-alone LDAP server. The SCO® LDAP package includes a stand-alone server in slapd(1Mldap), various LDAP clients, and an LDAP client library used to provide programming access to the LDAP protocol. This manual page gives an overview of the LDAP library routines.

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 libldap.so library.

The basic interaction is as follows. A connection is made to an LDAP server by calling ldap_init(3ldap). An LDAP bind operation is performed by calling one of the functions documented on the ldap_bind(3ldap) manual page. Next, other operations are performed by calling one of the synchronous or asynchronous routines (for example ldap_search_s(3ldap) or ldap_search(3ldap), followed by ldap_result(3ldap)). Results returned from these routines are interpreted by calling the LDAP parsing routines. The LDAP association is terminated by calling ldap_unbind(3ldap). Errors can be interpreted by calling ldap_perror(3ldap). The ldap_set_rebind_proc(3ldap) routine can be used to set a routine to be called back when an LDAP bind operation is needed when handling a client referral.

Displaying results

Results obtained from the LDAP search routines can be output by hand, by calling ldap_first_entry(3ldap) and ldap_next_entry(3ldap) to step through the entries returned, ldap_first_attribute(3ldap) and ldap_next_attribute(3ldap) to step through an entry's attributes, and ldap_get_values(3ldap) to retrieve a given attribute's value, and then calling one of the functions documented on the fprintf(3S) manual page to display the values.

Uniform Resource Locators (URLS)

The ldap_is_ldap_url(3ldap) routines can be used to 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.

Caching

The ldap_enable_cache(3ldap) 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_entries(3ldap) routines are used to sort the entries and values returned via the LDAP search routines. The ldap_friendly_name(3ldap) 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 (BER) routines. These routines are used by the LDAP library routines to encode and decode LDAP protocol elements using the (slightly simplified) Basic Encoding Rules defined by LDAP. They are not normally used directly by an LDAP application program. The routines provide a printf and scanf-like interface, as well as lower-level access. These routines are found in the liblber.so library.

References

slapd(1Mldap)

Configuring and administering LDAP

Standards compliance

The following lists classify the LDAP library functions by origin (Version 2, Version 3, and system extensions), giving compatibility information, where appropriate.
30 January 1998
© 1998 The Santa Cruz Operation, Inc. All rights reserved.