1 /* modrdn.c - bdb backend modrdn routine */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 2000-2014 The OpenLDAP Foundation.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
12 * A copy of this license is available in the file LICENSE in the
13 * top-level directory of the distribution or, alternatively, at
14 * <http://www.OpenLDAP.org/license.html>.
20 #include <ac/string.h>
25 bdb_modrdn( Operation *op, SlapReply *rs )
27 struct bdb_info *bdb = (struct bdb_info *) op->o_bd->be_private;
28 AttributeDescription *children = slap_schema.si_ad_children;
29 AttributeDescription *entry = slap_schema.si_ad_entry;
30 struct berval p_dn, p_ndn;
31 struct berval new_dn = {0, NULL}, new_ndn = {0, NULL};
34 EntryInfo *ei = NULL, *eip = NULL, *nei = NULL, *neip = NULL;
35 /* LDAP v2 supporting correct attribute handling. */
36 char textbuf[SLAP_TEXT_BUFLEN];
37 size_t textlen = sizeof textbuf;
38 DB_TXN *ltid = NULL, *lt2;
39 struct bdb_op_info opinfo = {{{ 0 }}};
42 Entry *np = NULL; /* newSuperior Entry */
43 struct berval *np_dn = NULL; /* newSuperior dn */
44 struct berval *np_ndn = NULL; /* newSuperior ndn */
45 struct berval *new_parent_dn = NULL; /* np_dn, p_dn, or NULL */
47 int manageDSAit = get_manageDSAit( op );
49 DB_LOCK lock, plock, nplock;
53 LDAPControl **preread_ctrl = NULL;
54 LDAPControl **postread_ctrl = NULL;
55 LDAPControl *ctrls[SLAP_MAX_RESPONSE_CONTROLS];
60 int parent_is_glue = 0;
61 int parent_is_leaf = 0;
63 Debug( LDAP_DEBUG_TRACE, "==>" LDAP_XSTRING(bdb_modrdn) "(%s,%s,%s)\n",
64 op->o_req_dn.bv_val,op->oq_modrdn.rs_newrdn.bv_val,
65 op->oq_modrdn.rs_newSup ? op->oq_modrdn.rs_newSup->bv_val : "NULL" );
68 if( op->o_txnSpec && txn_preop( op, rs ))
72 ctrls[num_ctrls] = NULL;
74 slap_mods_opattrs( op, &op->orr_modlist, 1 );
77 retry: /* transaction retry */
78 if ( dummy.e_attrs ) {
79 attrs_free( dummy.e_attrs );
83 bdb_unlocked_cache_return_entry_w(&bdb->bi_cache, e);
87 bdb_unlocked_cache_return_entry_r(&bdb->bi_cache, p);
91 bdb_unlocked_cache_return_entry_r(&bdb->bi_cache, np);
94 Debug( LDAP_DEBUG_TRACE, "==>" LDAP_XSTRING(bdb_modrdn)
95 ": retrying...\n", 0, 0, 0 );
97 rs->sr_err = TXN_ABORT( ltid );
99 LDAP_SLIST_REMOVE( &op->o_extra, &opinfo.boi_oe, OpExtra, oe_next );
100 opinfo.boi_oe.oe_key = NULL;
101 op->o_do_not_cache = opinfo.boi_acl_cache;
102 if( rs->sr_err != 0 ) {
103 rs->sr_err = LDAP_OTHER;
104 rs->sr_text = "internal error";
107 if ( op->o_abandon ) {
108 rs->sr_err = SLAPD_ABANDON;
113 bdb_trans_backoff( ++num_retries );
116 /* begin transaction */
117 rs->sr_err = TXN_BEGIN( bdb->bi_dbenv, NULL, <id,
118 bdb->bi_db_opflags );
120 if( rs->sr_err != 0 ) {
121 Debug( LDAP_DEBUG_TRACE,
122 LDAP_XSTRING(bdb_modrdn) ": txn_begin failed: "
123 "%s (%d)\n", db_strerror(rs->sr_err), rs->sr_err, 0 );
124 rs->sr_err = LDAP_OTHER;
125 rs->sr_text = "internal error";
128 Debug( LDAP_DEBUG_TRACE, LDAP_XSTRING(bdb_modrdn) ": txn1 id: %x\n",
129 ltid->id(ltid), 0, 0 );
131 opinfo.boi_oe.oe_key = bdb;
132 opinfo.boi_txn = ltid;
134 opinfo.boi_acl_cache = op->o_do_not_cache;
135 LDAP_SLIST_INSERT_HEAD( &op->o_extra, &opinfo.boi_oe, oe_next );
138 rs->sr_err = bdb_dn2entry( op, ltid, &op->o_req_ndn, &ei, 1,
141 switch( rs->sr_err ) {
145 case DB_LOCK_DEADLOCK:
146 case DB_LOCK_NOTGRANTED:
149 rs->sr_text = "ldap server busy";
152 rs->sr_err = LDAP_OTHER;
153 rs->sr_text = "internal error";
158 /* FIXME: dn2entry() should return non-glue entry */
159 if (( rs->sr_err == DB_NOTFOUND ) ||
160 ( !manageDSAit && e && is_entry_glue( e )))
163 rs->sr_matched = ch_strdup( e->e_dn );
164 rs->sr_ref = is_entry_referral( e )
165 ? get_entry_referrals( op, e )
167 bdb_unlocked_cache_return_entry_r( &bdb->bi_cache, e);
171 rs->sr_ref = referral_rewrite( default_referral, NULL,
172 &op->o_req_dn, LDAP_SCOPE_DEFAULT );
175 rs->sr_err = LDAP_REFERRAL;
176 send_ldap_result( op, rs );
178 ber_bvarray_free( rs->sr_ref );
179 free( (char *)rs->sr_matched );
181 rs->sr_matched = NULL;
186 if ( get_assert( op ) &&
187 ( test_filter( op, e, get_assertion( op )) != LDAP_COMPARE_TRUE ))
189 rs->sr_err = LDAP_ASSERTION_FAILED;
193 /* check write on old entry */
194 rs->sr_err = access_allowed( op, e, entry, NULL, ACL_WRITE, NULL );
195 if ( ! rs->sr_err ) {
196 switch( opinfo.boi_err ) {
197 case DB_LOCK_DEADLOCK:
198 case DB_LOCK_NOTGRANTED:
202 Debug( LDAP_DEBUG_TRACE, "no access to entry\n", 0,
204 rs->sr_text = "no write access to old entry";
205 rs->sr_err = LDAP_INSUFFICIENT_ACCESS;
210 rs->sr_err = bdb_cache_children( op, ltid, e );
211 if ( rs->sr_err != DB_NOTFOUND ) {
212 switch( rs->sr_err ) {
213 case DB_LOCK_DEADLOCK:
214 case DB_LOCK_NOTGRANTED:
217 Debug(LDAP_DEBUG_ARGS,
218 "<=- " LDAP_XSTRING(bdb_modrdn)
220 op->o_req_dn.bv_val, 0, 0);
221 rs->sr_err = LDAP_NOT_ALLOWED_ON_NONLEAF;
222 rs->sr_text = "subtree rename not supported";
225 Debug(LDAP_DEBUG_ARGS,
226 "<=- " LDAP_XSTRING(bdb_modrdn)
227 ": has_children failed: %s (%d)\n",
228 db_strerror(rs->sr_err), rs->sr_err, 0 );
229 rs->sr_err = LDAP_OTHER;
230 rs->sr_text = "internal error";
234 ei->bei_state |= CACHE_ENTRY_NO_KIDS;
237 if (!manageDSAit && is_entry_referral( e ) ) {
238 /* parent is a referral, don't allow add */
239 rs->sr_ref = get_entry_referrals( op, e );
241 Debug( LDAP_DEBUG_TRACE, LDAP_XSTRING(bdb_modrdn)
242 ": entry %s is referral\n", e->e_dn, 0, 0 );
244 rs->sr_err = LDAP_REFERRAL,
245 rs->sr_matched = e->e_name.bv_val;
246 send_ldap_result( op, rs );
248 ber_bvarray_free( rs->sr_ref );
250 rs->sr_matched = NULL;
254 if ( be_issuffix( op->o_bd, &e->e_nname ) ) {
255 #ifdef BDB_MULTIPLE_SUFFIXES
256 /* Allow renaming one suffix entry to another */
257 p_ndn = slap_empty_bv;
259 /* There can only be one suffix entry */
260 rs->sr_err = LDAP_NAMING_VIOLATION;
261 rs->sr_text = "cannot rename suffix entry";
265 dnParent( &e->e_nname, &p_ndn );
268 eip = ei->bei_parent;
269 if ( eip && eip->bei_id ) {
270 /* Make sure parent entry exist and we can write its
273 rs->sr_err = bdb_cache_find_id( op, ltid,
274 eip->bei_id, &eip, 0, &plock );
276 switch( rs->sr_err ) {
280 case DB_LOCK_DEADLOCK:
281 case DB_LOCK_NOTGRANTED:
284 rs->sr_text = "ldap server busy";
287 rs->sr_err = LDAP_OTHER;
288 rs->sr_text = "internal error";
294 Debug( LDAP_DEBUG_TRACE, LDAP_XSTRING(bdb_modrdn)
295 ": parent does not exist\n", 0, 0, 0);
296 rs->sr_err = LDAP_OTHER;
297 rs->sr_text = "old entry's parent does not exist";
301 p = (Entry *)&slap_entry_root;
304 /* check parent for "children" acl */
305 rs->sr_err = access_allowed( op, p,
307 op->oq_modrdn.rs_newSup == NULL ?
308 ACL_WRITE : ACL_WDEL,
314 if ( ! rs->sr_err ) {
315 switch( opinfo.boi_err ) {
316 case DB_LOCK_DEADLOCK:
317 case DB_LOCK_NOTGRANTED:
321 rs->sr_err = LDAP_INSUFFICIENT_ACCESS;
322 Debug( LDAP_DEBUG_TRACE, "no access to parent\n", 0,
324 rs->sr_text = "no write access to old parent's children";
328 Debug( LDAP_DEBUG_TRACE,
329 LDAP_XSTRING(bdb_modrdn) ": wr to children "
330 "of entry %s OK\n", p_ndn.bv_val, 0, 0 );
332 if ( p_ndn.bv_val == slap_empty_bv.bv_val ) {
333 p_dn = slap_empty_bv;
335 dnParent( &e->e_name, &p_dn );
338 Debug( LDAP_DEBUG_TRACE,
339 LDAP_XSTRING(bdb_modrdn) ": parent dn=%s\n",
342 new_parent_dn = &p_dn; /* New Parent unless newSuperior given */
344 if ( op->oq_modrdn.rs_newSup != NULL ) {
345 Debug( LDAP_DEBUG_TRACE,
346 LDAP_XSTRING(bdb_modrdn)
347 ": new parent \"%s\" requested...\n",
348 op->oq_modrdn.rs_newSup->bv_val, 0, 0 );
350 /* newSuperior == oldParent? */
351 if( dn_match( &p_ndn, op->oq_modrdn.rs_nnewSup ) ) {
352 Debug( LDAP_DEBUG_TRACE, "bdb_back_modrdn: "
353 "new parent \"%s\" same as the old parent \"%s\"\n",
354 op->oq_modrdn.rs_newSup->bv_val, p_dn.bv_val, 0 );
355 op->oq_modrdn.rs_newSup = NULL; /* ignore newSuperior */
359 /* There's a BDB_MULTIPLE_SUFFIXES case here that this code doesn't
360 * support. E.g., two suffixes dc=foo,dc=com and dc=bar,dc=net.
361 * We do not allow modDN
365 * and we probably should. But since MULTIPLE_SUFFIXES is deprecated
366 * I'm ignoring this problem for now.
368 if ( op->oq_modrdn.rs_newSup != NULL ) {
369 if ( op->oq_modrdn.rs_newSup->bv_len ) {
370 np_dn = op->oq_modrdn.rs_newSup;
371 np_ndn = op->oq_modrdn.rs_nnewSup;
373 /* newSuperior == oldParent? - checked above */
374 /* newSuperior == entry being moved?, if so ==> ERROR */
375 if ( dnIsSuffix( np_ndn, &e->e_nname )) {
376 rs->sr_err = LDAP_NO_SUCH_OBJECT;
377 rs->sr_text = "new superior not found";
380 /* Get Entry with dn=newSuperior. Does newSuperior exist? */
382 rs->sr_err = bdb_dn2entry( op, ltid, np_ndn,
385 switch( rs->sr_err ) {
386 case 0: np = neip->bei_e;
389 case DB_LOCK_DEADLOCK:
390 case DB_LOCK_NOTGRANTED:
393 rs->sr_text = "ldap server busy";
396 rs->sr_err = LDAP_OTHER;
397 rs->sr_text = "internal error";
402 Debug( LDAP_DEBUG_TRACE,
403 LDAP_XSTRING(bdb_modrdn)
404 ": newSup(ndn=%s) not here!\n",
405 np_ndn->bv_val, 0, 0);
406 rs->sr_text = "new superior not found";
407 rs->sr_err = LDAP_NO_SUCH_OBJECT;
411 Debug( LDAP_DEBUG_TRACE,
412 LDAP_XSTRING(bdb_modrdn)
413 ": wr to new parent OK np=%p, id=%ld\n",
414 (void *) np, (long) np->e_id, 0 );
416 /* check newSuperior for "children" acl */
417 rs->sr_err = access_allowed( op, np, children,
418 NULL, ACL_WADD, NULL );
421 switch( opinfo.boi_err ) {
422 case DB_LOCK_DEADLOCK:
423 case DB_LOCK_NOTGRANTED:
427 Debug( LDAP_DEBUG_TRACE,
428 LDAP_XSTRING(bdb_modrdn)
429 ": no wr to newSup children\n",
431 rs->sr_text = "no write access to new superior's children";
432 rs->sr_err = LDAP_INSUFFICIENT_ACCESS;
436 if ( is_entry_alias( np ) ) {
437 /* parent is an alias, don't allow add */
438 Debug( LDAP_DEBUG_TRACE,
439 LDAP_XSTRING(bdb_modrdn)
440 ": entry is alias\n",
442 rs->sr_text = "new superior is an alias";
443 rs->sr_err = LDAP_ALIAS_PROBLEM;
447 if ( is_entry_referral( np ) ) {
448 /* parent is a referral, don't allow add */
449 Debug( LDAP_DEBUG_TRACE,
450 LDAP_XSTRING(bdb_modrdn)
451 ": entry is referral\n",
453 rs->sr_text = "new superior is a referral";
454 rs->sr_err = LDAP_OTHER;
461 /* no parent, modrdn entry directly under root */
462 if ( be_issuffix( op->o_bd, (struct berval *)&slap_empty_bv )
463 || be_isupdate( op ) ) {
464 np = (Entry *)&slap_entry_root;
466 /* check parent for "children" acl */
467 rs->sr_err = access_allowed( op, np,
468 children, NULL, ACL_WADD, NULL );
472 if ( ! rs->sr_err ) {
473 switch( opinfo.boi_err ) {
474 case DB_LOCK_DEADLOCK:
475 case DB_LOCK_NOTGRANTED:
479 rs->sr_err = LDAP_INSUFFICIENT_ACCESS;
480 Debug( LDAP_DEBUG_TRACE,
481 "no access to new superior\n",
484 "no write access to new superior's children";
490 Debug( LDAP_DEBUG_TRACE,
491 LDAP_XSTRING(bdb_modrdn)
492 ": wr to new parent's children OK\n",
495 new_parent_dn = np_dn;
498 /* Build target dn and make sure target entry doesn't exist already. */
499 if (!new_dn.bv_val) {
500 build_new_dn( &new_dn, new_parent_dn, &op->oq_modrdn.rs_newrdn, NULL );
503 if (!new_ndn.bv_val) {
504 struct berval bv = {0, NULL};
505 dnNormalize( 0, NULL, NULL, &new_dn, &bv, op->o_tmpmemctx );
506 ber_dupbv( &new_ndn, &bv );
507 /* FIXME: why not call dnNormalize() w/o ctx? */
508 op->o_tmpfree( bv.bv_val, op->o_tmpmemctx );
511 Debug( LDAP_DEBUG_TRACE, LDAP_XSTRING(bdb_modrdn) ": new ndn=%s\n",
512 new_ndn.bv_val, 0, 0 );
514 /* Shortcut the search */
515 nei = neip ? neip : eip;
516 rs->sr_err = bdb_cache_find_ndn ( op, ltid, &new_ndn, &nei );
517 if ( nei ) bdb_cache_entryinfo_unlock( nei );
518 switch( rs->sr_err ) {
519 case DB_LOCK_DEADLOCK:
520 case DB_LOCK_NOTGRANTED:
525 /* Allow rename to same DN */
528 rs->sr_err = LDAP_ALREADY_EXISTS;
531 rs->sr_err = LDAP_OTHER;
532 rs->sr_text = "internal error";
536 assert( op->orr_modlist != NULL );
538 if( op->o_preread ) {
539 if( preread_ctrl == NULL ) {
540 preread_ctrl = &ctrls[num_ctrls++];
541 ctrls[num_ctrls] = NULL;
543 if( slap_read_controls( op, rs, e,
544 &slap_pre_read_bv, preread_ctrl ) )
546 Debug( LDAP_DEBUG_TRACE,
547 "<=- " LDAP_XSTRING(bdb_modrdn)
548 ": pre-read failed!\n", 0, 0, 0 );
549 if ( op->o_preread & SLAP_CONTROL_CRITICAL ) {
550 /* FIXME: is it correct to abort
551 * operation if control fails? */
557 /* nested transaction */
558 rs->sr_err = TXN_BEGIN( bdb->bi_dbenv, ltid, <2, bdb->bi_db_opflags );
560 if( rs->sr_err != 0 ) {
561 Debug( LDAP_DEBUG_TRACE,
562 LDAP_XSTRING(bdb_modrdn)
563 ": txn_begin(2) failed: %s (%d)\n",
564 db_strerror(rs->sr_err), rs->sr_err, 0 );
565 rs->sr_err = LDAP_OTHER;
566 rs->sr_text = "internal error";
569 Debug( LDAP_DEBUG_TRACE, LDAP_XSTRING(bdb_modrdn) ": txn2 id: %x\n",
570 lt2->id(lt2), 0, 0 );
573 rs->sr_err = bdb_dn2id_delete( op, lt2, eip, e );
574 if ( rs->sr_err != 0 ) {
575 Debug(LDAP_DEBUG_TRACE,
576 "<=- " LDAP_XSTRING(bdb_modrdn)
577 ": dn2id del failed: %s (%d)\n",
578 db_strerror(rs->sr_err), rs->sr_err, 0 );
579 switch( rs->sr_err ) {
580 case DB_LOCK_DEADLOCK:
581 case DB_LOCK_NOTGRANTED:
584 rs->sr_err = LDAP_OTHER;
585 rs->sr_text = "DN index delete fail";
589 /* copy the entry, then override some fields */
591 dummy.e_name = new_dn;
592 dummy.e_nname = new_ndn;
593 dummy.e_attrs = NULL;
596 rs->sr_err = bdb_dn2id_add( op, lt2, neip ? neip : eip, &dummy );
597 if ( rs->sr_err != 0 ) {
598 Debug(LDAP_DEBUG_TRACE,
599 "<=- " LDAP_XSTRING(bdb_modrdn)
600 ": dn2id add failed: %s (%d)\n",
601 db_strerror(rs->sr_err), rs->sr_err, 0 );
602 switch( rs->sr_err ) {
603 case DB_LOCK_DEADLOCK:
604 case DB_LOCK_NOTGRANTED:
607 rs->sr_err = LDAP_OTHER;
608 rs->sr_text = "DN index add failed";
612 dummy.e_attrs = e->e_attrs;
615 rs->sr_err = bdb_modify_internal( op, lt2, op->orr_modlist, &dummy,
616 &rs->sr_text, textbuf, textlen );
617 if( rs->sr_err != LDAP_SUCCESS ) {
618 Debug(LDAP_DEBUG_TRACE,
619 "<=- " LDAP_XSTRING(bdb_modrdn)
620 ": modify failed: %s (%d)\n",
621 db_strerror(rs->sr_err), rs->sr_err, 0 );
622 if ( ( rs->sr_err == LDAP_INSUFFICIENT_ACCESS ) && opinfo.boi_err ) {
623 rs->sr_err = opinfo.boi_err;
625 if ( dummy.e_attrs == e->e_attrs ) dummy.e_attrs = NULL;
626 switch( rs->sr_err ) {
627 case DB_LOCK_DEADLOCK:
628 case DB_LOCK_NOTGRANTED:
635 rs->sr_err = bdb_id2entry_update( op->o_bd, lt2, &dummy );
636 if ( rs->sr_err != 0 ) {
637 Debug(LDAP_DEBUG_TRACE,
638 "<=- " LDAP_XSTRING(bdb_modrdn)
639 ": id2entry failed: %s (%d)\n",
640 db_strerror(rs->sr_err), rs->sr_err, 0 );
641 switch( rs->sr_err ) {
642 case DB_LOCK_DEADLOCK:
643 case DB_LOCK_NOTGRANTED:
646 rs->sr_err = LDAP_OTHER;
647 rs->sr_text = "entry update failed";
651 if ( p_ndn.bv_len != 0 ) {
652 parent_is_glue = is_entry_glue(p);
653 rs->sr_err = bdb_cache_children( op, lt2, p );
654 if ( rs->sr_err != DB_NOTFOUND ) {
655 switch( rs->sr_err ) {
656 case DB_LOCK_DEADLOCK:
657 case DB_LOCK_NOTGRANTED:
662 Debug(LDAP_DEBUG_ARGS,
663 "<=- " LDAP_XSTRING(bdb_modrdn)
664 ": has_children failed: %s (%d)\n",
665 db_strerror(rs->sr_err), rs->sr_err, 0 );
666 rs->sr_err = LDAP_OTHER;
667 rs->sr_text = "internal error";
672 bdb_unlocked_cache_return_entry_r(&bdb->bi_cache, p);
676 if ( TXN_COMMIT( lt2, 0 ) != 0 ) {
677 rs->sr_err = LDAP_OTHER;
678 rs->sr_text = "txn_commit(2) failed";
682 if( op->o_postread ) {
683 if( postread_ctrl == NULL ) {
684 postread_ctrl = &ctrls[num_ctrls++];
685 ctrls[num_ctrls] = NULL;
687 if( slap_read_controls( op, rs, &dummy,
688 &slap_post_read_bv, postread_ctrl ) )
690 Debug( LDAP_DEBUG_TRACE,
691 "<=- " LDAP_XSTRING(bdb_modrdn)
692 ": post-read failed!\n", 0, 0, 0 );
693 if ( op->o_postread & SLAP_CONTROL_CRITICAL ) {
694 /* FIXME: is it correct to abort
695 * operation if control fails? */
702 if(( rs->sr_err=TXN_ABORT( ltid )) != 0 ) {
703 rs->sr_text = "txn_abort (no-op) failed";
705 rs->sr_err = LDAP_X_NO_OPERATION;
707 /* Only free attrs if they were dup'd. */
708 if ( dummy.e_attrs == e->e_attrs ) dummy.e_attrs = NULL;
713 rc = bdb_cache_modrdn( bdb, e, &op->orr_nnewrdn, &dummy, neip,
716 case DB_LOCK_DEADLOCK:
717 case DB_LOCK_NOTGRANTED:
720 dummy.e_attrs = NULL;
721 new_dn.bv_val = NULL;
722 new_ndn.bv_val = NULL;
724 if(( rs->sr_err=TXN_COMMIT( ltid, 0 )) != 0 ) {
725 rs->sr_text = "txn_commit failed";
727 rs->sr_err = LDAP_SUCCESS;
732 LDAP_SLIST_REMOVE( &op->o_extra, &opinfo.boi_oe, OpExtra, oe_next );
733 opinfo.boi_oe.oe_key = NULL;
735 if( rs->sr_err != LDAP_SUCCESS ) {
736 Debug( LDAP_DEBUG_TRACE,
737 LDAP_XSTRING(bdb_modrdn) ": %s : %s (%d)\n",
738 rs->sr_text, db_strerror(rs->sr_err), rs->sr_err );
739 rs->sr_err = LDAP_OTHER;
744 Debug(LDAP_DEBUG_TRACE,
745 LDAP_XSTRING(bdb_modrdn)
746 ": rdn modified%s id=%08lx dn=\"%s\"\n",
747 op->o_noop ? " (no-op)" : "",
748 dummy.e_id, op->o_req_dn.bv_val );
750 if( num_ctrls ) rs->sr_ctrls = ctrls;
753 if ( dummy.e_attrs ) {
754 attrs_free( dummy.e_attrs );
756 send_ldap_result( op, rs );
758 if( rs->sr_err == LDAP_SUCCESS && bdb->bi_txn_cp_kbyte ) {
759 TXN_CHECKPOINT( bdb->bi_dbenv,
760 bdb->bi_txn_cp_kbyte, bdb->bi_txn_cp_min, 0 );
763 if ( rs->sr_err == LDAP_SUCCESS && parent_is_glue && parent_is_leaf ) {
764 op->o_delete_glue_parent = 1;
768 slap_graduate_commit_csn( op );
770 if( new_dn.bv_val != NULL ) free( new_dn.bv_val );
771 if( new_ndn.bv_val != NULL ) free( new_ndn.bv_val );
773 /* LDAP v3 Support */
775 /* free new parent and reader lock */
776 bdb_unlocked_cache_return_entry_r(&bdb->bi_cache, np);
780 /* free parent and reader lock */
781 bdb_unlocked_cache_return_entry_r(&bdb->bi_cache, p);
786 bdb_unlocked_cache_return_entry_w( &bdb->bi_cache, e);
792 if ( opinfo.boi_oe.oe_key ) {
793 LDAP_SLIST_REMOVE( &op->o_extra, &opinfo.boi_oe, OpExtra, oe_next );
796 if( preread_ctrl != NULL && (*preread_ctrl) != NULL ) {
797 slap_sl_free( (*preread_ctrl)->ldctl_value.bv_val, op->o_tmpmemctx );
798 slap_sl_free( *preread_ctrl, op->o_tmpmemctx );
800 if( postread_ctrl != NULL && (*postread_ctrl) != NULL ) {
801 slap_sl_free( (*postread_ctrl)->ldctl_value.bv_val, op->o_tmpmemctx );
802 slap_sl_free( *postread_ctrl, op->o_tmpmemctx );