From 9320f002e3f9cc5d6900eaec4b20e5e51b7274f5 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 5 Feb 2007 05:59:43 +0000 Subject: [PATCH] Fix prev commit, doesn't need permissive modify --- servers/slapd/syncrepl.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 991a0c7d2c..ac31996121 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -1494,7 +1494,7 @@ syncrepl_message_to_entry( size_t textlen = sizeof txtbuf; struct berval bdn = BER_BVNULL, dn, ndn; - int rc; + int rc, is_ctx; *modlist = NULL; @@ -1533,6 +1533,8 @@ syncrepl_message_to_entry( slap_sl_free( ndn.bv_val, op->o_tmpmemctx ); slap_sl_free( dn.bv_val, op->o_tmpmemctx ); + is_ctx = dn_match( &op->o_req_ndn, &op->o_bd->be_nsuffix[0] ); + e = entry_alloc(); e->e_name = op->o_req_dn; e->e_nname = op->o_req_ndn; @@ -1544,6 +1546,15 @@ syncrepl_message_to_entry( break; } + /* Drop all updates to the contextCSN of the context entry + * (ITS#4622, etc.) + */ + if ( is_ctx && !strcasecmp( tmp.sml_type.bv_val, + slap_schema.si_ad_contextCSN->ad_cname.bv_val )) { + ber_bvarray_free( tmp.sml_values ); + continue; + } + mod = (Modifications *) ch_malloc( sizeof( Modifications ) ); mod->sml_op = LDAP_MOD_REPLACE; @@ -1814,24 +1825,6 @@ syncrepl_entry( si->si_ridtxt, dni.dn.bv_val ? dni.dn.bv_val : "(null)", 0 ); } - /* Don't save the contextCSN on the inooming context entry, - * we'll write it when syncrepl_updateCookie eventually - * gets called. (ITS#4622) - */ - if ( syncstate == LDAP_SYNC_ADD && dn_match( &entry->e_nname, - &be->be_nsuffix[0] ) ) - { - Attribute *a, **ap; - for ( ap = &entry->e_attrs; *ap; ap=&(*ap)->a_next ) { - a = *ap; - if ( a->a_desc == slap_schema.si_ad_contextCSN ) { - *ap = a->a_next; - attr_free( a ); - break; - } - } - } - slap_op_time( &op->o_time, &op->o_tincr ); switch ( syncstate ) { case LDAP_SYNC_ADD: @@ -2468,11 +2461,9 @@ syncrepl_updateCookie( else op->orm_modlist = &mod[1]; - op->o_permissive_modify = SLAP_CONTROL_CRITICAL; op->orm_no_opattrs = 1; rc = be->be_modify( op, &rs_modify ); op->o_msgid = 0; - op->o_permissive_modify = 0; if ( rs_modify.sr_err == LDAP_SUCCESS ) { slap_sync_cookie_free( &si->si_syncCookie, 0 ); -- 2.39.5