From 75064ce91dca217a45640a35553a2e87e2f1e4b0 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 10 Dec 2001 16:59:37 +0000 Subject: [PATCH] Fix check for DN_SUBTREE on be suffix --- servers/slapd/back-bdb/dn2id.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/servers/slapd/back-bdb/dn2id.c b/servers/slapd/back-bdb/dn2id.c index 3a81a54c1d..2b1d3d6032 100644 --- a/servers/slapd/back-bdb/dn2id.c +++ b/servers/slapd/back-bdb/dn2id.c @@ -51,13 +51,15 @@ bdb_dn2id_add( goto done; } - buf[0] = DN_SUBTREE_PREFIX; - rc = bdb_idl_insert_key( be, db, txn, &key, e->e_id ); - if( rc != 0 ) { - Debug( LDAP_DEBUG_ANY, + if( !be_issuffix( be, ptr )) { + buf[0] = DN_SUBTREE_PREFIX; + rc = bdb_idl_insert_key( be, db, txn, &key, e->e_id ); + if( rc != 0 ) { + Debug( LDAP_DEBUG_ANY, "=> bdb_dn2id_add: subtree (%s) insert failed: %d\n", ptr, rc, 0 ); - goto done; + goto done; + } } pdn = dn_parent( be, ptr ); @@ -90,9 +92,6 @@ bdb_dn2id_add( } while( pdn != NULL ) { - if( be_issuffix( be, pdn )) - break; - pdn[-1] = DN_SUBTREE_PREFIX; key.size -= pdn - ptr; key.data = pdn - 1; @@ -148,13 +147,15 @@ bdb_dn2id_delete( goto done; } - buf[0] = DN_SUBTREE_PREFIX; - rc = bdb_idl_delete_key( be, db, txn, &key, e->e_id ); - if( rc != 0 ) { - Debug( LDAP_DEBUG_ANY, + if( !be_issuffix( be, ptr )) { + buf[0] = DN_SUBTREE_PREFIX; + rc = bdb_idl_delete_key( be, db, txn, &key, e->e_id ); + if( rc != 0 ) { + Debug( LDAP_DEBUG_ANY, "=> bdb_dn2id_delete: subtree (%s) delete failed: %d\n", ptr, rc, 0 ); - goto done; + goto done; + } } pdn = dn_parent( be, ptr ); @@ -188,9 +189,6 @@ bdb_dn2id_delete( } while( pdn != NULL ) { - if( be_issuffix( be, pdn )) - break; - pdn[-1] = DN_SUBTREE_PREFIX; key.size -= pdn - ptr; key.data = pdn - 1; -- 2.39.5