1 /* modrdn.c - bdb backend modrdn routine */
4 * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
5 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
11 #include <ac/string.h>
23 struct berval *newrdn,
24 struct berval *nnewrdn,
26 struct berval *newSuperior,
27 struct berval *nnewSuperior )
29 struct bdb_info *bdb = (struct bdb_info *) be->be_private;
30 AttributeDescription *children = slap_schema.si_ad_children;
31 AttributeDescription *entry = slap_schema.si_ad_entry;
32 struct berval p_dn, p_ndn;
33 struct berval new_dn = {0, NULL}, new_ndn = {0, NULL};
38 /* LDAP v2 supporting correct attribute handling. */
39 LDAPRDN *new_rdn = NULL;
40 LDAPRDN *old_rdn = NULL;
43 char textbuf[SLAP_TEXT_BUFLEN];
44 size_t textlen = sizeof textbuf;
46 struct bdb_op_info opinfo;
50 Entry *np = NULL; /* newSuperior Entry */
51 struct berval *np_dn = NULL; /* newSuperior dn */
52 struct berval *np_ndn = NULL; /* newSuperior ndn */
53 struct berval *new_parent_dn = NULL; /* np_dn, p_dn, or NULL */
55 /* Used to interface with bdb_modify_internal() */
56 Modifications *mod = NULL; /* Used to delete old rdn */
58 int manageDSAit = get_manageDSAit( op );
65 #if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
67 struct psid_entry* pm_list;
68 struct psid_entry* pm_prev;
72 LDAP_LOG ( OPERATION, ENTRY, "==>bdb_modrdn(%s,%s,%s)\n",
73 dn->bv_val,newrdn->bv_val, newSuperior ? newSuperior->bv_val : "NULL" );
75 Debug( LDAP_DEBUG_TRACE, "==>bdb_modrdn(%s,%s,%s)\n",
76 dn->bv_val, newrdn->bv_val,
77 newSuperior ? newSuperior->bv_val : "NULL" );
81 retry: /* transaction retry */
83 bdb_cache_delete_entry(&bdb->bi_cache, e);
84 bdb_unlocked_cache_return_entry_w(&bdb->bi_cache, e);
87 bdb_unlocked_cache_return_entry_r(&bdb->bi_cache, p);
90 bdb_unlocked_cache_return_entry_r(&bdb->bi_cache, np);
93 LDAP_LOG ( OPERATION, DETAIL1, "==>bdb_modrdn: retrying...\n", 0, 0, 0);
95 Debug( LDAP_DEBUG_TRACE, "==>bdb_modrdn: retrying...\n", 0, 0, 0 );
98 #if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
99 pm_list = LDAP_LIST_FIRST(&op->premodify_list);
100 while ( pm_list != NULL ) {
101 LDAP_LIST_REMOVE ( pm_list, link );
103 pm_list = LDAP_LIST_NEXT ( pm_list, link );
108 rc = TXN_ABORT( ltid );
110 op->o_private = NULL;
111 op->o_do_not_cache = opinfo.boi_acl_cache;
114 text = "internal error";
117 ldap_pvt_thread_yield();
120 /* begin transaction */
121 rc = TXN_BEGIN( bdb->bi_dbenv, NULL, <id,
122 bdb->bi_db_opflags );
126 LDAP_LOG ( OPERATION, ERR,
127 "==>bdb_modrdn: txn_begin failed: %s (%d)\n",
128 db_strerror(rc), rc, 0 );
130 Debug( LDAP_DEBUG_TRACE,
131 "bdb_delete: txn_begin failed: %s (%d)\n",
132 db_strerror(rc), rc, 0 );
135 text = "internal error";
139 locker = TXN_ID ( ltid );
142 opinfo.boi_txn = ltid;
143 opinfo.boi_locker = locker;
145 opinfo.boi_acl_cache = op->o_do_not_cache;
146 op->o_private = &opinfo;
149 rc = bdb_dn2entry_w( be, ltid, ndn, &e, &matched, DB_RMW, locker, &lock );
155 case DB_LOCK_DEADLOCK:
156 case DB_LOCK_NOTGRANTED:
159 text = "ldap server busy";
163 text = "internal error";
168 char* matched_dn = NULL;
171 if( matched != NULL ) {
172 matched_dn = ch_strdup( matched->e_dn );
173 refs = is_entry_referral( matched )
174 ? get_entry_referrals( be, conn, op, matched )
176 bdb_unlocked_cache_return_entry_r( &bdb->bi_cache, matched);
180 refs = referral_rewrite( default_referral,
181 NULL, dn, LDAP_SCOPE_DEFAULT );
184 send_ldap_result( conn, op, rc = LDAP_REFERRAL,
185 matched_dn, NULL, refs, NULL );
187 ber_bvarray_free( refs );
193 /* check write on old entry */
194 rc = access_allowed( be, conn, op, e, entry, NULL, ACL_WRITE, NULL );
197 switch( opinfo.boi_err ) {
198 case DB_LOCK_DEADLOCK:
199 case DB_LOCK_NOTGRANTED:
204 LDAP_LOG ( OPERATION, ERR,
205 "==>bdb_modrdn: no access to entry\n", 0, 0, 0 );
207 Debug( LDAP_DEBUG_TRACE, "no access to entry\n", 0,
210 text = "no write access to old entry";
211 rc = LDAP_INSUFFICIENT_ACCESS;
216 rc = bdb_dn2id_children( be, ltid, &e->e_nname, 0 );
217 if ( rc != DB_NOTFOUND ) {
219 case DB_LOCK_DEADLOCK:
220 case DB_LOCK_NOTGRANTED:
224 LDAP_LOG ( OPERATION, DETAIL1,
225 "<=- bdb_modrdn: non-leaf %s\n", dn->bv_val, 0, 0 );
227 Debug(LDAP_DEBUG_ARGS,
228 "<=- bdb_modrdn: non-leaf %s\n",
231 rc = LDAP_NOT_ALLOWED_ON_NONLEAF;
232 text = "subtree rename not supported";
236 LDAP_LOG ( OPERATION, ERR,
237 "<=- bdb_modrdn: has_children failed %s (%d)\n",
238 db_strerror(rc), rc, 0 );
240 Debug(LDAP_DEBUG_ARGS,
241 "<=- bdb_modrdn: has_children failed: %s (%d)\n",
242 db_strerror(rc), rc, 0 );
245 text = "internal error";
250 if (!manageDSAit && is_entry_referral( e ) ) {
251 /* parent is a referral, don't allow add */
252 /* parent is an alias, don't allow add */
253 BerVarray refs = get_entry_referrals( be,
257 LDAP_LOG ( OPERATION, DETAIL1,
258 "==>bdb_modrdn: entry %s is referral \n", e->e_dn, 0, 0 );
260 Debug( LDAP_DEBUG_TRACE, "bdb_modrdn: entry %s is referral\n",
264 send_ldap_result( conn, op, rc = LDAP_REFERRAL,
265 e->e_dn, NULL, refs, NULL );
267 ber_bvarray_free( refs );
271 if ( be_issuffix( be, &e->e_nname ) ) {
272 p_ndn = slap_empty_bv;
274 dnParent( &e->e_nname, &p_ndn );
277 if ( p_ndn.bv_len != 0 ) {
278 /* Make sure parent entry exist and we can write its
281 rc = bdb_dn2entry_r( be, ltid, &p_ndn, &p, NULL, 0, locker, &lock );
287 case DB_LOCK_DEADLOCK:
288 case DB_LOCK_NOTGRANTED:
291 text = "ldap server busy";
295 text = "internal error";
301 LDAP_LOG ( OPERATION, ERR,
302 "==>bdb_modrdn: parent does not exist\n", 0, 0, 0 );
304 Debug( LDAP_DEBUG_TRACE, "bdb_modrdn: parent does not exist\n",
308 text = "old entry's parent does not exist";
312 /* check parent for "children" acl */
313 rc = access_allowed( be, conn, op, p,
314 children, NULL, ACL_WRITE, NULL );
317 switch( opinfo.boi_err ) {
318 case DB_LOCK_DEADLOCK:
319 case DB_LOCK_NOTGRANTED:
323 rc = LDAP_INSUFFICIENT_ACCESS;
325 LDAP_LOG ( OPERATION, ERR,
326 "==>bdb_modrdn: no access to parent\n", 0, 0, 0 );
328 Debug( LDAP_DEBUG_TRACE, "no access to parent\n", 0,
331 text = "no write access to old parent's children";
336 LDAP_LOG ( OPERATION, DETAIL1,
337 "==>bdb_modrdn: wr to children %s is OK\n", p_ndn.bv_val, 0, 0 );
339 Debug( LDAP_DEBUG_TRACE,
340 "bdb_modrdn: wr to children of entry %s OK\n",
341 p_ndn.bv_val, 0, 0 );
344 if ( p_ndn.bv_val == slap_empty_bv.bv_val ) {
345 p_dn = slap_empty_bv;
347 dnParent( &e->e_name, &p_dn );
351 LDAP_LOG ( OPERATION, DETAIL1,
352 "==>bdb_modrdn: parent dn=%s\n", p_dn.bv_val, 0, 0 );
354 Debug( LDAP_DEBUG_TRACE,
355 "bdb_modrdn: parent dn=%s\n",
360 /* no parent, modrdn entry directly under root */
361 isroot = be_isroot( be, &op->o_ndn );
363 if ( be_issuffix( be, (struct berval *)&slap_empty_bv )
364 || be_isupdate( be, &op->o_ndn ) ) {
366 p = (Entry *)&slap_entry_root;
368 /* check parent for "children" acl */
369 rc = access_allowed( be, conn, op, p,
370 children, NULL, ACL_WRITE, NULL );
375 switch( opinfo.boi_err ) {
376 case DB_LOCK_DEADLOCK:
377 case DB_LOCK_NOTGRANTED:
381 rc = LDAP_INSUFFICIENT_ACCESS;
383 LDAP_LOG ( OPERATION, ERR,
384 "==>bdb_modrdn: no access to parent\n", 0, 0, 0 );
386 Debug( LDAP_DEBUG_TRACE,
387 "no access to parent\n",
390 text = "no write access to old parent";
395 LDAP_LOG ( OPERATION, DETAIL1,
396 "==>bdb_modrdn: wr to children of entry \"%s\" OK\n",
399 Debug( LDAP_DEBUG_TRACE,
400 "bdb_modrdn: wr to children of entry \"\" OK\n",
408 LDAP_LOG ( OPERATION, DETAIL1,
409 "==>bdb_modrdn: parent dn=\"\" \n", 0, 0, 0 );
411 Debug( LDAP_DEBUG_TRACE,
412 "bdb_modrdn: parent dn=\"\"\n",
418 LDAP_LOG ( OPERATION, ERR,
419 "==>bdb_modrdn: no parent, not root &\"\" is not "
420 "suffix\n", 0, 0, 0 );
422 Debug( LDAP_DEBUG_TRACE,
423 "bdb_modrdn: no parent, not root "
424 "& \"\" is not suffix\n",
427 text = "no write access to old parent";
428 rc = LDAP_INSUFFICIENT_ACCESS;
434 new_parent_dn = &p_dn; /* New Parent unless newSuperior given */
436 if ( newSuperior != NULL ) {
438 LDAP_LOG ( OPERATION, DETAIL1,
439 "==>bdb_modrdn: new parent \"%s\" requested...\n",
440 newSuperior->bv_val, 0, 0 );
442 Debug( LDAP_DEBUG_TRACE,
443 "bdb_modrdn: new parent \"%s\" requested...\n",
444 newSuperior->bv_val, 0, 0 );
447 /* newSuperior == oldParent? */
448 if( dn_match( &p_ndn, nnewSuperior ) ) {
450 LDAP_LOG( BACK_BDB, INFO, "bdb_back_modrdn: "
451 "new parent \"%s\" same as the old parent \"%s\"\n",
452 newSuperior->bv_val, p_dn.bv_val, 0 );
454 Debug( LDAP_DEBUG_TRACE, "bdb_back_modrdn: "
455 "new parent \"%s\" same as the old parent \"%s\"\n",
456 newSuperior->bv_val, p_dn.bv_val, 0 );
458 newSuperior = NULL; /* ignore newSuperior */
462 if ( newSuperior != NULL ) {
463 if ( newSuperior->bv_len ) {
465 np_ndn = nnewSuperior;
467 /* newSuperior == oldParent?, if so ==> ERROR */
468 /* newSuperior == entry being moved?, if so ==> ERROR */
469 /* Get Entry with dn=newSuperior. Does newSuperior exist? */
471 rc = bdb_dn2entry_r( be,
472 ltid, nnewSuperior, &np, NULL, 0, locker, &lock );
478 case DB_LOCK_DEADLOCK:
479 case DB_LOCK_NOTGRANTED:
482 text = "ldap server busy";
486 text = "internal error";
492 LDAP_LOG ( OPERATION, DETAIL1,
493 "==>bdb_modrdn: newSup(ndn=%s) not here!\n",
494 np_ndn->bv_val, 0, 0 );
496 Debug( LDAP_DEBUG_TRACE,
497 "bdb_modrdn: newSup(ndn=%s) not here!\n",
498 np_ndn->bv_val, 0, 0);
500 text = "new superior not found";
506 LDAP_LOG ( OPERATION, DETAIL1,
507 "==>bdb_modrdn: wr to new parent OK np=%p, id=%ld\n",
508 np, (long) np->e_id, 0 );
510 Debug( LDAP_DEBUG_TRACE,
511 "bdb_modrdn: wr to new parent OK np=%p, id=%ld\n",
512 np, (long) np->e_id, 0 );
515 /* check newSuperior for "children" acl */
516 rc = access_allowed( be, conn, op, np, children,
517 NULL, ACL_WRITE, NULL );
520 switch( opinfo.boi_err ) {
521 case DB_LOCK_DEADLOCK:
522 case DB_LOCK_NOTGRANTED:
527 LDAP_LOG ( OPERATION, DETAIL1,
528 "==>bdb_modrdn: no wr to newSup children\n", 0, 0, 0 );
530 Debug( LDAP_DEBUG_TRACE,
531 "bdb_modrdn: no wr to newSup children\n",
534 text = "no write access to new superior's children";
535 rc = LDAP_INSUFFICIENT_ACCESS;
540 if ( is_entry_alias( np ) ) {
541 /* parent is an alias, don't allow add */
543 LDAP_LOG ( OPERATION, DETAIL1,
544 "==>bdb_modrdn: entry is alias\n", 0, 0, 0 );
546 Debug( LDAP_DEBUG_TRACE, "bdb_modrdn: entry is alias\n",
549 text = "new superior is an alias";
550 rc = LDAP_ALIAS_PROBLEM;
555 if ( is_entry_referral( np ) ) {
556 /* parent is a referral, don't allow add */
558 LDAP_LOG ( OPERATION, DETAIL1,
559 "==>bdb_modrdn: entry is referral\n", 0, 0, 0 );
561 Debug( LDAP_DEBUG_TRACE, "bdb_modrdn: entry is referral\n",
564 text = "new superior is a referral";
570 if ( isroot == -1 ) {
571 isroot = be_isroot( be, &op->o_ndn );
576 /* no parent, modrdn entry directly under root */
578 if ( be_issuffix( be, (struct berval *)&slap_empty_bv )
579 || be_isupdate( be, &op->o_ndn ) ) {
580 np = (Entry *)&slap_entry_root;
582 /* check parent for "children" acl */
583 rc = access_allowed( be, conn, op, np,
584 children, NULL, ACL_WRITE, NULL );
589 switch( opinfo.boi_err ) {
590 case DB_LOCK_DEADLOCK:
591 case DB_LOCK_NOTGRANTED:
595 rc = LDAP_INSUFFICIENT_ACCESS;
597 LDAP_LOG ( OPERATION, ERR,
598 "==>bdb_modrdn: no access to superior\n", 0, 0, 0 );
600 Debug( LDAP_DEBUG_TRACE,
601 "no access to new superior\n",
604 text = "no write access to new superior's children";
609 LDAP_LOG ( OPERATION, DETAIL1,
610 "bdb_modrdn: wr to children entry \"\" OK\n", 0, 0, 0 );
612 Debug( LDAP_DEBUG_TRACE,
613 "bdb_modrdn: wr to children of entry \"\" OK\n",
619 LDAP_LOG ( OPERATION, ERR,
620 "bdb_modrdn: new superior=\"\", not root & \"\" "
621 "is not suffix\n", 0, 0, 0 );
623 Debug( LDAP_DEBUG_TRACE,
624 "bdb_modrdn: new superior=\"\", not root "
625 "& \"\" is not suffix\n",
628 text = "no write access to new superior's children";
629 rc = LDAP_INSUFFICIENT_ACCESS;
635 LDAP_LOG ( OPERATION, DETAIL1,
636 "bdb_modrdn: new superior=\"\"\n", 0, 0, 0 );
638 Debug( LDAP_DEBUG_TRACE,
639 "bdb_modrdn: new superior=\"\"\n",
645 LDAP_LOG ( OPERATION, DETAIL1,
646 "bdb_modrdn: wr to new parent's children OK\n", 0, 0, 0 );
648 Debug( LDAP_DEBUG_TRACE,
649 "bdb_modrdn: wr to new parent's children OK\n",
653 new_parent_dn = np_dn;
656 /* Build target dn and make sure target entry doesn't exist already. */
657 build_new_dn( &new_dn, new_parent_dn, newrdn );
659 dnNormalize2( NULL, &new_dn, &new_ndn );
662 LDAP_LOG ( OPERATION, RESULTS,
663 "bdb_modrdn: new ndn=%s\n", new_ndn.bv_val, 0, 0 );
665 Debug( LDAP_DEBUG_TRACE, "bdb_modrdn: new ndn=%s\n",
666 new_ndn.bv_val, 0, 0 );
669 rc = bdb_dn2id ( be, ltid, &new_ndn, &id, 0 );
671 case DB_LOCK_DEADLOCK:
672 case DB_LOCK_NOTGRANTED:
677 rc = LDAP_ALREADY_EXISTS;
681 text = "internal error";
685 /* Get attribute type and attribute value of our new rdn, we will
686 * need to add that to our new entry
688 if ( ldap_bv2rdn( newrdn, &new_rdn, (char **)&text,
689 LDAP_DN_FORMAT_LDAP ) )
692 LDAP_LOG ( OPERATION, ERR,
693 "bdb_modrdn: can't figure out "
694 "type(s)/values(s) of newrdn\n",
697 Debug( LDAP_DEBUG_TRACE,
698 "bdb_modrdn: can't figure out "
699 "type(s)/values(s) of newrdn\n",
702 rc = LDAP_INVALID_DN_SYNTAX;
703 text = "unknown type(s) used in RDN";
708 LDAP_LOG ( OPERATION, RESULTS,
709 "bdb_modrdn: new_rdn_type=\"%s\", "
710 "new_rdn_val=\"%s\"\n",
711 new_rdn[ 0 ][ 0 ]->la_attr.bv_val,
712 new_rdn[ 0 ][ 0 ]->la_value.bv_val, 0 );
714 Debug( LDAP_DEBUG_TRACE,
715 "bdb_modrdn: new_rdn_type=\"%s\", "
716 "new_rdn_val=\"%s\"\n",
717 new_rdn[ 0 ][ 0 ]->la_attr.bv_val,
718 new_rdn[ 0 ][ 0 ]->la_value.bv_val, 0 );
721 if ( deleteoldrdn ) {
722 if ( ldap_bv2rdn( dn, &old_rdn, (char **)&text,
723 LDAP_DN_FORMAT_LDAP ) )
726 LDAP_LOG ( OPERATION, ERR,
727 "bdb_modrdn: can't figure out "
728 "type(s)/values(s) of old_rdn\n",
731 Debug( LDAP_DEBUG_TRACE,
732 "bdb_modrdn: can't figure out "
733 "the old_rdn type(s)/value(s)\n",
737 text = "cannot parse RDN from old DN";
742 /* prepare modlist of modifications from old/new rdn */
743 rc = slap_modrdn2mods( be, conn, op, e, old_rdn, new_rdn,
744 deleteoldrdn, &mod );
745 if ( rc != LDAP_SUCCESS ) {
750 rc = bdb_dn2id_delete( be, ltid, p_ndn.bv_val, e );
753 case DB_LOCK_DEADLOCK:
754 case DB_LOCK_NOTGRANTED:
758 text = "DN index delete fail";
762 (void) bdb_cache_delete_entry(&bdb->bi_cache, e);
764 /* Binary format uses a single contiguous block, cannot
765 * free individual fields. Leave new_dn/new_ndn set so
766 * they can be individually freed later.
769 e->e_nname = new_ndn;
771 new_dn.bv_val = NULL;
772 new_ndn.bv_val = NULL;
775 rc = bdb_dn2id_add( be, ltid, np_ndn, e );
778 case DB_LOCK_DEADLOCK:
779 case DB_LOCK_NOTGRANTED:
783 text = "DN index add failed";
787 #if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
788 if ( rc == LDAP_SUCCESS && !op->o_noop ) {
789 LDAP_LIST_FOREACH ( ps_list, &bdb->psearch_list, link ) {
790 bdb_psearch(be, conn, op, ps_list, e, LDAP_PSEARCH_BY_PREMODIFY );
796 rc = bdb_modify_internal( be, conn, op, ltid, &mod[0], e,
797 &text, textbuf, textlen );
799 if( rc != LDAP_SUCCESS ) {
800 if ( ( rc == LDAP_INSUFFICIENT_ACCESS ) && opinfo.boi_err ) {
804 case DB_LOCK_DEADLOCK:
805 case DB_LOCK_NOTGRANTED:
812 rc = bdb_id2entry_update( be, ltid, e );
815 case DB_LOCK_DEADLOCK:
816 case DB_LOCK_NOTGRANTED:
820 text = "entry update failed";
825 if(( rc=TXN_ABORT( ltid )) != 0 ) {
826 text = "txn_abort (no-op) failed";
833 char gid[DB_XIDDATASIZE];
835 snprintf( gid, sizeof( gid ), "%s-%08lx-%08lx",
836 bdb_uuid.bv_val, (long) op->o_connid, (long) op->o_opid );
838 if(( rc=TXN_PREPARE( ltid, gid )) != 0 ) {
839 text = "txn_prepare failed";
841 if( bdb_cache_update_entry(&bdb->bi_cache, e) == -1 ) {
842 if(( rc=TXN_ABORT( ltid )) != 0 ) {
843 text ="cache update & txn_abort failed";
846 text = "cache update failed";
850 if(( rc=TXN_COMMIT( ltid, 0 )) != 0 ) {
851 text = "txn_commit failed";
860 op->o_private = NULL;
862 if( rc == LDAP_SUCCESS ) {
864 LDAP_LOG ( OPERATION, RESULTS,
865 "bdb_modrdn: rdn modified%s id=%08lx dn=\"%s\"\n",
866 op->o_noop ? " (no-op)" : "", e->e_id, e->e_dn );
868 Debug(LDAP_DEBUG_TRACE,
869 "bdb_modrdn: rdn modified%s id=%08lx dn=\"%s\"\n",
870 op->o_noop ? " (no-op)" : "", e->e_id, e->e_dn );
874 bdb_cache_entry_commit( e );
879 LDAP_LOG ( OPERATION, RESULTS, "bdb_modrdn: %s : %s (%d)\n",
880 text, db_strerror(rc), rc );
882 Debug( LDAP_DEBUG_TRACE, "bdb_add: %s : %s (%d)\n",
883 text, db_strerror(rc), rc );
889 send_ldap_result( conn, op, rc,
890 NULL, text, NULL, NULL );
892 #if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
893 if ( rc == LDAP_SUCCESS && !op->o_noop ) {
894 /* Loop through in-scope entries for each psearch spec */
895 LDAP_LIST_FOREACH ( ps_list, &bdb->psearch_list, link ) {
896 bdb_psearch( be, conn, op, ps_list, e, LDAP_PSEARCH_BY_MODIFY );
898 pm_list = LDAP_LIST_FIRST(&op->premodify_list);
899 while ( pm_list != NULL ) {
900 bdb_psearch(be, conn, op, pm_list->ps->op,
901 e, LDAP_PSEARCH_BY_SCOPEOUT);
902 LDAP_LIST_REMOVE ( pm_list, link );
904 pm_list = LDAP_LIST_NEXT ( pm_list, link );
910 if( rc == LDAP_SUCCESS && bdb->bi_txn_cp ) {
911 ldap_pvt_thread_yield();
912 TXN_CHECKPOINT( bdb->bi_dbenv,
913 bdb->bi_txn_cp_kbyte, bdb->bi_txn_cp_min, 0 );
917 if( new_dn.bv_val != NULL ) free( new_dn.bv_val );
918 if( new_ndn.bv_val != NULL ) free( new_ndn.bv_val );
920 /* LDAP v2 supporting correct attribute handling. */
921 if ( new_rdn != NULL ) {
922 ldap_rdnfree( new_rdn );
924 if ( old_rdn != NULL ) {
925 ldap_rdnfree( old_rdn );
929 for (; mod; mod=tmp ) {
935 /* LDAP v3 Support */
937 /* free new parent and reader lock */
938 bdb_unlocked_cache_return_entry_r(&bdb->bi_cache, np);
942 /* free parent and reader lock */
943 bdb_unlocked_cache_return_entry_r(&bdb->bi_cache, p);
948 bdb_unlocked_cache_return_entry_w( &bdb->bi_cache, e);
952 #if defined(LDAP_CLIENT_UPDATE) || defined(LDAP_SYNC)
953 pm_list = LDAP_LIST_FIRST(&op->premodify_list);
954 while ( pm_list != NULL ) {
955 LDAP_LIST_REMOVE ( pm_list, link );
957 pm_list = LDAP_LIST_NEXT ( pm_list, link );
962 op->o_private = NULL;
965 return ( ( rc == LDAP_SUCCESS ) ? noop : rc );