ldapssl_init() allocates an LDAP structure but does not open an initial connection.
Calling this function is equivalent to calling ldap_init() followed by ldapssl_install_routines() and ldap_set_option() to set the LDAP_OPT_SSL option to LDAP_OPT_ON.
Before calling this function, you should call the ldapssl_client_init() function to initialize your client for SSL. For details, see Chapter 12, "Connecting Over SSL".
#include <ldap_ssl.h>
LDAP *ldapssl_init( const char *defhost, int defport, int defsecure );
defhost | Connect to this LDAP server, if no other server is specified. |
defport | |
defsecure |
LDAP structure, which should be passed to subsequent calls to other LDAP API functions. #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 a handle to an LDAP connection */
if ( (ld = ldapssl_init( "cert.netscape.com", LDAPS_PORT, 1 )) == NULL { perror( "ldapssl_init" );
return( 1 );
}
...
/* Client can now perform LDAP operations on the secure LDAP server */
...
ldap_init(), ldapssl_client_init(), ldapssl_install_routines().
Last Updated: 10/01/98 17:06:23