diff --git a/servers/slapd/limits.c b/servers/slapd/limits.c index 0c62a25baa..ef483183ff 100644 --- a/servers/slapd/limits.c +++ b/servers/slapd/limits.c @@ -1102,7 +1102,12 @@ limits_check( Operation *op, SlapReply *rs ) } if ( pr_total == -1 ) { - slimit = -1; + if ( op->ors_slimit == 0 || op->ors_slimit == SLAP_MAX_LIMIT ) { + slimit = -1; + + } else { + slimit = op->ors_slimit - op->o_pagedresults_state.ps_count; + } } else if ( pr_total > 0 && op->ors_slimit != SLAP_MAX_LIMIT && ( op->ors_slimit == SLAP_NO_LIMIT || op->ors_slimit > pr_total ) )