From: Jong Hyuk Choi Date: Tue, 21 Oct 2003 22:02:30 +0000 (+0000) Subject: fix for changing si->syncCookie to bvarray X-Git-Tag: OPENLDAP_REL_ENG_2_1_MP~524 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8b8383a85da96d5cbbd67245db5f4bd22b1b4f31;p=openldap fix for changing si->syncCookie to bvarray --- diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 9bc1778c16..f097c12dad 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -408,7 +408,7 @@ do_syncrepl( backend_attribute( &op, NULL, &op.o_req_ndn, slap_schema.si_ad_syncreplCookie, &si->syncCookie ); - ber_dupbv( &syncCookie_req, si->syncCookie ); + ber_dupbv( &syncCookie_req, &si->syncCookie[0] ); psub = be->be_nsuffix[0]; @@ -643,6 +643,9 @@ done: ldap_unbind( ld ); + ber_bvarray_free_x( si->syncCookie, op.o_tmpmemctx ); + si->syncCookie = NULL; + ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex ); ldap_pvt_runqueue_stoptask( &syncrepl_rq, rtask ); if ( si->type == LDAP_SYNC_REFRESH_ONLY ) { @@ -1255,11 +1258,17 @@ syncrepl_updateCookie( slap_callback cb; SlapReply rs = {REP_RESULT}; + struct berval *dup_syncCookie = NULL; + /* update in memory cookie */ - if ( si->syncCookie != NULL ) { - ber_bvfree( si->syncCookie ); - } - si->syncCookie = ber_dupbv( NULL, syncCookie ); + ber_bvarray_free_x( si->syncCookie, op->o_tmpmemctx ); + si->syncCookie = NULL; + + /* ber_bvarray_add() doesn't have dup option */ + dup_syncCookie = ber_dupbv_x( NULL, syncCookie, op->o_tmpmemctx ); + ber_bvarray_add_x( &si->syncCookie, dup_syncCookie, op->o_tmpmemctx ); + op->o_tmpfree( dup_syncCookie, op->o_tmpmemctx ); + mod = (Modifications *) ch_calloc( 1, sizeof( Modifications )); mod->sml_op = LDAP_MOD_REPLACE; mod->sml_desc = slap_schema.si_ad_objectClass; @@ -1281,7 +1290,7 @@ syncrepl_updateCookie( modtail = &mod->sml_next; if ( scbva[0].bv_val ) ch_free( scbva[0].bv_val ); - ber_dupbv( &scbva[0], si->syncCookie ); + ber_dupbv( &scbva[0], &si->syncCookie[0] ); mod = (Modifications *) ch_calloc( 1, sizeof( Modifications )); mod->sml_op = LDAP_MOD_REPLACE; mod->sml_desc = slap_schema.si_ad_syncreplCookie;