From: Pierangelo Masarati Date: Thu, 29 Aug 2002 15:07:18 +0000 (+0000) Subject: fix server-size controls handling in back-{ldap,meta} X-Git-Tag: NO_SLAP_OP_BLOCKS~1106 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=58b860a15ed8b61403b8f7be463f29e1d15a332b;p=openldap fix server-size controls handling in back-{ldap,meta} --- diff --git a/servers/slapd/back-ldap/bind.c b/servers/slapd/back-ldap/bind.c index 760b152c96..e65ea665a6 100644 --- a/servers/slapd/back-ldap/bind.c +++ b/servers/slapd/back-ldap/bind.c @@ -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 ); diff --git a/servers/slapd/back-meta/bind.c b/servers/slapd/back-meta/bind.c index b3c3f809a8..2a800c5c5c 100644 --- a/servers/slapd/back-meta/bind.c +++ b/servers/slapd/back-meta/bind.c @@ -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 ) {