Skip to content
Snippets Groups Projects
Commit 45523220 authored by Pierangelo Masarati's avatar Pierangelo Masarati
Browse files

add test for max size limit

parent 48f4d0c7
No related branches found
No related tags found
No related merge requests found
......@@ -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"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment