Table of Contents | Previous | Next | Index

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

ldapssl_clientauth_init()

Initializes your client application to connect to a secure LDAP server over SSL and to use certificate-based client authentication.

Syntax

#include <ldap_ssl.h>
int ldapssl_clientauth_init( char *certdbpath, void *certdbhandle,
   int needkeydb, char *keydbpath, void *keydbhandle );

Parameters

This function has the following parameters:

certdbpath

Path to the database containing certificates for your client. The database must be the cert7.db certificate database used by Netscape Communicator 4.x.

You can either specify the path to the directory containing the certificate database (in which case the function assumes that the database file is named cert7.db) or you can include the database filename in the path.

If you pass NULL for this parameter, the function looks for the certificate database used by Netscape Communicator (for example, ~/.netscape/cert7.db on UNIX).

certdbhandle

Pass a NULL value for this. (This parameter is not used currently.)

needkeydb

Specifies whether or not the private key database needs to be opened for use. This parameter can have one of the following values:

keydbpath

Path to the database containing the private key certified by your certificate. The database must either be the key3.db certificate database used by Netscape Communicator 4.x.

You can either specify the path to the directory containing the private key database (in which case the function assumes that the database file is named key3.db) or you can include the database filename in the path.

If you pass NULL for this parameter, the function looks for the key database used by Netscape Communicator (for example, ~/.netscape/key3.db on UNIX).

certdbhandle

Pass a NULL value for this. (This parameter is not used currently.)

Returns

One of the following values:

Description

You can call the ldapssl_clientauth_init() function to initialize your client application for SSL and certificate-based client authentication.

If you need to specify the name and path of the security modules database or if you need to specify how the server's certificate will be verified, you should call the ldapssl_advclientauth_init() function instead of this function.

You must call this function before calling the ldapssl_init() function to connect to the server. For details, see Chapter 12, "Connecting Over SSL".

Example

The following example initializes a client before connecting with a secure LDAP server.

#include <ldap.h>
#include <ldap_ssl.h>
#include <stdio.h>
...
/* Initialize client, using mozilla's certificate database */
if ( ldapssl_clientauth_init( "/u/mozilla/.netscape/cert7.db", NULL, 1, 
   "/u/mozilla/.netscape/key3.db", NULL ) < 0 ) {
   perror( "ldap_clientauth_init" );
      return( 1 );
   }
} 
...

See Also

ldap_init(), ldapssl_clientauth_init(), ldapssl_init(), ldapssl_install_routines().


Table of Contents | Previous | Next | Index

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