]> git.sur5r.net Git - openldap/blobdiff - tests/scripts/test025-limits
From HEAD
[openldap] / tests / scripts / test025-limits
index 53fe1f90ad8ffd85b58ea494078273ae5782e749..02bf2f0396d220745d93c115d75272317a816557 100755 (executable)
@@ -2,7 +2,7 @@
 # $OpenLDAP$
 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
 ##
-## Copyright 1998-2004 The OpenLDAP Foundation.
+## Copyright 1998-2006 The OpenLDAP Foundation.
 ## All rights reserved.
 ##
 ## Redistribution and use in source and binary forms, with or without
@@ -47,6 +47,8 @@ if test $WAIT != 0 ; then
 fi
 KILLPIDS="$PID"
 
+sleep 1
+
 echo "Testing slapd searching..."
 for i in 0 1 2 3 4 5; do
        $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
@@ -79,7 +81,13 @@ RC=$?
 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
 case $RC in
        0)
-               echo "...success (got $COUNT entries)"
+               if test x"$COUNT" != x ; then
+                       echo "...success (got $COUNT entries)"
+               else
+                       echo "...error: did not expect ldapsearch success ($RC)!"
+                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
+                        exit 1
+                fi
        ;;
        *)
                echo "ldapsearch failed ($RC)!"
@@ -96,7 +104,13 @@ RC=$?
 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
 case $RC in
        0)
-               echo "...success (got $COUNT entries)"
+               if test x"$COUNT" != x ; then
+                       echo "...success (got $COUNT entries)"
+               else
+                       echo "...error: did not expect ldapsearch success ($RC)!"
+                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
+                        exit 1
+                fi
        ;;
        *)
                echo "ldapsearch failed ($RC)!"
@@ -118,17 +132,29 @@ case $RC in
                        if test "$COUNT" -gt "$SIZELIMIT" ; then
                                echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
                                test $KILLSERVERS != no && kill -HUP $KILLPIDS
-                               exit $RC
+                               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 $RC
+                       exit 1
                fi
        ;;
        4)
-               echo "...bumped into requested size limit ($SIZELIMIT)"
+               if test x"$COUNT" != x ; then
+                       if test "$COUNT" = "$SIZELIMIT" ; then
+                               echo "...bumped into requested size limit ($SIZELIMIT)"
+                       else
+                               echo "...error: got $COUNT entries with a requested sizelimit of $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)!"
@@ -150,17 +176,29 @@ case $RC in
                        if test "$COUNT" -gt "$SIZELIMIT" ; then
                                echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
                                test $KILLSERVERS != no && kill -HUP $KILLPIDS
-                               exit $RC
+                               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 $RC
+                       exit 1
                fi
        ;;
        4)
-               echo "...bumped into requested size limit ($SIZELIMIT)"
+               if test x"$COUNT" != x ; then
+                       if test "$COUNT" = "$SIZELIMIT" ; then
+                               echo "...bumped into requested size limit ($SIZELIMIT)"
+                       else
+                               echo "...error: got $COUNT entries with a requested sizelimit of $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)!"
@@ -178,9 +216,18 @@ RC=$?
 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
 case $RC in
        0)
-               echo "...didn't bump into the requested time limit ($TIMELIMIT s; got $COUNT entries)"
+               if test x"$COUNT" != x ; then
+                       echo "...didn't bump into the requested time limit ($TIMELIMIT s; got $COUNT entries)"
+               else
+                       echo "...error: did not expect ldapsearch success ($RC)!"
+                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
+                        exit 1
+                fi
        ;;
        3)
+               if test x"$COUNT" != x ; then
+                       COUNT=0
+               fi
                echo "...bumped into requested time limit ($TIMELIMIT s; got $COUNT entries)"
        ;;
        *)
@@ -198,10 +245,22 @@ RC=$?
 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
 case $RC in
        0)
-               echo "...didn't bump into server-side size limit (got $COUNT entries)"
+               if test x"$COUNT" != x ; then
+                       echo "...didn't bump into server-side size limit (got $COUNT entries)"
+               else
+                        echo "...error: did not expect ldapsearch success ($RC)!"
+                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
+                        exit 1
+                fi
        ;;
        4)
