Table of Contents | Previous | Next | Index

Netscape Directory SDK 3.0 for C Programmer’s Guide
     Chapter 18 Functions

ldapssl_install_routines()

Installs the I/O routines to enable SSL over LDAP. You need to call this routine in combination with 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.

Syntax

#include <ldap_ssl.h>
int ldapssl_install_routines( LDAP *ld );

Parameters

This function has the following parameters:

ld

Connection handle, which is a pointer to an LDAP structure containing information about the connection to the LDAP server.

Returns

One of the following values:

Example

The following example connects your client with a secure LDAP server.

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

See Also

ldap_init(), ldapssl_init(), ldapssl_client_init().


Table of Contents | Previous | Next | Index

Last Updated: 10/01/98 17:06:23