Skip to content

Commit

Permalink
Fixes #8000: Broken LDAP after install of 3.1 on CentOS 7
Browse files Browse the repository at this point in the history
  • Loading branch information
jooooooon committed Feb 29, 2016
1 parent 178d187 commit 1bf7406
Showing 1 changed file with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
commit 1760f0e33279e947fe2de5075a81cfb479654ffb
commit 6373e9f0ba522e209b53e468476ca936c12094f8
Author: Jonathan Clarke <jonathan.clarke@normation.com>
Date: Tue Feb 23 02:08:50 2016 +0100

Quick fix to avoid incomplete search results after a MODRDN subtree rename with back-hdb and idlcachesize

diff --git a/servers/slapd/back-bdb/dn2id.c b/servers/slapd/back-bdb/dn2id.c
index a029602..c8ef278 100644
index a029602..3e4d5df 100644
--- a/servers/slapd/back-bdb/dn2id.c
+++ b/servers/slapd/back-bdb/dn2id.c
@@ -571,6 +571,7 @@ hdb_dn2id_add(
Expand All @@ -16,14 +16,16 @@ index a029602..c8ef278 100644
ID tmp[2];
char *ptr = ((char *)&tmp[1])-1;
key.data = ptr;
@@ -582,7 +583,14 @@ hdb_dn2id_add(
@@ -580,9 +581,16 @@ hdb_dn2id_add(
bdb_idl_cache_add_id( bdb, db, &key, e->e_id );
if ( eip->bei_parent ) {
*ptr = DN_SUBTREE_PREFIX;
+ tmprc = hdb_dn2id_children( op, txn, e );
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 the entry we're adding has kids (modrdn), just delete any subtree
+ * caches that would include this result so they are rebuilt */
+ tmprc = hdb_dn2id_children( op, txn, e );
+ if (tmprc == DB_NOTFOUND) {
+ bdb_idl_cache_add_id( bdb, db, &key, e->e_id );
+ } else {
Expand All @@ -32,3 +34,14 @@ index a029602..c8ef278 100644
}
/* Handle DB with empty suffix */
if ( !op->o_bd->be_suffix[0].bv_len && eip ) {
@@ -876,7 +884,9 @@ hdb_dn2id_children(
db_recno_t dkids;
rc = cursor->c_count( cursor, &dkids, 0 );
if ( rc == 0 ) {
- BEI(e)->bei_dkids = dkids;
+ if ( BEI(e) ) {
+ BEI(e)->bei_dkids = dkids;
+ }
if ( dkids < 2 ) rc = DB_NOTFOUND;
}
}

0 comments on commit 1bf7406

Please sign in to comment.