]> git.sur5r.net Git - openldap/commitdiff
Got base entry...
authorKurt Zeilenga <kurt@openldap.org>
Tue, 26 Sep 2000 19:26:08 +0000 (19:26 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 26 Sep 2000 19:26:08 +0000 (19:26 +0000)
servers/slapd/back-bdb/add.c
servers/slapd/back-bdb/dn2id.c
servers/slapd/back-bdb/id2entry.c
servers/slapd/back-bdb/search.c

index 6fb0e2c65675ae56f2c65b6a9400fe2ef9a44f0f..0fbb162387903d08ae2abcea985f7b311a66148d 100644 (file)
@@ -251,7 +251,7 @@ retry:      rc = txn_abort( ltid );
        ltid = NULL;
        op->o_private = NULL;
 
-       if( rc == 0 ) {
+       if( rc != 0 ) {
                Debug( LDAP_DEBUG_TRACE,
                        "bdb_add: txn_commit failed: %s (%d)\n",
                        db_strerror(rc), rc, 0 );
index fa4fe3fc0598041c0365f3b3782f8f70c13bfa77..2876f438f16e1b3773f90282829338751c66ea11 100644 (file)
@@ -25,7 +25,8 @@ bdb_dn2id_add(
        struct bdb_info *bdb = (struct bdb_info *) be->be_private;
        DB *db = bdb->bi_dn2id->bdi_db;
 
-       Debug( LDAP_DEBUG_TRACE, "=> bdb_dn2id_add( \"%s\", %ld )\n", dn, id, 0 );
+       Debug( LDAP_DEBUG_TRACE, "=> bdb_dn2id_add( \"%s\", 0x%08lx )\n",
+               dn, id, 0 );
        assert( id != NOID );
 
        DBTzero( &key );
@@ -111,7 +112,8 @@ bdb_dn2id_delete(
        struct bdb_info *bdb = (struct bdb_info *) be->be_private;
        DB *db = bdb->bi_dn2id->bdi_db;
 
-       Debug( LDAP_DEBUG_TRACE, "=> bdb_dn2id_delete( \"%s\", %ld )\n", dn, id, 0 );
+       Debug( LDAP_DEBUG_TRACE, "=> bdb_dn2id_delete( \"%s\", 0x%08lx )\n",
+               dn, id, 0 );
 
        DBTzero( &key );
        key.size = strlen( dn ) + 2;
@@ -210,7 +212,7 @@ bdb_dn2id(
        /* fetch it */
        rc = db->get( db, txn, &key, &data, 0 );
 
-       Debug( LDAP_DEBUG_TRACE, "<= bdb_dn2id: id=%ld: %s (%d)\n",
+       Debug( LDAP_DEBUG_TRACE, "<= bdb_dn2id: id=0x%08lx: %s (%d)\n",
                id, db_strerror( rc ), rc );
 
        ch_free( key.data );
@@ -250,6 +252,8 @@ bdb_dn2id_matched(
        while(1) {
                AC_MEMCPY( &((char *)key.data)[1], dn, key.size - 1 );
 
+               *id = NOID;
+
                /* fetch it */
                rc = db->get( db, txn, &key, &data, 0 );
 
@@ -259,6 +263,9 @@ bdb_dn2id_matched(
                        tmp = NULL;
 
                        if( pdn == NULL || *pdn == '\0' ) {
+                               Debug( LDAP_DEBUG_TRACE,
+                                       "<= bdb_dn2id_matched: no match\n",
+                                       0, 0, 0 );
                                ch_free( pdn );
                                break;
                        }
@@ -268,15 +275,27 @@ bdb_dn2id_matched(
                        key.size = strlen( dn ) + 2;
 
                } else if ( rc == 0 ) {
+                       if( data.size != sizeof( ID ) ) {
+                               Debug( LDAP_DEBUG_ANY,
+                                       "<= bdb_dn2id_matched: get size mismatch: "
+                                       "expected %ld, got %ld\n",
+                                       (long) sizeof(ID), (long) data.size, 0 );
+                               ch_free( tmp );
+                       }
+
                        if( in != dn ) {
                                *matchedDN = (char *) dn;
                        }
+
                        Debug( LDAP_DEBUG_TRACE,
-                               "<= bdb_dn2id_matched: id=%ld: %s\n",
-                               id, dn, 0 );
+                               "<= bdb_dn2id_matched: id=0x%08lx: %s\n",
+                               *id, dn, 0 );
                        break;
 
                } else {
+                       Debug( LDAP_DEBUG_ANY,
+                               "<= bdb_dn2id_matched: get failed: %s (%d)\n",
+                               db_strerror(rc), rc, 0 );
                        ch_free( tmp );
                        break;
                }
index 5eb3f7f6aa11dadbfac3616e122c375242e61be7..8fbff048d490597407d9753ce1528d70f1ad9b68 100644 (file)
@@ -73,6 +73,10 @@ int bdb_id2entry(
 
        rc = entry_decode( &bv, e );
 
+       if( rc == 0 ) {
+               (*e)->e_id = id;
+       }
+
        ch_free( data.data );
        return rc;
 }
index 901f4d4550d6e2f351fbbc55ca7eec13e57d1286..d67a89d984bee39adfd7926c5a6770193192ad1a 100644 (file)
@@ -361,7 +361,7 @@ static int base_candidate(
        Entry   *e,
        ID              *ids )
 {
-       Debug(LDAP_DEBUG_TRACE, "base_candidates: base: \"%s\" (0x08lx)\n",
+       Debug(LDAP_DEBUG_ARGS, "base_candidates: base: \"%s\" (0x%08lx)\n",
                e->e_dn, (long) e->e_id, 0);
 
        ids[0] = 1;
@@ -378,7 +378,7 @@ static int search_candidates(
        int manageDSAit,
        ID      *ids )
 {
-       Debug(LDAP_DEBUG_TRACE, "subtree_candidates: base: \"%s\" (0x08lx)\n",
+       Debug(LDAP_DEBUG_TRACE, "subtree_candidates: base: \"%s\" (0x%08lx)\n",
                e->e_dn, (long) e->e_id, 0);
 
        ids[0] = NOID;