ITS#8011: few corrections for lmdb-backend;

dn2id.c:
  + assertion for mdb_id2l_insert() result;
  - unnecessary assignment;

search.c:
  - unused variable 'first';
  + range-check for mdb_idl_search() result;
This commit is contained in:
Leo Yuriev 2015-01-04 07:41:04 +00:00 committed by Howard Chu
parent 7c2951819f
commit 67a65ec701
2 changed files with 6 additions and 5 deletions

View file

@ -760,9 +760,11 @@ mdb_idscopes(
if ( x <= isc->scopes[0].mid && isc->scopes[x].mid == id ) {
if ( !isc->scopes[x].mval.mv_data ) {
/* This node is in scope, add parent chain to scope */
int i = isc->sctmp[0].mid;
for ( i = 1; i <= isc->sctmp[0].mid; i++ )
mdb_id2l_insert( isc->scopes, &isc->sctmp[i] );
int i;
for ( i = 1; i <= isc->sctmp[0].mid; i++ ) {
rc = mdb_id2l_insert( isc->scopes, &isc->sctmp[i] );
assert(rc == 0);
}
/* check id again since inserts may have changed its position */
if ( isc->scopes[x].mid != id )
x = mdb_id2l_search( isc->scopes, id );

View file

@ -140,7 +140,6 @@ static int search_aliases(
struct berval bv_alias = BER_BVC( "alias" );
AttributeAssertion aa_alias = ATTRIBUTEASSERTION_INIT;
Filter af;
int first = 1;
aliases = stack; /* IDL of all aliases in the database */
curscop = aliases + MDB_IDL_DB_SIZE; /* Aliases in the current scope */
@ -807,7 +806,7 @@ loop_begin:
scopeok = 1;
} else {
i = mdb_idl_search( candidates, id );
if ( candidates[i] == id )
if (i <= candidates[0] && candidates[i] == id )
scopeok = 1;
}
if ( scopeok )