1 /* modrdn.c - bdb backend modrdn routine */
4 * Copyright 1998-2002 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 struct berval p_dn, p_ndn;
32 struct berval new_dn = {0, NULL}, new_ndn = {0, NULL};
38 char textbuf[SLAP_TEXT_BUFLEN];
39 size_t textlen = sizeof textbuf;
41 struct bdb_op_info opinfo;
45 LDAPRDN *new_rdn = NULL;
46 LDAPRDN *old_rdn = NULL;
48 Entry *np = NULL; /* newSuperior Entry */
49 struct berval *np_dn = NULL; /* newSuperior dn */
50 struct berval *np_ndn = NULL; /* newSuperior ndn */
51 struct berval *new_parent_dn = NULL; /* np_dn, p_dn, or NULL */
53 /* Used to interface with bdb_modify_internal() */
54 Modifications *mod = NULL; /* Used to delete old rdn */
56 int manageDSAit = get_manageDSAit( op );
59 LDAP_LOG (( "modrdn", LDAP_LEVEL_ENTRY, "==>bdb_modrdn(%s,%s,%s)\n",
60 dn->bv_val,newrdn->bv_val,
61 newSuperior ? newSuperior->bv_val : "NULL" ));
63 Debug( LDAP_DEBUG_TRACE, "==>bdb_modrdn(%s,%s,%s)\n",
64 dn->bv_val, newrdn->bv_val,
65 newSuperior ? newSuperior->bv_val : "NULL" );
69 if( newSuperior != NULL ) {
70 rc = LDAP_UNWILLING_TO_PERFORM;
71 text = "newSuperior not implemented (yet)";
77 retry: /* transaction retry */
79 bdb_cache_delete_entry(&bdb->bi_cache, e);
80 bdb_cache_return_entry_w(&bdb->bi_cache, e);
83 bdb_cache_return_entry_r(&bdb->bi_cache, p);
86 bdb_cache_return_entry_r(&bdb->bi_cache, np);
89 LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "==>bdb_modrdn: retrying...\n"));
91 Debug( LDAP_DEBUG_TRACE, "==>bdb_modrdn: retrying...\n", 0, 0, 0 );
93 rc = TXN_ABORT( ltid );
98 text = "internal error";
101 ldap_pvt_thread_yield();
104 /* begin transaction */
105 rc = TXN_BEGIN( bdb->bi_dbenv, NULL, <id,
106 bdb->bi_db_opflags );
110 LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "==>bdb_modrdn: txn_begin failed: %s (%d)\n", db_strerror(rc), rc ));
112 Debug( LDAP_DEBUG_TRACE,
113 "bdb_delete: txn_begin failed: %s (%d)\n",
114 db_strerror(rc), rc, 0 );
117 text = "internal error";
122 opinfo.boi_txn = ltid;
124 op->o_private = &opinfo;
127 rc = bdb_dn2entry_w( be, ltid, ndn, &e, &matched, 0 );
133 case DB_LOCK_DEADLOCK:
134 case DB_LOCK_NOTGRANTED:
137 text = "ldap server busy";
141 text = "internal error";
146 char* matched_dn = NULL;
149 if( matched != NULL ) {
150 matched_dn = ch_strdup( matched->e_dn );
151 refs = is_entry_referral( matched )
152 ? get_entry_referrals( be, conn, op, matched )
154 bdb_cache_return_entry_r( &bdb->bi_cache, matched );
158 refs = referral_rewrite( default_referral,
159 NULL, dn, LDAP_SCOPE_DEFAULT );
162 send_ldap_result( conn, op, rc = LDAP_REFERRAL,
163 matched_dn, NULL, refs, NULL );
165 ber_bvarray_free( refs );
171 if (!manageDSAit && is_entry_referral( e ) ) {
172 /* parent is a referral, don't allow add */
173 /* parent is an alias, don't allow add */
174 BerVarray refs = get_entry_referrals( be,
178 LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "==>bdb_modrdn: entry %s is referral \n", e->e_dn ));
180 Debug( LDAP_DEBUG_TRACE, "bdb_modrdn: entry %s is referral\n",
184 send_ldap_result( conn, op, rc = LDAP_REFERRAL,
185 e->e_dn, NULL, refs, NULL );
187 ber_bvarray_free( refs );
191 if ( be_issuffix( be, &e->e_nname ) ) {
192 p_ndn = slap_empty_bv;
194 dnParent( &e->e_nname, &p_ndn );
197 if ( p_ndn.bv_len != 0 ) {
198 /* Make sure parent entry exist and we can write its
201 rc = bdb_dn2entry_r( be, ltid, &p_ndn, &p, NULL, 0 );
207 case DB_LOCK_DEADLOCK:
208 case DB_LOCK_NOTGRANTED:
211 text = "ldap server busy";
215 text = "internal error";
221 LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "==>bdb_modrdn: parent does not exist\n" ));
223 Debug( LDAP_DEBUG_TRACE, "bdb_modrdn: parent does not exist\n",
230 /* check parent for "children" acl */
231 if ( ! access_allowed( be, conn, op, p,
232 children, NULL, ACL_WRITE, NULL ) )
235 LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "==>bdb_modrdn: no access to parent\n" ));
237 Debug( LDAP_DEBUG_TRACE, "no access to parent\n", 0,
240 send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
241 NULL, NULL, NULL, NULL );
246 LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "==>bdb_modrdn: wr to children %s is OK\n", p_ndn.bv_val ));
248 Debug( LDAP_DEBUG_TRACE,
249 "bdb_modrdn: wr to children of entry %s OK\n",
250 p_ndn.bv_val, 0, 0 );
253 if ( p_ndn.bv_val == slap_empty_bv.bv_val ) {
254 p_dn = slap_empty_bv;
256 dnParent( &e->e_name, &p_dn );
260 LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "==>bdb_modrdn: parent dn=%s\n", p_dn.bv_val ));
262 Debug( LDAP_DEBUG_TRACE,
263 "bdb_modrdn: parent dn=%s\n",
268 /* no parent, modrdn entry directly under root */
269 isroot = be_isroot( be, &op->o_ndn );
271 if ( be_issuffix( be, (struct berval *)&slap_empty_bv )
272 || be_isupdate( be, &op->o_ndn ) ) {
274 p = (Entry *)&slap_entry_root;
276 /* check parent for "children" acl */
277 rc = access_allowed( be, conn, op, p,
278 children, NULL, ACL_WRITE, NULL );
285 LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "==>bdb_modrdn: no access to parent\n" ));
287 Debug( LDAP_DEBUG_TRACE,
288 "no access to parent\n",
291 send_ldap_result( conn, op,
292 LDAP_INSUFFICIENT_ACCESS,
293 NULL, NULL, NULL, NULL );
298 LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "==>bdb_modrdn: wr to children of entry \"\" OK\n", p_dn.bv_val ));
300 Debug( LDAP_DEBUG_TRACE,
301 "bdb_modrdn: wr to children of entry \"\" OK\n",
309 LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "==>bdb_modrdn: parent dn=\"\" \n" ));
311 Debug( LDAP_DEBUG_TRACE,
312 "bdb_modrdn: parent dn=\"\"\n",
318 LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "==>bdb_modrdn: no parent, not root &\"\" is not suffix\n" ));
320 Debug( LDAP_DEBUG_TRACE,
321 "bdb_modrdn: no parent, not root "
322 "& \"\" is not suffix\n",
325 rc = LDAP_INSUFFICIENT_ACCESS;
331 new_parent_dn = &p_dn; /* New Parent unless newSuperior given */
333 if ( newSuperior != NULL ) {
335 LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "==>bdb_modrdn: new parent \"%s\" requested...\n", newSuperior->bv_val ));
337 Debug( LDAP_DEBUG_TRACE,
338 "bdb_modrdn: new parent \"%s\" requested...\n",
339 newSuperior->bv_val, 0, 0 );
342 if ( newSuperior->bv_len ) {
344 np_ndn = nnewSuperior;
346 /* newSuperior == oldParent?, if so ==> ERROR */
347 /* newSuperior == entry being moved?, if so ==> ERROR */
348 /* Get Entry with dn=newSuperior. Does newSuperior exist? */
350 rc = bdb_dn2entry_r( be, ltid, nnewSuperior, &np, NULL, 0 );
356 case DB_LOCK_DEADLOCK:
357 case DB_LOCK_NOTGRANTED:
360 text = "ldap server busy";
364 text = "internal error";
370 LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "==>bdb_modrdn: newSup(ndn=%s) not here!\n", np_ndn->bv_val ));
372 Debug( LDAP_DEBUG_TRACE,
373 "bdb_modrdn: newSup(ndn=%s) not here!\n",
374 np_ndn->bv_val, 0, 0);
381 LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "==>bdb_modrdn: wr to new parent OK np=%p, id=%ld\n", np, (long) np->e_id ));
383 Debug( LDAP_DEBUG_TRACE,
384 "bdb_modrdn: wr to new parent OK np=%p, id=%ld\n",
385 np, (long) np->e_id, 0 );
388 /* check newSuperior for "children" acl */
389 if ( !access_allowed( be, conn, op, np, children, NULL, ACL_WRITE, NULL ) ) {
391 LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "==>bdb_modrdn: no wr to newSup children\n" ));
393 Debug( LDAP_DEBUG_TRACE,
394 "bdb_modrdn: no wr to newSup children\n",
397 rc = LDAP_INSUFFICIENT_ACCESS;
402 if ( is_entry_alias( np ) ) {
403 /* parent is an alias, don't allow add */
405 LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "==>bdb_modrdn: entry is alias\n" ));
407 Debug( LDAP_DEBUG_TRACE, "bdb_modrdn: entry is alias\n",
411 rc = LDAP_ALIAS_PROBLEM;
416 if ( is_entry_referral( np ) ) {
417 /* parent is a referral, don't allow add */
419 LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "==>bdb_modrdn: entry is referral\n" ));
421 Debug( LDAP_DEBUG_TRACE, "bdb_modrdn: entry is referral\n",
425 rc = LDAP_OPERATIONS_ERROR;
430 if ( isroot == -1 ) {
431 isroot = be_isroot( be, &op->o_ndn );
436 /* no parent, modrdn entry directly under root */
438 if ( be_issuffix( be, (struct berval *)&slap_empty_bv )
439 || be_isupdate( be, &op->o_ndn ) ) {
440 np = (Entry *)&slap_entry_root;
442 /* check parent for "children" acl */
443 rc = access_allowed( be, conn, op, np,
444 children, NULL, ACL_WRITE, NULL );
451 LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "==>bdb_modrdn: no access to superior\n" ));
453 Debug( LDAP_DEBUG_TRACE,
454 "no access to new superior\n",
457 send_ldap_result( conn, op,
458 LDAP_INSUFFICIENT_ACCESS,
459 NULL, NULL, NULL, NULL );
464 LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "bdb_modrdn: wr to children entry \"\" OK\n" ));
466 Debug( LDAP_DEBUG_TRACE,
467 "bdb_modrdn: wr to children of entry \"\" OK\n",
473 LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "bdb_modrdn: new superior=\"\", not root & \"\" is not suffix\n" ));
475 Debug( LDAP_DEBUG_TRACE,
476 "bdb_modrdn: new superior=\"\", not root "
477 "& \"\" is not suffix\n",
480 rc = LDAP_INSUFFICIENT_ACCESS;
486 LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "bdb_modrdn: new superior=\"\"\n" ));
488 Debug( LDAP_DEBUG_TRACE,
489 "bdb_modrdn: new superior=\"\"\n",
495 LDAP_LOG (( "modrdn", LDAP_LEVEL_DETAIL1, "bdb_modrdn: wr to new parent's children OK\n" ));
497 Debug( LDAP_DEBUG_TRACE,
498 "bdb_modrdn: wr to new parent's children OK\n",
502 new_parent_dn = np_dn;
505 /* Build target dn and make sure target entry doesn't exist already. */
506 build_new_dn( &new_dn, new_parent_dn, newrdn );
508 dnNormalize2( NULL, &new_dn, &new_ndn );
511 LDAP_LOG (( "modrdn", LDAP_LEVEL_RESULTS, "bdb_modrdn: new ndn=%s\n", new_ndn.bv_val ));
513 Debug( LDAP_DEBUG_TRACE, "bdb_modrdn: new ndn=%s\n",
514 new_ndn.bv_val, 0, 0 );
517 rc = bdb_dn2id ( be, ltid, &new_ndn, &id );
519 case DB_LOCK_DEADLOCK:
520 case DB_LOCK_NOTGRANTED:
525 rc = LDAP_ALREADY_EXISTS;
529 text = "internal error";
534 LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "bdb_modrdn: new ndn=%s does not exist\n", new_ndn.bv_val ));
536 Debug( LDAP_DEBUG_TRACE,
537 "bdb_modrdn: new ndn=%s does not exist\n",
538 new_ndn.bv_val, 0, 0 );
541 /* Get attribute type and attribute value of our new rdn, we will
542 * need to add that to our new entry
544 if ( ldap_bv2rdn( newrdn, &new_rdn, (char **)&text,
545 LDAP_DN_FORMAT_LDAP ) )
548 LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "bdb_modrdn: can't figure out type(s)/values(s) of newrdn\n" ));
550 Debug( LDAP_DEBUG_TRACE,
551 "bdb_modrdn: can't figure out type(s)/values(s) "
552 "of newrdn\n", 0, 0, 0 );
554 rc = LDAP_OPERATIONS_ERROR;
555 text = "unknown type(s) used in RDN";
560 LDAP_LOG (( "modrdn", LDAP_LEVEL_RESULTS, "bdb_modrdn: new_rdn_type=\"%s\", new_rdn_val=\"%s\"\n", new_rdn[0][0]->la_attr.bv_val, new_rdn[0][0]->la_value.bv_val ));
562 Debug( LDAP_DEBUG_TRACE,
563 "bdb_modrdn: new_rdn_type=\"%s\", new_rdn_val=\"%s\"\n",
564 new_rdn[0][0]->la_attr.bv_val, new_rdn[0][0]->la_value.bv_val, 0 );
567 if ( ldap_bv2rdn( dn, &old_rdn, (char **)&text,
568 LDAP_DN_FORMAT_LDAP ) )
571 LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "bdb_modrdn: can't figure out type(s)/values(s) of old_rdn\n" ));
573 Debug( LDAP_DEBUG_TRACE,
574 "bdb_back_modrdn: can't figure out the old_rdn "
575 "type(s)/value(s)\n", 0, 0, 0 );
578 text = "cannot parse RDN from old DN";
583 if ( newSuperior == NULL
584 && charray_strcasecmp( ( const char ** )old_rdn_types,
585 ( const char ** )new_rdn_types ) != 0 ) {
586 /* Not a big deal but we may say something */
588 LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "bdb_modrdn: old_rdn_type(s)=%s, new_rdn_type(s)=%s do not match\n", old_rdn_types[ 0 ], new_rdn_types[ 0 ] ));
590 Debug( LDAP_DEBUG_TRACE,
591 "bdb_modrdn: old_rdn_type(s)=%s, new_rdn_type(s)=%s "
593 old_rdn_types[ 0 ], new_rdn_types[ 0 ], 0 );
598 /* Add new attribute values to the entry */
599 for ( a_cnt = 0; new_rdn[0][ a_cnt ]; a_cnt++ ) {
601 AttributeDescription *desc = NULL;
602 Modifications *mod_tmp;
604 rc = slap_bv2ad( &new_rdn[0][ a_cnt ]->la_attr, &desc, &text );
606 if ( rc != LDAP_SUCCESS ) {
608 LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "bdb_modrdn: %s: %s (new)\n", text, new_rdn[0][a_cnt]->la_attr.bv_val ));
610 Debug( LDAP_DEBUG_TRACE,
611 "bdb_modrdn: %s: %s (new)\n",
612 text, new_rdn[0][ a_cnt ]->la_attr.bv_val, 0 );
617 /* ACL check of newly added attrs */
618 if ( !access_allowed( be, conn, op, e, desc,
619 &new_rdn[0][ a_cnt ]->la_value, ACL_WRITE, NULL ) ) {
621 LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "bdb_modrdn: access to attr \"%s\" (new) not allowed\n", new_rdn[0][a_cnt]->la_attr.bv_val ));
623 Debug( LDAP_DEBUG_TRACE,
624 "bdb_modrdn: access to attr \"%s\" "
625 "(new) not allowed\n",
626 new_rdn[0][ a_cnt ]->la_attr.bv_val, 0, 0 );
628 rc = LDAP_INSUFFICIENT_ACCESS;
632 /* Apply modification */
633 mod_tmp = ( Modifications * )ch_malloc( sizeof( Modifications )
634 + 2 * sizeof( struct berval ) );
635 mod_tmp->sml_desc = desc;
636 mod_tmp->sml_bvalues = ( BerVarray )( mod_tmp + 1 );
637 mod_tmp->sml_bvalues[ 0 ] = new_rdn[0][ a_cnt ]->la_value;
638 mod_tmp->sml_bvalues[ 1 ].bv_val = NULL;
639 mod_tmp->sml_op = SLAP_MOD_SOFTADD;
640 mod_tmp->sml_next = mod;
644 /* Remove old rdn value if required */
645 if ( deleteoldrdn ) {
646 /* Get value of old rdn */
647 if ( old_rdn == NULL) {
649 LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "bdb_modrdn: can't figure out old RDN values(s) from old RDN\n" ));
651 Debug( LDAP_DEBUG_TRACE,
652 "bdb_modrdn: can't figure out old RDN value(s) "
653 "from old RDN\n", 0, 0, 0 );
656 text = "could not parse value(s) from old RDN";
660 for ( d_cnt = 0; old_rdn[0][ d_cnt ]; d_cnt++ ) {
662 AttributeDescription *desc = NULL;
663 Modifications *mod_tmp;
665 rc = slap_bv2ad( &old_rdn[0][ d_cnt ]->la_attr,
668 if ( rc != LDAP_SUCCESS ) {
670 LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "bdb_modrdn: %s: %s (old)\n", text, old_rdn[0][d_cnt]->la_attr.bv_val ));
672 Debug( LDAP_DEBUG_TRACE,
673 "bdb_modrdn: %s: %s (old)\n",
674 text, old_rdn[0][ d_cnt ]->la_attr.bv_val, 0 );
679 /* ACL check of newly added attrs */
680 if ( !access_allowed( be, conn, op, e, desc,
681 &old_rdn[0][d_cnt]->la_value, ACL_WRITE, NULL ) ) {
683 LDAP_LOG (( "modrdn", LDAP_LEVEL_ERR, "bdb_modrdn: access to attr \"%s\" (old) not allowed\n", old_rdn[0][d_cnt]->la_attr.bv_val ));
685 Debug( LDAP_DEBUG_TRACE,
686 "bdb_modrdn: access to attr \"%s\" "
687 "(old) not allowed\n",
688 old_rdn[0][ d_cnt ]->la_attr.bv_val, 0, 0 );
690 rc = LDAP_INSUFFICIENT_ACCESS;
694 /* Apply modification */
695 mod_tmp = ( Modifications * )ch_malloc( sizeof( Modifications )
696 + 2 * sizeof ( struct berval ) );
697 mod_tmp->sml_desc = desc;
698 mod_tmp->sml_bvalues = ( BerVarray )(mod_tmp+1);
699 mod_tmp->sml_bvalues[ 0 ] = old_rdn[0][ d_cnt ]->la_value;
700 mod_tmp->sml_bvalues[ 1 ].bv_val = NULL;
701 mod_tmp->sml_op = LDAP_MOD_DELETE;
702 mod_tmp->sml_next = mod;
708 rc = bdb_dn2id_delete( be, ltid, p_ndn.bv_val, e );
711 case DB_LOCK_DEADLOCK:
712 case DB_LOCK_NOTGRANTED:
716 text = "DN index delete fail";
720 (void) bdb_cache_delete_entry(&bdb->bi_cache, e);
722 /* Binary format uses a single contiguous block, cannot
723 * free individual fields. Leave new_dn/new_ndn set so
724 * they can be individually freed later.
727 e->e_nname = new_ndn;
729 new_dn.bv_val = NULL;
730 new_ndn.bv_val = NULL;
733 rc = bdb_dn2id_add( be, ltid, np_ndn, e );
736 case DB_LOCK_DEADLOCK:
737 case DB_LOCK_NOTGRANTED:
741 text = "DN index add failed";
746 rc = bdb_modify_internal( be, conn, op, ltid, &mod[0], e,
747 &text, textbuf, textlen );
749 if( rc != LDAP_SUCCESS ) {
751 case DB_LOCK_DEADLOCK:
752 case DB_LOCK_NOTGRANTED:
759 rc = bdb_id2entry_update( be, ltid, e );
762 case DB_LOCK_DEADLOCK:
763 case DB_LOCK_NOTGRANTED:
767 text = "entry update failed";
772 if(( rc=TXN_ABORT( ltid )) != 0 ) {
773 text = "txn_abort (no-op) failed";
779 char gid[DB_XIDDATASIZE];
781 snprintf( gid, sizeof( gid ), "%s-%08lx-%08lx",
782 bdb_uuid.bv_val, (long) op->o_connid, (long) op->o_opid );
784 if(( rc=TXN_PREPARE( ltid, gid )) != 0 ) {
785 text = "txn_prepare failed";
787 if( bdb_cache_update_entry(&bdb->bi_cache, e) == -1 ) {
788 if(( rc=TXN_ABORT( ltid )) != 0 ) {
789 text ="cache update & txn_abort failed";
792 text = "cache update failed";
796 if(( rc=TXN_COMMIT( ltid, 0 )) != 0 ) {
797 text = "txn_commit failed";
806 op->o_private = NULL;
808 if( rc == LDAP_SUCCESS ) {
810 LDAP_LOG (( "modrdn", LDAP_LEVEL_RESULTS, "bdb_modrdn: rdn modified%s id=%08lx dn=\"%s\"\n", op->o_noop ? " (no-op)" : "", e->e_id, e->e_dn ));
812 Debug(LDAP_DEBUG_TRACE,
813 "bdb_modrdn: rdn modified%s id=%08lx dn=\"%s\"\n",
814 op->o_noop ? " (no-op)" : "", e->e_id, e->e_dn );
817 bdb_cache_entry_commit( e );
821 LDAP_LOG (( "modrdn", LDAP_LEVEL_RESULTS, "bdb_modrdn: %s : %s (%d)\n", text, db_strerror(rc), rc ));
823 Debug( LDAP_DEBUG_TRACE, "bdb_add: %s : %s (%d)\n",
824 text, db_strerror(rc), rc );
830 send_ldap_result( conn, op, rc,
831 NULL, text, NULL, NULL );
833 if( rc == LDAP_SUCCESS && bdb->bi_txn_cp ) {
834 ldap_pvt_thread_yield();
835 TXN_CHECKPOINT( bdb->bi_dbenv,
836 bdb->bi_txn_cp_kbyte, bdb->bi_txn_cp_min, 0 );
840 if( new_dn.bv_val != NULL ) free( new_dn.bv_val );
841 if( new_ndn.bv_val != NULL ) free( new_ndn.bv_val );
843 /* LDAP v2 supporting correct attribute handling. */
844 if( new_rdn != NULL ) ldap_rdnfree( new_rdn );
845 if( old_rdn != NULL ) ldap_rdnfree( old_rdn );
848 for (; mod; mod=tmp ) {
854 /* LDAP v3 Support */
856 /* free new parent and reader lock */
857 bdb_cache_return_entry_r(&bdb->bi_cache, np);
861 /* free parent and reader lock */
862 bdb_cache_return_entry_r(&bdb->bi_cache, p);
867 bdb_cache_return_entry_w( &bdb->bi_cache, e );
872 op->o_private = NULL;