]> git.sur5r.net Git - openldap/commitdiff
working modrdn...
authorKurt Zeilenga <kurt@openldap.org>
Thu, 28 Sep 2000 02:42:20 +0000 (02:42 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Thu, 28 Sep 2000 02:42:20 +0000 (02:42 +0000)
(need to fix leaks on transaction retries)

servers/slapd/back-bdb/dn2id.c
servers/slapd/back-bdb/modrdn.c

index af380ed06b9dfcb897861ecc1cac5ca1cd552272..f7f573eabdd23d428467b6f0783ad4ce5b23d1ad 100644 (file)
@@ -17,8 +17,7 @@ bdb_dn2id_add(
        BackendDB       *be,
        DB_TXN *txn,
        const char      *dn,
-       ID              id
-)
+       ID              id )
 {
        int             rc;
        DBT             key, data;
@@ -212,8 +211,13 @@ bdb_dn2id(
        /* fetch it */
        rc = db->get( db, txn, &key, &data, 0 );
 
-       Debug( LDAP_DEBUG_TRACE, "<= bdb_dn2id: id=0x%08lx: %s (%d)\n",
-               *id, db_strerror( rc ), rc );
+       if( rc != 0 ) {
+               Debug( LDAP_DEBUG_TRACE, "<= bdb_dn2id: get failed: %s (%d)\n",
+                       db_strerror( rc ), rc, 0 );
+       } else {
+               Debug( LDAP_DEBUG_TRACE, "<= bdb_dn2id: got id=0x%08lx\n",
+                       *id, 0, 0 );
+       }
 
        ch_free( key.data );
        return rc;
index 39e9fd1eb2d2fd428dc4f1d8eeb749037868ba2c..085bed9ac9392bb671afcc8881bb4bcb98608d44 100644 (file)
@@ -300,16 +300,18 @@ retry:    rc = txn_abort( ltid );
                new_ndn, 0, 0 );
 
        rc = bdb_dn2id ( be, ltid, new_ndn, &id );
-       if( rc != 0 ) {
-               switch( rc ) {
-               case DB_LOCK_DEADLOCK:
-               case DB_LOCK_NOTGRANTED:
-                       goto retry;
-               default:
-                       rc = LDAP_OTHER;
-                       text = "internal error";
-               }
-
+       switch( rc ) {
+       case DB_LOCK_DEADLOCK:
+       case DB_LOCK_NOTGRANTED:
+               goto retry;
+       case DB_NOTFOUND:
+               break;
+       case 0:
+               rc = LDAP_ALREADY_EXISTS;
+               goto return_results;
+       default:
+               rc = LDAP_OTHER;
+               text = "internal error";
                goto return_results;
        }