-               echo "...bumped into server-side size limit (got $COUNT entries)"
+               if test x"$COUNT" != x ; then
+                       echo "...bumped into server-side size limit (got $COUNT entries)"
+               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)!"
@@ -223,13 +282,13 @@ case $RC in
                        if test "$COUNT" -gt "$SIZELIMIT" ; then
                                echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
                                test $KILLSERVERS != no && kill -HUP $KILLPIDS
-                               exit $RC
+                               exit 1
                        fi
                        echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
                else
                        echo "...error: did not expect ldapsearch success ($RC)!"
                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
-                       exit $RC
+                       exit 1
                fi
        ;;
        4)
@@ -240,7 +299,9 @@ case $RC in
                                echo "...bumped into server-side size limit ($COUNT)"
                        fi
                else
-                       echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
+                       echo "...error: bumped into server-side size limit, but got no entries!"
+                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
+                        exit $RC
                fi
        ;;
        *)
@@ -263,13 +324,13 @@ case $RC in
                        if test "$COUNT" -gt "$SIZELIMIT" ; then
                                echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
                                test $KILLSERVERS != no && kill -HUP $KILLPIDS
-                               exit $RC
+                               exit 1
                        fi
                        echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
                else
                        echo "...error: did not expect ldapsearch success ($RC)!"
                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
-                       exit $RC
+                       exit 1
                fi
        ;;
        4)
@@ -280,7 +341,9 @@ case $RC in
                                echo "...bumped into server-side size limit ($COUNT)"
                        fi
                else
-                       echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
+                       echo "...error: bumped into server-side size limit, but got no entries!"
+                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
+                        exit $RC
                fi
        ;;
        *)
@@ -303,13 +366,13 @@ case $RC in
                        if test "$COUNT" -gt "$SIZELIMIT" ; then
                                echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
                                test $KILLSERVERS != no && kill -HUP $KILLPIDS
-                               exit $RC
+                               exit 1
                        fi
                        echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
                else
                        echo "...error: did not expect ldapsearch success ($RC)!"
                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
-                       exit $RC
+                       exit 1
                fi
        ;;
        4)
@@ -335,23 +398,33 @@ case $RC in
                        if test "$COUNT" -gt "$SIZELIMIT" ; then
                                echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
                                test $KILLSERVERS != no && kill -HUP $KILLPIDS
-                               exit $RC
+                               exit 1
                        fi
                        echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
                else
                        echo "...error: did not expect ldapsearch success ($RC)!"
                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
-                       exit $RC
+                       exit 1
                fi
        ;;
        4)
-               echo "...error:bumped into requested ($SIZELIMIT) size limit"
-               test $KILLSERVERS != no && kill -HUP $KILLPIDS
-               exit $RC
-       ;;
-       11)
-               echo "...bumped into server-side hard size administrative limit"
+               if test x"$COUNT" != x ; then
+                       if test "$COUNT" = "$SIZELIMIT" ; then
+                               echo "...error: bumped into requested ($SIZELIMIT) size limit"
+                               test $KILLSERVERS != no && kill -HUP $KILLPIDS
+                               exit $RC
+                       else
+                               echo "...got size limit $COUNT instead of requested $SIZELIMIT entries"
+                       fi
+               else
+                       echo "...error: bumped into server-side size limit, but got no entries!"
+                       test $KILLSERVERS != no && kill -HUP $KILLPIDS
+                       exit $RC
+               fi
        ;;
+#      11)
+#              echo "...bumped into server-side hard size administrative limit"
+#      ;;
        *)
                echo "ldapsearch failed ($RC)!"
                test $KILLSERVERS != no && kill -HUP $KILLPIDS
@@ -373,15 +446,21 @@ case $RC in
                else
                        echo "...error: did not expect ldapsearch success ($RC)!"
                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
-                       exit $RC
+                       exit 1
                fi
        ;;
        4)
