From 9467269cefa96db386774fddb7a2691a686df400 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Tue, 6 Feb 2007 04:19:56 +0000 Subject: [PATCH] ITS#4623, entry_get has to pass thru glue layer too --- servers/slapd/overlays/syncprov.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c index 05504a0d2e..e48f6e0250 100644 --- a/servers/slapd/overlays/syncprov.c +++ b/servers/slapd/overlays/syncprov.c @@ -404,6 +404,7 @@ syncprov_findbase( Operation *op, fbase_cookie *fc ) slap_callback cb = {0}; Operation fop; SlapReply frs = { REP_RESULT }; + BackendInfo *bi; int rc; fc->fss->s_flags ^= PS_FIND_BASE; @@ -415,6 +416,7 @@ syncprov_findbase( Operation *op, fbase_cookie *fc ) fop.o_bd = op->o_bd; fop.o_time = op->o_time; fop.o_tincr = op->o_tincr; + bi = op->o_bd->bd_info; cb.sc_response = findbase_cb; cb.sc_private = fc; @@ -432,9 +434,8 @@ syncprov_findbase( Operation *op, fbase_cookie *fc ) fop.ors_filter = &generic_filter; fop.ors_filterstr = generic_filterstr; - fop.o_bd->bd_info = on->on_info->oi_orig; - rc = fop.o_bd->be_search( &fop, &frs ); - fop.o_bd->bd_info = (BackendInfo *)on; + rc = overlay_op_walk( &fop, &frs, op_search, on->on_info, on ); + op->o_bd->bd_info = bi; } else { ldap_pvt_thread_mutex_unlock( &fc->fss->s_mutex ); fc->fbase = 1; @@ -839,7 +840,6 @@ syncprov_qplay( Operation *op, slap_overinst *on, syncops *so ) int rc = 0; opc.son = on; - op->o_bd->bd_info = (BackendInfo *)on->on_info; for (;;) { ldap_pvt_thread_mutex_lock( &so->s_mutex ); @@ -861,7 +861,7 @@ syncprov_qplay( Operation *op, slap_overinst *on, syncops *so ) e = NULL; if ( sr->s_mode != LDAP_SYNC_DELETE ) { - rc = be_entry_get_rw( op, &opc.sndn, NULL, NULL, 0, &e ); + rc = overlay_entry_get_ov( op, &opc.sndn, NULL, NULL, 0, &e, on ); if ( rc ) { Debug( LDAP_DEBUG_SYNC, "syncprov_qplay: failed to get %s, " "error (%d), ignoring...\n", opc.sndn.bv_val, rc, 0 ); @@ -873,7 +873,7 @@ syncprov_qplay( Operation *op, slap_overinst *on, syncops *so ) rc = syncprov_sendresp( op, &opc, so, &e, sr->s_mode ); if ( e ) { - be_entry_release_rw( op, e, 0 ); + overlay_entry_release_ov( op, e, 0, on ); } ch_free( sr ); @@ -881,7 +881,6 @@ syncprov_qplay( Operation *op, slap_overinst *on, syncops *so ) if ( rc ) break; } - op->o_bd->bd_info = (BackendInfo *)on; return rc; } @@ -1098,7 +1097,7 @@ syncprov_matchops( Operation *op, opcookie *opc, int saveit ) fbase_cookie fc; syncops *ss, *sprev, *snext; - Entry *e; + Entry *e = NULL; Attribute *a; int rc; struct berval newdn; @@ -1120,15 +1119,13 @@ syncprov_matchops( Operation *op, opcookie *opc, int saveit ) db = *op->o_bd; op->o_bd = &db; } - op->o_bd->bd_info = (BackendInfo *)on->on_info; - rc = be_entry_get_rw( op, fc.fdn, NULL, NULL, 0, &e ); + rc = overlay_entry_get_ov( op, fc.fdn, NULL, NULL, 0, &e, on ); /* If we're sending responses now, make a copy and unlock the DB */ if ( e && !saveit ) { Entry *e2 = entry_dup( e ); - be_entry_release_rw( op, e, 0 ); + overlay_entry_release_ov( op, e, 0, on ); e = e2; } - op->o_bd->bd_info = (BackendInfo *)on; if ( rc ) { op->o_bd = b0; return; @@ -2504,7 +2501,7 @@ syncprov_db_open( Connection conn = { 0 }; OperationBuffer opbuf = { 0 }; Operation *op = (Operation *) &opbuf; - Entry *e; + Entry *e = NULL; Attribute *a; int rc; void *thrctx = NULL; @@ -2530,9 +2527,8 @@ syncprov_db_open( op->o_dn = be->be_rootdn; op->o_ndn = be->be_rootndn; - op->o_bd->bd_info = on->on_info->oi_orig; - rc = be_entry_get_rw( op, be->be_nsuffix, NULL, - slap_schema.si_ad_contextCSN, 0, &e ); + rc = overlay_entry_get_ov( op, be->be_nsuffix, NULL, + slap_schema.si_ad_contextCSN, 0, &e, on ); if ( e ) { ldap_pvt_thread_t tid; @@ -2545,9 +2541,8 @@ syncprov_db_open( si->si_numcsns = i; si->si_sids = slap_parse_csn_sids( si->si_ctxcsn, i ); } - be_entry_release_rw( op, e, 0 ); + overlay_entry_release_ov( op, e, 0, on ); if ( si->si_ctxcsn ) { - op->o_bd->bd_info = (BackendInfo *)on; op->o_req_dn = be->be_suffix[0]; op->o_req_ndn = be->be_nsuffix[0]; op->ors_scope = LDAP_SCOPE_SUBTREE; -- 2.39.5