# $OpenLDAP$
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
-## Copyright 1998-2004 The OpenLDAP Foundation.
+## Copyright 1998-2008 The OpenLDAP Foundation.
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
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 \
else
echo "...error: did not expect ldapsearch success ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
+ exit 1
fi
;;
*)
else
echo "...error: did not expect ldapsearch success ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
+ exit 1
fi
;;
*)
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)
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)
else
echo "...error: did not expect ldapsearch success ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
+ exit 1
fi
;;
3)
else
echo "...error: did not expect ldapsearch success ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
+ exit 1
fi
;;
4)
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)
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)
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)
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 server-side size limit instead of hard size administrative 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
else
echo "...error: did not expect ldapsearch success ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
+ exit 1
fi
;;
4)
exit $RC
fi
;;
- 11)
- echo "...bumped into server-side hard size administrative limit"
- ;;
+# 11)
+# echo "...bumped into server-side hard size administrative limit"
+# ;;
*)
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
else
echo "...error: did not expect ldapsearch success ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
+ exit 1
fi
;;
11)
;;
esac
+case $BACKEND in bdb | hdb)
+
echo "Testing higher than unchecked limit requested 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' \
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"
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"
exit $RC
;;
esac
+;;
+*) echo "Skipping test for unchecked limit with $BACKEND backend." ;;
+esac
echo "Testing no limits requested for limited regex..."
$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
else
echo "...error: did not expect ldapsearch success ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
+ exit 1
fi
;;
4)
else
echo "...error: did not expect ldapsearch success ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
+ exit 1
fi
;;
4)
else
echo "...error: did not expect ldapsearch success ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
+ exit 1
fi
;;
4)
else
echo "...error: did not expect ldapsearch success ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
+ exit 1
fi
;;
4)
else
echo "...error: did not expect ldapsearch success ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
+ exit 1
fi
;;
4)
else
echo "...error: did not expect ldapsearch success ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
+ exit 1
fi
;;
4)
else
echo "...error: did not expect ldapsearch success ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
+ exit 1
fi
;;
*)
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)
else
echo "...error: did not expect ldapsearch success ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
+ exit 1
fi
;;
3)
else
echo "...error: did not expect ldapsearch success ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
+ exit 1
fi
;;
4)
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)
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)
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)
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)
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 "...error: got size limit $SIZELIMIT but $COUNT entries"
+ 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
- test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
- ;;
- 11)
- echo "...bumped into hard size administrative limit"
;;
+# 11)
+# echo "...bumped into hard size administrative limit"
+# ;;
*)
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
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 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
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"
- ;;
+# 11)
+# echo "...bumped into unchecked administrative limit"
+# ;;
*)
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
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"
else
echo "...error: did not expect ldapsearch success ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
+ exit 1
fi
;;
4)
;;
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"
+
+test $KILLSERVERS != no && wait
+
exit 0