-               echo "...bumped into requested ($SIZELIMIT=$COUNT) size limit"
-       ;;
-       11)
-               echo "...bumped into server-side hard size administrative limit"
+               if test x"$COUNT" != x ; then
+                       echo "...bumped into requested ($SIZELIMIT=$COUNT) size limit"
+               else
+                       echo "...error: bumped into server-side size limit, but got no entries!"
+                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
+                        exit $RC
+               fi
        ;;
+#      11)
+#              echo "...bumped into server-side hard size administrative limit"
+#      ;;
        *)
                echo "ldapsearch failed ($RC)!"
                test $KILLSERVERS != no && kill -HUP $KILLPIDS
@@ -402,11 +481,13 @@ case $RC in
                else
                        echo "...error: did not expect ldapsearch success ($RC)!"
                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
-                       exit $RC
+                       exit 1
                fi
        ;;
        11)
-               echo "...bumped into unchecked administrative limit"
+               echo "...error: bumped into unchecked administrative limit"
+               test $KILLSERVERS != no && kill -HUP $KILLPIDS
+               exit $RC
        ;;
        *)
                echo "ldapsearch failed ($RC)!"
@@ -429,7 +510,7 @@ case $RC in
                        echo "...error: did not expect ldapsearch success ($RC)!"
                fi
                test $KILLSERVERS != no && kill -HUP $KILLPIDS
-               exit $RC
+               exit 1
        ;;
        11)
                echo "...bumped into unchecked administrative limit"
@@ -455,7 +536,7 @@ case $RC in
                        echo "...error: did not expect ldapsearch success ($RC)!"
                fi
                test $KILLSERVERS != no && kill -HUP $KILLPIDS
-               exit $RC
+               exit 1
        ;;
        11)
                echo "...bumped into unchecked administrative limit"
@@ -480,14 +561,14 @@ case $RC in
                else
                        echo "...error: did not expect ldapsearch success ($RC)!"
                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
-                       exit $RC
+                       exit 1
                fi
        ;;
        4)
                if test "x$COUNT" != "x" ; then
                        echo "...bumped into server-side size limit ($COUNT)"
                else
-                       echo "...error: bumped into server-side size limit, but got 0 entries!"
+                       echo "...error: bumped into server-side size limit, but got no entries!"
                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
                        exit $RC
                fi
@@ -512,14 +593,14 @@ case $RC in
                else
                        echo "...error: did not expect ldapsearch success ($RC)!"
                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
-                       exit $RC
+                       exit 1
                fi
        ;;
        4)
                if test "x$COUNT" != "x" ; then
                        echo "...bumped into server-side size limit ($COUNT)"
                else
-                       echo "...error: bumped into server-side size limit, but got 0 entries!"
+                       echo "...error: bumped into server-side size limit, but got no entries!"
                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
                        exit $RC
                fi
@@ -544,14 +625,14 @@ case $RC in
                else
                        echo "...error: did not expect ldapsearch success ($RC)!"
                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
-                       exit $RC
+                       exit 1
                fi
        ;;
        4)
                if test "x$COUNT" != "x" ; then
                        echo "...bumped into server-side size limit ($COUNT)"
                else
-                       echo "...error: bumped into server-side size limit, but got 0 entries!"
+                       echo "...error: bumped into server-side size limit, but got no entries!"
                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
                        exit $RC
                fi
@@ -576,14 +657,14 @@ case $RC in
                else
                        echo "...error: did not expect ldapsearch success ($RC)!"
                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
-                       exit $RC
+                       exit 1
                fi
        ;;
        4)
                if test "x$COUNT" != "x" ; then
                        echo "...bumped into server-side size limit ($COUNT)"
                else
-                       echo "...error: bumped into server-side size limit, but got 0 entries!"
+                       echo "...error: bumped into server-side size limit, but got no entries!"
                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
                        exit $RC
                fi
@@ -608,14 +689,14 @@ case $RC in
                else
                        echo "...error: did not expect ldapsearch success ($RC)!"
                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
-                       exit $RC
+                       exit 1
                fi
        ;;
        4)
                if test "x$COUNT" != "x" ; then
                        echo "...bumped into server-side size limit ($COUNT)"
                else
-                       echo "...error: bumped into server-side size limit, but got 0 entries!"
+                       echo "...error: bumped into server-side size limit, but got no entries!"
                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
                        exit $RC
                fi
@@ -639,14 +720,14 @@ case $RC in
                else
                        echo "...error: did not expect ldapsearch success ($RC)!"
                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
-                       exit $RC
+                       exit 1
                fi
        ;;
        4)
                if test "x$COUNT" != "x" ; then
                        echo "...bumped into server-side size limit ($COUNT)"
                else
-                       echo "...error: bumped into server-side size limit, but got 0 entries!"
+                       echo "...error: bumped into server-side size limit, but got no entries!"
                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
                        exit $RC
                fi
@@ -670,11 +751,25 @@ case $BACKEND in
        ;;
 esac
 
+if test x"$SLAPD_PAGE_SIZE" != x ; then
+       PAGESIZE="$SLAPD_PAGE_SIZE"
+       if test "$PAGESIZE" -le 0 ; then
+               test $KILLSERVERS != no && kill -HUP $KILLPIDS
+
+               echo ""
+               echo "Testing with pagedResults control disabled"
+               echo ""
+               echo ">>>>> Test succeeded"
+               exit 0
+       fi
+else
+       PAGESIZE=5
+fi
+
 echo ""
-echo "Testing regular search limits with pagedResults control"
+echo "Testing regular search limits with pagedResults control (page size $PAGESIZE)"
 echo ""
 
-PAGESIZE=5
 echo "Testing no limits requested for unlimited ID..."
 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
        -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
@@ -683,7 +778,13 @@ RC=$?
 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
 case $RC in
        0)
-               echo "...success (got $COUNT entries)"
+               if test x"$COUNT" != x ; then
+                       echo "...success (got $COUNT entries)"
+               else
+                        echo "...error: did not expect ldapsearch success ($RC)!"
+                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
+                        exit 1
+                fi
        ;;
        *)
                echo "ldapsearch failed ($RC)!"
@@ -701,10 +802,33 @@ RC=$?
 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
 case $RC in
        0)
-               echo "...success (got $COUNT entries)"
+               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)
-               echo "...bumped into requested size limit ($SIZELIMIT)"
+               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)!"
@@ -722,10 +846,19 @@ RC=$?
 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
 case $RC in
        0)
-               echo "...success (got $COUNT entries)"
+               if test x"$COUNT" != x ; then
+                       echo "...didn't bump into the requested time limit ($TIMELIMIT s; got $COUNT entries)"
+               else
+                       echo "...error: did not expect ldapsearch success ($RC)!"
+                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
+                        exit 1
+                fi
        ;;
        3)
-               echo "...bumped into requested time limit ($TIMELIMIT s; $COUNT entries)"
+               if test x"$COUNT" = x ; then
+                       COUNT=0
+               fi
+               echo "...bumped into requested time limit ($TIMELIMIT s; got $COUNT entries)"
        ;;
        *)
                echo "ldapsearch failed ($RC)!"
@@ -742,10 +875,22 @@ RC=$?
 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
 case $RC in
        0)
-               echo "...success; didn't bump into server-side size limit (got $COUNT entries)"
+               if test x"$COUNT" != x ; then
+                       echo "...didn't bump into server-side size limit (got $COUNT entries)"
+               else
+                       echo "...error: did not expect ldapsearch success ($RC)!"
+                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
+                        exit 1
+               fi
        ;;
        4)
-               echo "...bumped into server-side size limit ($COUNT)"
+               if test x"$COUNT" != x ; then
+                       echo "...bumped into server-side size limit (got $COUNT entries)"
+               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)!"
@@ -763,7 +908,18 @@ 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)"
+               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 either requested ($SIZELIMIT) or server-side size limit (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
@@ -792,7 +948,18 @@ 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)"
+               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 either requested ($SIZELIMIT) or server-side size limit (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
@@ -821,10 +988,33 @@ 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)"
+               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 either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
+                else
+                        echo "...error: did not expect ldapsearch success ($RC)!"
+                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
+                        exit 1
+                fi
        ;;
        4)
