]> git.sur5r.net Git - openldap/commitdiff
ITS#8011: few corrections for lmdb-backend;
authorLeo Yuriev <leo@yuriev.ru>
Sun, 4 Jan 2015 07:41:04 +0000 (07:41 +0000)
committerHoward Chu <hyc@openldap.org>
Sun, 4 Jan 2015 07:41:07 +0000 (07:41 +0000)
dn2id.c:
  + assertion for mdb_id2l_insert() result;
  - unnecessary assignment;

search.c:
  - unused variable 'first';
  + range-check for mdb_idl_search() result;

servers/slapd/back-mdb/dn2id.c
servers/slapd/back-mdb/search.c

index 41c4758f95977b33f3ec2ff56bb9741a3a08d2b4..46637c12342b3c96d37ec08e78341c7696b4def3 100644 (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 );
index 9089016ba647d7510d951fb659dd330da559724a..185d9f1cc55122a0d9e5e2e8fcb71ef3c33ba12c 100644 (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 )