fix wrong response tags (ITS4182; consequence of fixing ITS#4173)

This commit is contained in:
Pierangelo Masarati 2005-11-17 23:52:56 +00:00
parent 79ef5e812f
commit 429a6f5353
3 changed files with 24 additions and 6 deletions

View File

@ -201,6 +201,15 @@ static int translucent_delete(Operation *op, SlapReply *rs) {
return(SLAP_CB_CONTINUE);
}
static int
translucent_tag_cb( Operation *op, SlapReply *rs )
{
op->o_tag = (ber_tag_t)op->o_callback->sc_private;
rs->sr_tag = slap_req2res( op->o_tag );
return SLAP_CB_CONTINUE;
}
/*
** translucent_modify()
** modify in local backend if exists in both;
@ -220,6 +229,7 @@ static int translucent_modify(Operation *op, SlapReply *rs) {
Attribute *a, *ax;
Modifications *m, *mm;
int del, rc, erc = 0;
slap_callback cb = { 0 }, *save_cb;
Debug(LDAP_DEBUG_TRACE, "==> translucent_modify: %s\n",
op->o_req_dn.bv_val, 0, 0);
@ -376,7 +386,13 @@ release:
op->o_bd->bd_info = (BackendInfo *) on;
glue_parent(&nop);
save_cb = op->o_callback;
cb.sc_response = translucent_tag_cb;
cb.sc_private = (void *)LDAP_REQ_MODIFY;
cb.sc_next = nop.o_callback;
nop.o_callback = &cb;
rc = on->on_info->oi_orig->bi_op_add(&nop, &nrs);
nop.o_callback = save_cb;
free_attr_chain(a);
return(rc);

View File

@ -1057,7 +1057,7 @@ LDAP_SLAPD_F( void ) slap_timestamp(
LDAP_SLAPD_F( void ) slap_mods_opattrs(
Operation *op,
Modifications *mods,
Modifications **modsp,
int manage_ctxcsn );
/*
@ -1341,6 +1341,7 @@ LDAP_SLAPD_F (int) str2result LDAP_P(( char *s,
int *code, char **matched, char **info ));
LDAP_SLAPD_F (int) slap_map_api2result LDAP_P(( SlapReply *rs ));
LDAP_SLAPD_F (slap_mask_t) slap_attr_flags LDAP_P(( AttributeName *an ));
LDAP_SLAPD_F (ber_tag_t) slap_req2res LDAP_P(( ber_tag_t tag ));
LDAP_SLAPD_V( const struct berval ) slap_dummy_bv;

View File

@ -115,7 +115,8 @@ static char *v2ref( BerVarray ref, const char *text )
return v2;
}
static ber_tag_t req2res( ber_tag_t tag )
ber_tag_t
slap_req2res( ber_tag_t tag )
{
switch( tag ) {
case LDAP_REQ_ADD:
@ -503,7 +504,7 @@ send_ldap_disconnect( Operation *op, SlapReply *rs )
if ( op->o_protocol < LDAP_VERSION3 ) {
rs->sr_rspoid = NULL;
rs->sr_tag = req2res( op->o_tag );
rs->sr_tag = slap_req2res( op->o_tag );
rs->sr_msgid = (rs->sr_tag != LBER_SEQUENCE) ? op->o_msgid : 0;
} else {
@ -573,7 +574,7 @@ slap_send_ldap_result( Operation *op, SlapReply *rs )
rs->sr_ref = NULL;
}
rs->sr_tag = req2res( op->o_tag );
rs->sr_tag = slap_req2res( op->o_tag );
rs->sr_msgid = (rs->sr_tag != LBER_SEQUENCE) ? op->o_msgid : 0;
abandon:
@ -608,7 +609,7 @@ send_ldap_sasl( Operation *op, SlapReply *rs )
rs->sr_err,
rs->sr_sasldata ? (long) rs->sr_sasldata->bv_len : -1, NULL );
rs->sr_tag = req2res( op->o_tag );
rs->sr_tag = slap_req2res( op->o_tag );
rs->sr_msgid = (rs->sr_tag != LBER_SEQUENCE) ? op->o_msgid : 0;
if ( send_ldap_response( op, rs ) == SLAP_CB_CONTINUE ) {
@ -630,7 +631,7 @@ slap_send_ldap_extended( Operation *op, SlapReply *rs )
rs->sr_rspoid ? rs->sr_rspoid : "",
rs->sr_rspdata != NULL ? rs->sr_rspdata->bv_len : 0 );
rs->sr_tag = req2res( op->o_tag );
rs->sr_tag = slap_req2res( op->o_tag );
rs->sr_msgid = (rs->sr_tag != LBER_SEQUENCE) ? op->o_msgid : 0;
if ( send_ldap_response( op, rs ) == SLAP_CB_CONTINUE ) {