From 66d4377448f580fa40eb670a1b1c7c08c7459b73 Mon Sep 17 00:00:00 2001 From: Quanah Gibson-Mount Date: Tue, 7 Oct 2008 23:13:41 +0000 Subject: [PATCH] ITS#5729 --- CHANGES | 1 + servers/slapd/back-bdb/dn2id.c | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/CHANGES b/CHANGES index f1f6e53a7e..462348207b 100644 --- a/CHANGES +++ b/CHANGES @@ -30,6 +30,7 @@ OpenLDAP 2.4.12 Release (2008/10/08) Fixed slapd-bdb entry return if attr not present (ITS#5650) Fixed slapd-bdb olcDbMode syntax (ITS#5713) Fixed slapd-bdb/hdb release search entries earlier (ITS#5728) + Fixed slapd-bdb/hdb subtree search with empty suffix (ITS#5729) Fixed slapd-dnssrv memory handling (ITS#5691) Fixed slapd-ldap,slapd-meta invalid filter behavior (ITS#5614) Fixed slapd-meta memory handling (ITS#5691) diff --git a/servers/slapd/back-bdb/dn2id.c b/servers/slapd/back-bdb/dn2id.c index d28ed33f73..49a89f8dec 100644 --- a/servers/slapd/back-bdb/dn2id.c +++ b/servers/slapd/back-bdb/dn2id.c @@ -393,7 +393,8 @@ bdb_dn2idl( #ifndef BDB_MULTIPLE_SUFFIXES if ( prefix == DN_SUBTREE_PREFIX - && ( ei->bei_id == 0 || ei->bei_parent->bei_id == 0 )) { + && ( ei->bei_id == 0 || + ( ei->bei_parent->bei_id == 0 && op->o_bd->be_suffix[0].bv_len ))) { BDB_IDL_ALL(bdb, ids); return 0; } @@ -613,10 +614,12 @@ hdb_dn2id_add( tmp[1] = eip->bei_id; *ptr = DN_ONE_PREFIX; bdb_idl_cache_add_id( bdb, db, &key, e->e_id ); - *ptr = DN_SUBTREE_PREFIX; - for (; eip && eip->bei_parent->bei_id; eip = eip->bei_parent) { - tmp[1] = eip->bei_id; - bdb_idl_cache_add_id( bdb, db, &key, e->e_id ); + if ( eip->bei_parent ) { + *ptr = DN_SUBTREE_PREFIX; + for (; eip && eip->bei_parent->bei_id; eip = eip->bei_parent) { + tmp[1] = eip->bei_id; + bdb_idl_cache_add_id( bdb, db, &key, e->e_id ); + } } } @@ -711,10 +714,12 @@ func_leave: tmp[1] = eip->bei_id; *ptr = DN_ONE_PREFIX; bdb_idl_cache_del_id( bdb, db, &key, e->e_id ); - *ptr = DN_SUBTREE_PREFIX; - for (; eip && eip->bei_parent->bei_id; eip = eip->bei_parent) { - tmp[1] = eip->bei_id; - bdb_idl_cache_del_id( bdb, db, &key, e->e_id ); + if ( eip ->bei_parent ) { + *ptr = DN_SUBTREE_PREFIX; + for (; eip && eip->bei_parent->bei_id; eip = eip->bei_parent) { + tmp[1] = eip->bei_id; + bdb_idl_cache_del_id( bdb, db, &key, e->e_id ); + } } } Debug( LDAP_DEBUG_TRACE, "<= hdb_dn2id_delete 0x%lx: %d\n", e->e_id, rc, 0 ); @@ -1181,7 +1186,7 @@ hdb_dn2idl( #ifndef BDB_MULTIPLE_SUFFIXES if ( op->ors_scope != LDAP_SCOPE_ONELEVEL && ( ei->bei_id == 0 || - ei->bei_parent->bei_id == 0 )) + ( ei->bei_parent->bei_id == 0 && op->o_bd->be_suffix[0].bv_len ))) { BDB_IDL_ALL( bdb, ids ); return 0; -- 2.39.5