From 43c00ab4863909950575ca171ac515fe4e9c7c50 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sat, 15 Sep 2007 18:03:55 +0000 Subject: [PATCH] fix previous commit --- servers/slapd/back-ldap/bind.c | 11 ++++++++--- servers/slapd/back-meta/bind.c | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/servers/slapd/back-ldap/bind.c b/servers/slapd/back-ldap/bind.c index b4f78560a7..2afe5f11df 100644 --- a/servers/slapd/back-ldap/bind.c +++ b/servers/slapd/back-ldap/bind.c @@ -2540,6 +2540,8 @@ ldap_back_controls_add( goto done; } + /* put controls that go __before__ existing ones here */ + /* proxyAuthz for identity assertion */ switch ( ldap_back_proxy_authz_ctrl( op, rs, &lc->lc_bound_ndn, li->li_version, &li->li_idassert, &c[ j1 ] ) ) @@ -2555,6 +2557,8 @@ ldap_back_controls_add( goto done; } + /* put controls that go __after__ existing ones here */ + #ifdef SLAP_CONTROL_X_SESSION_TRACKING /* FIXME: according to , * the server should check if the control can be added @@ -2580,12 +2584,13 @@ ldap_back_controls_add( rs->sr_err = LDAP_SUCCESS; } - assert( j1 + j1 <= sizeof( c )/sizeof(LDAPControl) ); - + /* if nothing to do, just bail out */ if ( j1 == 0 && j2 == 0 ) { goto done; } + assert( j1 + j1 <= sizeof( c )/sizeof(LDAPControl) ); + if ( op->o_ctrls ) { for ( n = 0; op->o_ctrls[ n ]; n++ ) /* just count ctrls */ ; @@ -2609,8 +2614,8 @@ ldap_back_controls_add( } } + n += j1; if ( j2 ) { - n += j1; ctrls[ n ] = (LDAPControl *)&ctrls[ n + j2 + 1 ] + j1; *ctrls[ n ] = c[ j1 ]; for ( i = 1; i < j2; i++ ) { diff --git a/servers/slapd/back-meta/bind.c b/servers/slapd/back-meta/bind.c index 340d312861..9b7d7c5405 100644 --- a/servers/slapd/back-meta/bind.c +++ b/servers/slapd/back-meta/bind.c @@ -1602,6 +1602,8 @@ meta_back_controls_add( goto done; } + /* put controls that go __before__ existing ones here */ + /* proxyAuthz for identity assertion */ switch ( ldap_back_proxy_authz_ctrl( op, rs, &msc->msc_bound_ndn, mt->mt_version, &mt->mt_idassert, &c[ j1 ] ) ) @@ -1617,6 +1619,8 @@ meta_back_controls_add( goto done; } + /* put controls that go __after__ existing ones here */ + #ifdef SLAP_CONTROL_X_SESSION_TRACKING /* session tracking */ if ( META_BACK_TGT_ST_REQUEST( mt ) ) { @@ -1638,12 +1642,13 @@ meta_back_controls_add( rs->sr_err = LDAP_SUCCESS; } - assert( j1 + j1 <= sizeof( c )/sizeof(LDAPControl) ); - + /* if nothing to do, just bail out */ if ( j1 == 0 && j2 == 0 ) { goto done; } + assert( j1 + j1 <= sizeof( c )/sizeof(LDAPControl) ); + if ( op->o_ctrls ) { for ( n = 0; op->o_ctrls[ n ]; n++ ) /* just count ctrls */ ; @@ -1667,8 +1672,8 @@ meta_back_controls_add( } } + n += j1; if ( j2 ) { - n += j1; ctrls[ n ] = (LDAPControl *)&ctrls[ n + j2 + 1 ] + j1; *ctrls[ n ] = c[ j1 ]; for ( i = 1; i < j2; i++ ) { -- 2.39.5