From 429a6f5353cdd2fa64098e88e6cec33227bf2bfa Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Thu, 17 Nov 2005 23:52:56 +0000 Subject: [PATCH] fix wrong response tags (ITS4182; consequence of fixing ITS#4173) --- servers/slapd/overlays/translucent.c | 16 ++++++++++++++++ servers/slapd/proto-slap.h | 3 ++- servers/slapd/result.c | 11 ++++++----- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/servers/slapd/overlays/translucent.c b/servers/slapd/overlays/translucent.c index 49f1ff0e67..13e37ff9be 100644 --- a/servers/slapd/overlays/translucent.c +++ b/servers/slapd/overlays/translucent.c @@ -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); diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index e8259a0959..14a7b8ea77 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -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; diff --git a/servers/slapd/result.c b/servers/slapd/result.c index a0feb62b87..52a67ea2f8 100644 --- a/servers/slapd/result.c +++ b/servers/slapd/result.c @@ -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 ) { -- 2.39.5