]> git.sur5r.net Git - openldap/commitdiff
ldapsync fix for recursive deletion (ITS#3385)
authorJong Hyuk Choi <jongchoi@openldap.org>
Wed, 10 Nov 2004 03:52:12 +0000 (03:52 +0000)
committerJong Hyuk Choi <jongchoi@openldap.org>
Wed, 10 Nov 2004 03:52:12 +0000 (03:52 +0000)
servers/slapd/back-bdb/delete.c

index 234c5feb3fca92c54e079d8667a46b4934e19dd1..6e54172f57fa7841019e1f27f791359add75fde5 100644 (file)
@@ -56,11 +56,16 @@ bdb_delete( Operation *op, SlapReply *rs )
        int     parent_is_glue = 0;
        int parent_is_leaf = 0;
 
+       struct berval ctxcsn_ndn = BER_BVNULL;
+
        ctrls[num_ctrls] = 0;
 
        Debug( LDAP_DEBUG_ARGS, "==> bdb_delete: %s\n",
                op->o_req_dn.bv_val, 0, 0 );
 
+       build_new_dn( &ctxcsn_ndn, &op->o_bd->be_nsuffix[0],
+                               (struct berval *)&slap_ldapsync_cn_bv, op->o_tmpmemctx );
+
        if( 0 ) {
 retry: /* transaction retry */
                if( e != NULL ) {
@@ -469,7 +474,9 @@ retry:      /* transaction retry */
        ldap_pvt_thread_mutex_unlock( &bdb->bi_lastid_mutex );
 #endif
 
-       if ( LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
+       if ( !dn_match( &ctxcsn_ndn, &op->o_req_ndn ) &&
+                !be_issuffix( op->o_bd, &op->o_req_ndn ) &&
+                       LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
                rc = bdb_csn_commit( op, rs, ltid, ei, &suffix_ei,
                        &ctxcsn_e, &ctxcsn_added, locker );
                switch ( rc ) {
@@ -585,6 +592,8 @@ done:
                op->o_private = NULL;
        }
 
+       slap_sl_free( ctxcsn_ndn.bv_val, op->o_tmpmemctx );
+
        if( preread_ctrl != NULL ) {
                slap_sl_free( (*preread_ctrl)->ldctl_value.bv_val, &op->o_tmpmemctx );
                slap_sl_free( *preread_ctrl, &op->o_tmpmemctx );