O'Reilly logo

LDAP Programming with Java™ by Tony Dahbura, Rob Weltman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ); } /* ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required