From: Howard Chu Date: Sun, 14 Jul 2019 13:46:13 +0000 (-0700) Subject: ITS#7657 back-mdb improve alias deref X-Git-Tag: OPENLDAP_REL_ENG_2_4_48~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d05b0be4bb8078f70ecafabfff7e832ec4e3a707;p=thirdparty%2Fopenldap.git ITS#7657 back-mdb improve alias deref Don't search for scopes of entries with no children --- diff --git a/servers/slapd/back-mdb/dn2id.c b/servers/slapd/back-mdb/dn2id.c index 1ac804f227..bdb3086df7 100644 --- a/servers/slapd/back-mdb/dn2id.c +++ b/servers/slapd/back-mdb/dn2id.c @@ -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 */