ldap_init() and ldap_set_option(). (As an alternative, you can call ldapssl_init() instead of these three functions).
As is the case with the ldapssl_init() function, you need to call ldapssl_client_init() before calling this function.
#include <ldap_ssl.h>
int ldapssl_install_routines( LDAP *ld );
ld |
Connection handle, which is a pointer to an |
#include <ldap.h>
#include <ldap_ssl.h>
#include <stdio.h>
...
/* Initialize client, using mozilla's certificate database */
if ( ldapssl_client_init( "/u/mozilla/.netscape/cert5.db", NULL ) < 0) { printf( "Failed to initialize SSL client...\n" );
return( 1 );
}
/* Get the handle to an LDAP connection */
if ( (ld = ldap_init( MY_HOST, 6360 )) == NULL ) { perror( "ldap_init" );
return( 1 );
}
/* Load SSL routines */
if ( ldapssl_install_routines( ld ) != LDAP_SUCCESS ) { ldap_perror( ld, "ldapssl_install_routines" );
return( 1 );
}
/* Set the option to use SSL with the default connection */
if (ldap_set_option( ld, LDAP_OPT_SSL, LDAP_OPT_ON ) != LDAP_SUCCESS) {ldap_perror( ld, "ldap_set_option" );
return( 1 );
}
...
ldap_init(), ldapssl_init(), ldapssl_client_init().
Last Updated: 10/01/98 17:06:23