From 267486bfadc17c6add59188a0b326bb0e34e37d1 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Thu, 6 Apr 2006 23:48:55 +0000 Subject: [PATCH] fix ITS#4479 --- servers/slapd/limits.c | 3 +++ tests/scripts/test025-limits | 46 ++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/servers/slapd/limits.c b/servers/slapd/limits.c index dd01a79b03..baa2e65fec 100644 --- a/servers/slapd/limits.c +++ b/servers/slapd/limits.c @@ -1287,6 +1287,9 @@ limits_check( Operation *op, SlapReply *rs ) return -1; } op->ors_slimit = slimit; + + } else if ( slimit == 0 ) { + op->ors_slimit = 0; } } else { diff --git a/tests/scripts/test025-limits b/tests/scripts/test025-limits index b513708006..14e9560a36 100755 --- a/tests/scripts/test025-limits +++ b/tests/scripts/test025-limits @@ -1359,6 +1359,52 @@ case $RC in ;; esac +# ITS#4479 +PAGESIZE=1 +SIZELIMIT=2 +echo "Testing size limit request ($SIZELIMIT) for unlimited ID and pagesize=$PAGESIZE..." +$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \ + -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \ + -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1 +RC=$? +COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT` +case $RC in + 0) + if test x"$COUNT" != x ; then + if test "$COUNT" -gt "$SIZELIMIT" ; then + echo "...error: got $COUNT entries instead of the requested $SIZELIMIT" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit 1 + fi + echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)" + else + echo "...error: did not expect ldapsearch success ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit 1 + fi + ;; + 4) + if test x"$COUNT" != x ; then + if test $COUNT = $SIZELIMIT ; then + echo "...bumped into requested size limit ($SIZELIMIT)" + else + echo "...error: got $COUNT entries while requesting $SIZELIMIT..." + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi + else + echo "...error: bumped into server-side size limit, but got no entries!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi + ;; + *) + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac + test $KILLSERVERS != no && kill -HUP $KILLPIDS echo ">>>>> Test succeeded" -- 2.39.5