Netscape DIRECTORY SERVER 6.1 - PLUG-IN Manual page 109

Table of Contents

Advertisement

Code Example 8-3
if ( ldap_sasl_bind_s( ld,
"uid=bjensen,ou=people,o=example.com", "babsmechanism", &cred,
NULL, NULL, &servcred ) != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_sasl_bind_s" );
return( 1 );
}
/* get and print the credentials returned by the server */
printf( "Server credentials: %s\n", servcred->bv_val );
/* construct the list of modifications to make */
mod0.mod_op = LDAP_MOD_REPLACE;
mod0.mod_type = "mail";
vals0[0] = "babs@example.com";
vals0[1] = NULL;
mod0.mod_values = vals0;
mod1.mod_op = LDAP_MOD_ADD;
mod1.mod_type = "description";
time( &now );
sprintf( buf, "This entry was modified with the modattrs
program on %s",
ctime( &now ));
/* Get rid of \n which ctime put on the end of the time string
*/
if ( buf[ strlen( buf ) - 1 ] == '\n' ) {
buf[ strlen( buf ) - 1 ] = '\0';
}
vals1[ 0 ] = buf;
vals1[ 1 ] = NULL;
mod1.mod_values = vals1;
mods[ 0 ] = &mod0;
mods[ 1 ] = &mod1;
mods[ 2 ] = NULL;
/* make the change */
if ( ldap_modify_s( ld, "uid=bjensen,ou=people,o=example.com",
mods )
!= LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_modify_s" );
return( 1 );
}
ldap_unbind( ld );
printf( "modification was successful\n" );
return( 0 );
}
LDAP Client Authenticating Using SASL Method (Continued)
Chapter 8
Using SASL with an LDAP Client
Defining Functions for Authentication
109

Advertisement

Table of Contents
loading

This manual is also suitable for:

Directory server 6.1

Table of Contents