From 5a08b66141c069f86af90621c36034b1296d5c2c Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 15 May 2014 21:27:21 -0700 Subject: [PATCH] ITS#7705,#7800 fix prev commit Better check for missing IDs --- servers/slapd/back-mdb/dn2id.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/servers/slapd/back-mdb/dn2id.c b/servers/slapd/back-mdb/dn2id.c index b0e6905c7b..f54ab998e9 100644 --- a/servers/slapd/back-mdb/dn2id.c +++ b/servers/slapd/back-mdb/dn2id.c @@ -699,11 +699,11 @@ mdb_idscopes( struct mdb_info *mdb = (struct mdb_info *) op->o_bd->be_private; MDB_dbi dbi = mdb->mi_dn2id; MDB_val key, data; - ID id; + ID id, prev; ID2 id2; char *ptr; int rc = 0; - unsigned int x, y; + unsigned int x; unsigned int nrlen, rlen; diskNode *d; @@ -750,8 +750,12 @@ mdb_idscopes( } ptr = data.mv_data; ptr += data.mv_size - sizeof(ID); + prev = id; memcpy( &id, ptr, sizeof(ID) ); - y = x; + /* If we didn't advance, some parent is missing */ + if ( id == prev ) + return MDB_NOTFOUND; + x = mdb_id2l_search( isc->scopes, id ); if ( x <= isc->scopes[0].mid && isc->scopes[x].mid == id ) { if ( !isc->scopes[x].mval.mv_data ) { @@ -767,10 +771,6 @@ mdb_idscopes( } data = isc->scopes[x].mval; rc = 1; - } else { - /* If we didn't advance, some parent is missing */ - if ( x == y ) - return MDB_NOTFOUND; } if ( op->ors_scope == LDAP_SCOPE_ONELEVEL ) break; -- 2.39.5