diff --git a/tests/scripts/test025-limits b/tests/scripts/test025-limits index 1329f81d93597bc077748579127e06ee7519746a..6f7beaa70cbb69aac875bc24fa7e0b61476b8e6c 100755 --- a/tests/scripts/test025-limits +++ b/tests/scripts/test025-limits @@ -13,6 +13,8 @@ ## top-level directory of the distribution or, alternatively, at ## <http://www.OpenLDAP.org/license.html>. +## FIXME: need to exclude legal but wrong results... + echo "running defines.sh" . $SRCDIR/scripts/defines.sh @@ -251,6 +253,30 @@ case $RC in ;; esac +SIZELIMIT=max +echo "Testing max limit request ($SIZELIMIT) for hard limited ID..." +$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \ + -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \ + '(objectClass=*)' > $SEARCHOUT 2>&1 +RC=$? +COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT` +case $RC in + 0) + echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)" + ;; + 4) + echo "...bumped into requested ($SIZELIMIT=$COUNT) size limit" + ;; + 11) + echo "...bumped into server-side hard size administrative limit" + ;; + *) + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac + echo "Testing lower than unchecked limit request for unchecked limited ID..." $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \ -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \ @@ -677,6 +703,30 @@ case $RC in ;; esac +SIZELIMIT=max +echo "Testing max limit request ($SIZELIMIT) for hard limited ID..." +$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \ + -D 'cn=Hard Limited 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) + echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)" + ;; + 4) + echo "...bumped into requested ($SIZELIMIT=$COUNT) size limit" + ;; + 11) + echo "...bumped into hard size administrative limit" + ;; + *) + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac + echo "Testing lower than unchecked limit request for unchecked limited ID..." $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \ -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \ @@ -874,6 +924,38 @@ case $RC in ;; esac +SIZELIMIT=max +echo "Testing max limit requested for pagedResults total count limited ID..." +$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \ + -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \ + -z $SIZELIMIT -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1 +RC=$? +COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT` +case $RC in + 0) + echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side unchecked limit (got $COUNT entries)" + ;; + 4) + if test "x$COUNT" != "x" ; then + if test "x$SIZELIMIT" = "x$COUNT" ; then + echo "...bumped into requested ($SIZELIMIT) size limit" + else + echo "...bumped into server-side size limit ($COUNT)" + fi + else + echo "...bumped into either requested ($SIZELIMIT) or server-side size limit" + fi + ;; + 11) + echo "...bumped into pagedResults total count administrative limit" + ;; + *) + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac + test $KILLSERVERS != no && kill -HUP $KILLPIDS echo ">>>>> Test succeeded"