Many Roads to Rome

Directory SDK for C

The first SDK to provide client access to LDAP was developed for the C language at the University of Michigan. The API of this C SDK was formalized in RFC 1823. Netscape extended the C API to support all features of LDAPv3 and made the source code publicly available through Mozilla.org in 1998. The following is an example of a program written with the C SDK. The program performs a simple search for all people with the surname Jensen:

 #include "ldap.h" int main( int argc, char **argv ) { LDAP *ld; LDAPMessage *result, *e; BerElement *ber; char *a, *dn; char **vals; int i; /* get a handle to an LDAP connection */ if ( (ld = ldap_init("localhost", 389 )) == NULL ) { perror("ldap_init" ); return( 1 ); } /* ...

Get LDAP Programming with Java™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.