fix server-size controls handling in back-{ldap,meta}

This commit is contained in:
Pierangelo Masarati 2002-08-29 15:07:18 +00:00
parent 7e2317c842
commit 58b860a15e
2 changed files with 33 additions and 13 deletions

View File

@ -75,7 +75,11 @@ ldap_back_bind(
}
if ( op->o_ctrls ) {
ldap_set_option( lc->ld, LDAP_OPT_SERVER_CONTROLS, op->o_ctrls );
if ( ldap_set_option( lc->ld, LDAP_OPT_SERVER_CONTROLS,
op->o_ctrls ) != LDAP_SUCCESS ) {
ldap_back_op_result( lc, op );
return( -1 );
}
}
/*
@ -355,16 +359,19 @@ ldap_back_getconn(struct ldapinfo *li, Connection *conn, Operation *op)
*/
int
ldap_back_dobind( struct ldapconn *lc, Operation *op )
{
{
if ( op->o_ctrls ) {
if ( ldap_set_option( lc->ld, LDAP_OPT_SERVER_CONTROLS,
op->o_ctrls ) != LDAP_SUCCESS ) {
ldap_back_op_result( lc, op );
return( 0 );
}
}
if ( lc->bound ) {
return( lc->bound );
}
if ( op->o_ctrls ) {
ldap_set_option( lc->ld, LDAP_OPT_SERVER_CONTROLS,
op->o_ctrls );
}
if ( ldap_bind_s( lc->ld, lc->bound_dn.bv_val, lc->cred.bv_val,
LDAP_AUTH_SIMPLE ) != LDAP_SUCCESS ) {
ldap_back_op_result( lc, op );

View File

@ -277,8 +277,12 @@ meta_back_do_single_bind(
}
if ( op->o_ctrls ) {
ldap_set_option( lc->conns[ candidate ].ld,
rc = ldap_set_option( lc->conns[ candidate ].ld,
LDAP_OPT_SERVER_CONTROLS, op->o_ctrls );
if ( rc != LDAP_SUCCESS ) {
rc = ldap_back_map_result( rc );
goto return_results;
}
}
rc = ldap_bind_s( lc->conns[ candidate ].ld, mdn.bv_val, cred->bv_val, method );
@ -295,6 +299,8 @@ meta_back_do_single_bind(
ndn, candidate );
}
}
return_results:;
if ( mdn.bv_val != dn->bv_val ) {
free( mdn.bv_val );
@ -329,6 +335,17 @@ meta_back_dobind( struct metaconn *lc, Operation *op )
continue;
}
/*
* If required, set controls
*/
if ( op->o_ctrls ) {
if ( ldap_set_option( lsc->ld, LDAP_OPT_SERVER_CONTROLS,
op->o_ctrls ) != LDAP_SUCCESS ) {
( void )meta_clear_one_candidate( lsc, 1 );
continue;
}
}
/*
* If the target is already bound it is skipped
*/
@ -348,11 +365,7 @@ meta_back_dobind( struct metaconn *lc, Operation *op )
lsc->bound_dn.bv_len = 0;
}
if ( op->o_ctrls ) {
ldap_set_option( lsc->ld, LDAP_OPT_SERVER_CONTROLS,
op->o_ctrls );
}
rc = ldap_bind_s( lsc->ld, 0, NULL, LDAP_AUTH_SIMPLE );
if ( rc != LDAP_SUCCESS ) {