mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
881 lines
25 KiB
Bash
Executable File
881 lines
25 KiB
Bash
Executable File
#! /bin/sh
|
|
# $OpenLDAP$
|
|
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
|
##
|
|
## Copyright 1998-2004 The OpenLDAP Foundation.
|
|
## All rights reserved.
|
|
##
|
|
## Redistribution and use in source and binary forms, with or without
|
|
## modification, are permitted only as authorized by the OpenLDAP
|
|
## Public License.
|
|
##
|
|
## A copy of this license is available in the file LICENSE in the
|
|
## top-level directory of the distribution or, alternatively, at
|
|
## <http://www.OpenLDAP.org/license.html>.
|
|
|
|
echo "running defines.sh"
|
|
. $SRCDIR/scripts/defines.sh
|
|
|
|
mkdir -p $TESTDIR $DBDIR1
|
|
|
|
echo "Running slapadd to build slapd database..."
|
|
. $CONFFILTER $BACKEND $MONITORDB < $LIMITSCONF > $ADDCONF
|
|
$SLAPADD -f $ADDCONF -l $LDIFLIMITS
|
|
RC=$?
|
|
if test $RC != 0 ; then
|
|
echo "slapadd failed ($RC)!"
|
|
exit $RC
|
|
fi
|
|
|
|
echo "Running slapindex to index slapd database..."
|
|
. $CONFFILTER $BACKEND $MONITORDB < $LIMITSCONF > $CONF1
|
|
$SLAPINDEX -f $CONF1
|
|
RC=$?
|
|
if test $RC != 0 ; then
|
|
echo "warning: slapindex failed ($RC)"
|
|
echo " assuming no indexing support"
|
|
fi
|
|
|
|
echo "Starting slapd on TCP/IP port $PORT1..."
|
|
$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
|
|
PID=$!
|
|
if test $WAIT != 0 ; then
|
|
echo PID $PID
|
|
read foo
|
|
fi
|
|
KILLPIDS="$PID"
|
|
|
|
echo "Testing slapd searching..."
|
|
for i in 0 1 2 3 4 5; do
|
|
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
|
|
'(objectclass=*)' > /dev/null 2>&1
|
|
RC=$?
|
|
if test $RC = 0 ; then
|
|
break
|
|
fi
|
|
echo "Waiting 5 seconds for slapd to start..."
|
|
sleep 5
|
|
done
|
|
|
|
if test $RC != 0 ; then
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
fi
|
|
|
|
cat /dev/null > $SEARCHOUT
|
|
|
|
echo ""
|
|
echo "Testing regular search limits"
|
|
echo ""
|
|
|
|
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' \
|
|
'(objectClass=*)' >$SEARCHOUT 2>&1
|
|
RC=$?
|
|
COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
|
|
case $RC in
|
|
0)
|
|
echo "...success (got $COUNT entries)"
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
SIZELIMIT=2
|
|
echo "Testing size limit request ($SIZELIMIT) for unlimited ID..."
|
|
$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
|
|
-D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
|
|
'(objectClass=*)' > $SEARCHOUT 2>&1
|
|
RC=$?
|
|
COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
|
|
case $RC in
|
|
0)
|
|
echo "...success (got $COUNT entries)"
|
|
;;
|
|
4)
|
|
echo "...bumped into requested size limit ($SIZELIMIT)"
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
TIMELIMIT=10
|
|
echo "Testing time limit request ($TIMELIMIT s) for unlimited ID..."
|
|
$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -l $TIMELIMIT \
|
|
-D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
|
|
'(objectClass=*)' > $SEARCHOUT 2>&1
|
|
RC=$?
|
|
COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
|
|
case $RC in
|
|
0)
|
|
echo "...success (got $COUNT entries)"
|
|
;;
|
|
3)
|
|
echo "...bumped into requested time limit ($TIMELIMIT s; $COUNT entries)"
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
echo "Testing no limits requested for soft limited ID..."
|
|
$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
|
|
-D 'cn=Soft 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 server-side size limit (got $COUNT entries)"
|
|
;;
|
|
4)
|
|
echo "...bumped into server-side size limit ($COUNT)"
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
SIZELIMIT=2
|
|
echo "Testing lower than soft limit request ($SIZELIMIT) for soft limited ID..."
|
|
$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
|
|
-D 'cn=Soft 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)
|
|
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
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
SIZELIMIT=100
|
|
echo "Testing higher than soft limit request ($SIZELIMIT) for soft limited ID..."
|
|
$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
|
|
-D 'cn=Soft 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)
|
|
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
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
SIZELIMIT=2
|
|
echo "Testing lower than hard 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) size limit"
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
SIZELIMIT=100
|
|
echo "Testing higher than hard 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) 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' \
|
|
'(uid=uncheckedlimited)' > $SEARCHOUT 2>&1
|
|
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"
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
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' \
|
|
'(objectClass=*)' > $SEARCHOUT 2>&1
|
|
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"
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
echo "Testing no limits requested for unchecked limited group..."
|
|
$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
|
|
-D 'cn=Unchecked Limited User 2,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 server-side unchecked limit (got $COUNT entries)"
|
|
;;
|
|
11)
|
|
echo "...bumped into unchecked administrative limit"
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
echo "Testing no limits requested for limited regex..."
|
|
$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
|
|
-D 'cn=Foo 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)
|
|
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
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
echo "Testing no limits requested for limited onelevel..."
|
|
$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
|
|
-D 'cn=Bar 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)
|
|
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
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
echo "Testing no limit requested for limited children..."
|
|
$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
|
|
-D 'cn=Unchecked Limited Users,ou=Groups,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)
|
|
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
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
echo "Testing no limit requested for limited subtree..."
|
|
$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
|
|
-D 'cn=Unchecked Limited User 3,ou=Admin,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)
|
|
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
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
echo "Testing no limit requested for limited users..."
|
|
$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
|
|
-D 'cn=Special User,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)
|
|
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
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
echo "Testing no limit requested for limited anonymous..."
|
|
$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
|
|
'(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)
|
|
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
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
case $BACKEND in
|
|
bdb | hdb)
|
|
# only bdb|hdb currently supports pagedResults control
|
|
;;
|
|
*)
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
|
|
echo ">>>>> Test succeeded"
|
|
exit 0
|
|
;;
|
|
esac
|
|
|
|
echo ""
|
|
echo "Testing regular search limits with pagedResults control"
|
|
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' \
|
|
-E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' >$SEARCHOUT 2>&1
|
|
RC=$?
|
|
COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
|
|
case $RC in
|
|
0)
|
|
echo "...success (got $COUNT entries)"
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
SIZELIMIT=2
|
|
echo "Testing size limit request ($SIZELIMIT) for unlimited ID..."
|
|
$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)
|
|
echo "...success (got $COUNT entries)"
|
|
;;
|
|
4)
|
|
echo "...bumped into requested size limit ($SIZELIMIT)"
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
TIMELIMIT=10
|
|
echo "Testing time limit request ($TIMELIMIT s) for unlimited ID..."
|
|
$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -l $TIMELIMIT \
|
|
-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)
|
|
echo "...success (got $COUNT entries)"
|
|
;;
|
|
3)
|
|
echo "...bumped into requested time limit ($TIMELIMIT s; $COUNT entries)"
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
echo "Testing no limits requested for soft limited ID..."
|
|
$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
|
|
-D 'cn=Soft 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 server-side size limit (got $COUNT entries)"
|
|
;;
|
|
4)
|
|
echo "...bumped into server-side size limit ($COUNT)"
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
SIZELIMIT=2
|
|
echo "Testing lower than soft limit request ($SIZELIMIT) for soft limited ID..."
|
|
$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
|
|
-D 'cn=Soft 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)
|
|
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
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
SIZELIMIT=100
|
|
echo "Testing higher than soft limit request ($SIZELIMIT) for soft limited ID..."
|
|
$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
|
|
-D 'cn=Soft 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)
|
|
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
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
SIZELIMIT=2
|
|
echo "Testing lower than hard 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) size limit"
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
SIZELIMIT=100
|
|
echo "Testing higher than hard 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) 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' \
|
|
-E '!pr='$PAGESIZE'/noprompt' '(uid=uncheckedlimited)' > $SEARCHOUT 2>&1
|
|
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"
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
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' \
|
|
-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 server-side unchecked limit (got $COUNT entries)"
|
|
;;
|
|
11)
|
|
echo "...bumped into unchecked administrative limit"
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
echo ""
|
|
echo "Testing specific search limits with pagedResults control"
|
|
echo ""
|
|
|
|
echo "Testing no limit requested for unlimited page size ID..."
|
|
$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
|
|
-D 'cn=Unlimited User,ou=Paged Results Users,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 server-side size limit (got $COUNT entries)"
|
|
;;
|
|
4)
|
|
echo "...bumped into server-side size limit ($COUNT)"
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
echo "Testing no limit requested for limited page size ID..."
|
|
$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
|
|
-D 'cn=Page Size Limited User,ou=Paged Results Users,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 server-side page size limit (got $COUNT entries)"
|
|
;;
|
|
4)
|
|
echo "...bumped into page size limit ($COUNT)"
|
|
;;
|
|
11)
|
|
echo "...bumped into page size administrative limit"
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
echo "Testing no limit requested for pagedResults disabled ID..."
|
|
$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
|
|
-D 'cn=Paged Results Disabled User,ou=Paged Results Users,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 server-side unchecked limit (got $COUNT entries)"
|
|
;;
|
|
4)
|
|
echo "...bumped into server-side size limit ($COUNT)"
|
|
;;
|
|
11)
|
|
echo "...bumped into pagedResults disabled administrative limit"
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
echo "Testing no 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' \
|
|
-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 server-side unchecked limit (got $COUNT entries)"
|
|
;;
|
|
4)
|
|
echo "...bumped into server-side size limit ($COUNT)"
|
|
;;
|
|
11)
|
|
echo "...bumped into pagedResults total count administrative limit"
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
SIZELIMIT=8
|
|
echo "Testing higher than hard but lower then total count 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 either hard size or pagedResults total count administrative limit"
|
|
;;
|
|
*)
|
|
echo "ldapsearch failed ($RC)!"
|
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
exit $RC
|
|
;;
|
|
esac
|
|
|
|
SIZELIMIT=15
|
|
echo "Testing higher than total count 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"
|
|
exit 0
|