From 92b03e82e0dd3e2c65f887c98dbd13dce1cb5dbe Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Wed, 17 Jul 2019 10:17:43 +0100 Subject: [PATCH] ITS#7657 honor unchecked limit --- servers/slapd/back-mdb/search.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/servers/slapd/back-mdb/search.c b/servers/slapd/back-mdb/search.c index 1bfd0bc29c..c659381e7b 100644 --- a/servers/slapd/back-mdb/search.c +++ b/servers/slapd/back-mdb/search.c @@ -161,6 +161,12 @@ static int search_aliases( if (rs->sr_err != LDAP_SUCCESS || MDB_IDL_IS_ZERO( aliases )) { return rs->sr_err; } + if ( op->ors_limit /* isroot == FALSE */ && + op->ors_limit->lms_s_unchecked != -1 && + MDB_IDL_N( aliases ) > (unsigned) op->ors_limit->lms_s_unchecked ) + { + return LDAP_ADMINLIMIT_EXCEEDED; + } oldsubs[0] = 1; oldsubs[1] = e_id; @@ -670,6 +676,10 @@ dn2entry_retry: scopes[1].mval.mv_data = NULL; rs->sr_err = search_candidates( op, rs, base, &isc, mci, candidates, stack ); + + if ( rs->sr_err == LDAP_ADMINLIMIT_EXCEEDED ) + goto adminlimit; + ncand = MDB_IDL_N( candidates ); if ( !base->e_id || ncand == NOID ) { /* grab entry count from id2entry stat @@ -700,6 +710,7 @@ dn2entry_retry: ncand > (unsigned) op->ors_limit->lms_s_unchecked ) { rs->sr_err = LDAP_ADMINLIMIT_EXCEEDED; +adminlimit: send_ldap_result( op, rs ); rs->sr_err = LDAP_SUCCESS; goto done;