]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#7657 back-mdb improve alias deref
authorHoward Chu <hyc@openldap.org>
Sun, 14 Jul 2019 13:46:13 +0000 (06:46 -0700)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 15 Jul 2019 15:49:59 +0000 (15:49 +0000)
Don't search for scopes of entries with no children

servers/slapd/back-mdb/dn2id.c

index 1ac804f227bafe9390a6bf3ab2e81e9b0c0d8fea..bdb3086df75c210f0441f5eb705976ee93cc0fa4 100644 (file)
@@ -641,6 +641,22 @@ mdb_idscope(
        rc = mdb_cursor_open( txn, dbi, &cursor );
        if ( rc ) return rc;
 
+       /* first see if base has any children at all */
+       key.mv_data = &base;
+       rc = mdb_cursor_get( cursor, &key, &data, MDB_SET );
+       if ( rc ) {
+               goto leave;
+       }
+       {
+               size_t dkids;
+               rc = mdb_cursor_count( cursor, &dkids );
+               if ( rc == 0 ) {
+                       if ( dkids < 2 ) {
+                               goto leave;
+                       }
+               }
+       }
+
        ida = mdb_idl_first( ids, &cid );
 
        /* Don't bother moving out of ids if it's a range */