-               echo "...bumped into requested ($SIZELIMIT) size limit"
+               if test x"$COUNT" != x ; then
+                       if test "$COUNT" = "$SIZELIMIT" ; then
+                               echo "...bumped into requested ($SIZELIMIT) size limit"
+                       else
+                               echo "...error: got size limit $SIZELIMIT but $COUNT entries"
+                               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)!"
@@ -842,14 +1032,37 @@ 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)"
+               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 either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
+                else
+                        echo "...error: did not expect ldapsearch success ($RC)!"
+                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
+                        exit 1
+                fi
        ;;
        4)
-               echo "...bumped into requested ($SIZELIMIT) size limit"
-       ;;
-       11)
-               echo "...bumped into hard size administrative limit"
+               if test x"$COUNT" != x ; then
+                       if test "$COUNT" = "$SIZELIMIT" ; then
+                               echo "...error: bumped into requested ($SIZELIMIT) size limit"
+                               test $KILLSERVERS != no && kill -HUP $KILLPIDS
+                               exit $RC
+                       else
+                               echo "...got size limit $COUNT instead of requested $SIZELIMIT entries"
+                       fi
+               else
+                       echo "...error: bumped into server-side size limit, but got no entries!"
+                       test $KILLSERVERS != no && kill -HUP $KILLPIDS
+                       exit $RC
+               fi
        ;;
+#      11)
+#              echo "...bumped into hard size administrative limit"
+#      ;;
        *)
                echo "ldapsearch failed ($RC)!"
                test $KILLSERVERS != no && kill -HUP $KILLPIDS
@@ -866,14 +1079,26 @@ 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)"
+               if test x"$COUNT" != x ; then
+                        echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
+                else
+                        echo "...error: did not expect ldapsearch success ($RC)!"
+                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
+                        exit 1
+                fi
        ;;
        4)
-               echo "...bumped into requested ($SIZELIMIT=$COUNT) size limit"
-       ;;
-       11)
-               echo "...bumped into hard size administrative limit"
+               if test x"$COUNT" != x ; then
+                       echo "...bumped into requested ($SIZELIMIT=$COUNT) size limit"
+               else
+                       echo "...error: bumped into size limit but got no entries!"
+                       test $KILLSERVERS != no && kill -HUP $KILLPIDS
+                       exit $RC
+               fi
        ;;
+#      11)
+#              echo "...bumped into hard size administrative limit"
+#      ;;
        *)
                echo "ldapsearch failed ($RC)!"
                test $KILLSERVERS != no && kill -HUP $KILLPIDS
@@ -889,11 +1114,17 @@ RC=$?
 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
 case $RC in
        0)
-               echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
-       ;;
-       11)
-               echo "...bumped into unchecked administrative limit"
-       ;;
+               if test x"$COUNT" != x ; then
+                        echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
+                else
+                        echo "...error: did not expect ldapsearch success ($RC)!"
+                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
+                        exit 1
+                fi
+       ;;
+#      11)
+#              echo "...bumped into unchecked administrative limit"
+#      ;;
        *)
                echo "ldapsearch failed ($RC)!"
                test $KILLSERVERS != no && kill -HUP $KILLPIDS
@@ -909,7 +1140,13 @@ RC=$?
 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
 case $RC in
        0)
-               echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
+               if test x"$COUNT" != x ; then
+                        echo "...error: didn't bump into server-side unchecked limit (got $COUNT entries)"
+                else
+                        echo "...error: did not expect ldapsearch success ($RC)!"
+                fi
+                test $KILLSERVERS != no && kill -HUP $KILLPIDS
+                exit 1
        ;;
        11)
                echo "...bumped into unchecked administrative limit"
@@ -933,10 +1170,22 @@ RC=$?
 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
 case $RC in
        0)
-               echo "...success; didn't bump into server-side size limit (got $COUNT entries)"
+               if test x"$COUNT" != x ; then
+                       echo "...success; didn't bump into server-side size limit (got $COUNT entries)"
+               else
+                       echo "...error: did not expect ldapsearch success ($RC)!"
+                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
+                        exit 1
+                fi
        ;;
        4)
-               echo "...bumped into server-side size limit ($COUNT)"
+               if test x"$COUNT" != x ; then
+                       echo "...bumped into server-side size limit (got $COUNT entries)"
+               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)!"