3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2006 The OpenLDAP Foundation.
6 ## All rights reserved.
8 ## Redistribution and use in source and binary forms, with or without
9 ## modification, are permitted only as authorized by the OpenLDAP
12 ## A copy of this license is available in the file LICENSE in the
13 ## top-level directory of the distribution or, alternatively, at
14 ## <http://www.OpenLDAP.org/license.html>.
16 ## FIXME: need to exclude legal but wrong results...
18 echo "running defines.sh"
19 . $SRCDIR/scripts/defines.sh
21 mkdir -p $TESTDIR $DBDIR1
23 echo "Running slapadd to build slapd database..."
24 . $CONFFILTER $BACKEND $MONITORDB < $LIMITSCONF > $ADDCONF
25 $SLAPADD -f $ADDCONF -l $LDIFLIMITS
27 if test $RC != 0 ; then
28 echo "slapadd failed ($RC)!"
32 echo "Running slapindex to index slapd database..."
33 . $CONFFILTER $BACKEND $MONITORDB < $LIMITSCONF > $CONF1
36 if test $RC != 0 ; then
37 echo "warning: slapindex failed ($RC)"
38 echo " assuming no indexing support"
41 echo "Starting slapd on TCP/IP port $PORT1..."
42 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
44 if test $WAIT != 0 ; then
52 echo "Testing slapd searching..."
53 for i in 0 1 2 3 4 5; do
54 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
55 '(objectclass=*)' > /dev/null 2>&1
57 if test $RC = 0 ; then
60 echo "Waiting 5 seconds for slapd to start..."
64 if test $RC != 0 ; then
65 echo "ldapsearch failed ($RC)!"
66 test $KILLSERVERS != no && kill -HUP $KILLPIDS
70 cat /dev/null > $SEARCHOUT
73 echo "Testing regular search limits"
76 echo "Testing no limits requested for unlimited ID..."
77 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
78 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
79 '(objectClass=*)' >$SEARCHOUT 2>&1
81 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
84 if test x"$COUNT" != x ; then
85 echo "...success (got $COUNT entries)"
87 echo "...error: did not expect ldapsearch success ($RC)!"
88 test $KILLSERVERS != no && kill -HUP $KILLPIDS
93 echo "ldapsearch failed ($RC)!"
94 test $KILLSERVERS != no && kill -HUP $KILLPIDS
99 echo "Testing no limits requested for rootdn=$MANAGERDN..."
100 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
102 '(objectClass=*)' >$SEARCHOUT 2>&1
104 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
107 if test x"$COUNT" != x ; then
108 echo "...success (got $COUNT entries)"
110 echo "...error: did not expect ldapsearch success ($RC)!"
111 test $KILLSERVERS != no && kill -HUP $KILLPIDS
116 echo "ldapsearch failed ($RC)!"
117 test $KILLSERVERS != no && kill -HUP $KILLPIDS
123 echo "Testing limit requested for rootdn=$MANAGERDN..."
124 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
126 '(objectClass=*)' >$SEARCHOUT 2>&1
128 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
131 if test x"$COUNT" != x ; then
132 if test "$COUNT" -gt "$SIZELIMIT" ; then
133 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
134 test $KILLSERVERS != no && kill -HUP $KILLPIDS
137 echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)"
139 echo "...error: did not expect ldapsearch success ($RC)!"
140 test $KILLSERVERS != no && kill -HUP $KILLPIDS
145 if test x"$COUNT" != x ; then
146 if test "$COUNT" = "$SIZELIMIT" ; then
147 echo "...bumped into requested size limit ($SIZELIMIT)"
149 echo "...error: got $COUNT entries with a requested sizelimit of $SIZELIMIT"
150 test $KILLSERVERS != no && kill -HUP $KILLPIDS
154 echo "...error: bumped into server-side size limit, but got no entries!"
155 test $KILLSERVERS != no && kill -HUP $KILLPIDS
160 echo "ldapsearch failed ($RC)!"
161 test $KILLSERVERS != no && kill -HUP $KILLPIDS
167 echo "Testing size limit request ($SIZELIMIT) for unlimited ID..."
168 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
169 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
170 '(objectClass=*)' > $SEARCHOUT 2>&1
172 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
175 if test x"$COUNT" != x ; then
176 if test "$COUNT" -gt "$SIZELIMIT" ; then
177 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
178 test $KILLSERVERS != no && kill -HUP $KILLPIDS
181 echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)"
183 echo "...error: did not expect ldapsearch success ($RC)!"
184 test $KILLSERVERS != no && kill -HUP $KILLPIDS
189 if test x"$COUNT" != x ; then
190 if test "$COUNT" = "$SIZELIMIT" ; then
191 echo "...bumped into requested size limit ($SIZELIMIT)"
193 echo "...error: got $COUNT entries with a requested sizelimit of $SIZELIMIT"
194 test $KILLSERVERS != no && kill -HUP $KILLPIDS
198 echo "...error: bumped into server-side size limit, but got no entries!"
199 test $KILLSERVERS != no && kill -HUP $KILLPIDS
204 echo "ldapsearch failed ($RC)!"
205 test $KILLSERVERS != no && kill -HUP $KILLPIDS
211 echo "Testing time limit request ($TIMELIMIT s) for unlimited ID..."
212 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -l $TIMELIMIT \
213 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
214 '(objectClass=*)' > $SEARCHOUT 2>&1
216 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
219 if test x"$COUNT" != x ; then
220 echo "...didn't bump into the requested time limit ($TIMELIMIT s; got $COUNT entries)"
222 echo "...error: did not expect ldapsearch success ($RC)!"
223 test $KILLSERVERS != no && kill -HUP $KILLPIDS
228 if test x"$COUNT" != x ; then
231 echo "...bumped into requested time limit ($TIMELIMIT s; got $COUNT entries)"
234 echo "ldapsearch failed ($RC)!"
235 test $KILLSERVERS != no && kill -HUP $KILLPIDS
240 echo "Testing no limits requested for soft limited ID..."
241 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
242 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
243 '(objectClass=*)' > $SEARCHOUT 2>&1
245 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
248 if test x"$COUNT" != x ; then
249 echo "...didn't bump into server-side size limit (got $COUNT entries)"
251 echo "...error: did not expect ldapsearch success ($RC)!"
252 test $KILLSERVERS != no && kill -HUP $KILLPIDS
257 if test x"$COUNT" != x ; then
258 echo "...bumped into server-side size limit (got $COUNT entries)"
260 echo "...error: bumped into server-side size limit, but got no entries!"
261 test $KILLSERVERS != no && kill -HUP $KILLPIDS
266 echo "ldapsearch failed ($RC)!"
267 test $KILLSERVERS != no && kill -HUP $KILLPIDS
273 echo "Testing lower than soft limit request ($SIZELIMIT) for soft limited ID..."
274 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
275 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
276 '(objectClass=*)' > $SEARCHOUT 2>&1
278 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
281 if test x"$COUNT" != x ; then
282 if test "$COUNT" -gt "$SIZELIMIT" ; then
283 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
284 test $KILLSERVERS != no && kill -HUP $KILLPIDS
287 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
289 echo "...error: did not expect ldapsearch success ($RC)!"
290 test $KILLSERVERS != no && kill -HUP $KILLPIDS
295 if test "x$COUNT" != "x" ; then
296 if test "x$SIZELIMIT" = "x$COUNT" ; then
297 echo "...bumped into requested ($SIZELIMIT) size limit"
299 echo "...bumped into server-side size limit ($COUNT)"
302 echo "...error: bumped into server-side size limit, but got no entries!"
303 test $KILLSERVERS != no && kill -HUP $KILLPIDS
308 echo "ldapsearch failed ($RC)!"
309 test $KILLSERVERS != no && kill -HUP $KILLPIDS
315 echo "Testing higher than soft limit request ($SIZELIMIT) for soft limited ID..."
316 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
317 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
318 '(objectClass=*)' > $SEARCHOUT 2>&1
320 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
323 if test x"$COUNT" != x ; then
324 if test "$COUNT" -gt "$SIZELIMIT" ; then
325 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
326 test $KILLSERVERS != no && kill -HUP $KILLPIDS
329 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
331 echo "...error: did not expect ldapsearch success ($RC)!"
332 test $KILLSERVERS != no && kill -HUP $KILLPIDS
337 if test "x$COUNT" != "x" ; then
338 if test "x$SIZELIMIT" = "x$COUNT" ; then
339 echo "...bumped into requested ($SIZELIMIT) size limit"
341 echo "...bumped into server-side size limit ($COUNT)"
344 echo "...error: bumped into server-side size limit, but got no entries!"
345 test $KILLSERVERS != no && kill -HUP $KILLPIDS
350 echo "ldapsearch failed ($RC)!"
351 test $KILLSERVERS != no && kill -HUP $KILLPIDS
357 echo "Testing lower than hard limit request ($SIZELIMIT) for hard limited ID..."
358 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
359 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
360 '(objectClass=*)' > $SEARCHOUT 2>&1
362 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
365 if test x"$COUNT" != x ; then
366 if test "$COUNT" -gt "$SIZELIMIT" ; then
367 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
368 test $KILLSERVERS != no && kill -HUP $KILLPIDS
371 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
373 echo "...error: did not expect ldapsearch success ($RC)!"
374 test $KILLSERVERS != no && kill -HUP $KILLPIDS
379 echo "...bumped into requested ($SIZELIMIT) size limit"
382 echo "ldapsearch failed ($RC)!"
383 test $KILLSERVERS != no && kill -HUP $KILLPIDS
389 echo "Testing higher than hard limit request ($SIZELIMIT) for hard limited ID..."
390 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
391 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
392 '(objectClass=*)' > $SEARCHOUT 2>&1
394 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
397 if test x"$COUNT" != x ; then
398 if test "$COUNT" -gt "$SIZELIMIT" ; then
399 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
400 test $KILLSERVERS != no && kill -HUP $KILLPIDS
403 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
405 echo "...error: did not expect ldapsearch success ($RC)!"
406 test $KILLSERVERS != no && kill -HUP $KILLPIDS
411 if test x"$COUNT" != x ; then
412 if test "$COUNT" = "$SIZELIMIT" ; then
413 echo "...error: bumped into requested ($SIZELIMIT) size limit"
414 test $KILLSERVERS != no && kill -HUP $KILLPIDS
417 echo "...got size limit $COUNT instead of requested $SIZELIMIT entries"
420 echo "...error: bumped into server-side size limit, but got no entries!"
421 test $KILLSERVERS != no && kill -HUP $KILLPIDS
426 # echo "...bumped into server-side hard size administrative limit"
429 echo "ldapsearch failed ($RC)!"
430 test $KILLSERVERS != no && kill -HUP $KILLPIDS
436 echo "Testing max limit request ($SIZELIMIT) for hard limited ID..."
437 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
438 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
439 '(objectClass=*)' > $SEARCHOUT 2>&1
441 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
444 if test x"$COUNT" != x ; then
445 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
447 echo "...error: did not expect ldapsearch success ($RC)!"
448 test $KILLSERVERS != no && kill -HUP $KILLPIDS
453 if test x"$COUNT" != x ; then
454 echo "...bumped into requested ($SIZELIMIT=$COUNT) size limit"
456 echo "...error: bumped into server-side size limit, but got no entries!"
457 test $KILLSERVERS != no && kill -HUP $KILLPIDS
462 # echo "...bumped into server-side hard size administrative limit"
465 echo "ldapsearch failed ($RC)!"
466 test $KILLSERVERS != no && kill -HUP $KILLPIDS
471 echo "Testing lower than unchecked limit request for unchecked limited ID..."
472 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
473 -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \
474 '(uid=uncheckedlimited)' > $SEARCHOUT 2>&1
476 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
479 if test x"$COUNT" != x ; then
480 echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
482 echo "...error: did not expect ldapsearch success ($RC)!"
483 test $KILLSERVERS != no && kill -HUP $KILLPIDS
488 echo "...error: bumped into unchecked administrative limit"
489 test $KILLSERVERS != no && kill -HUP $KILLPIDS
493 echo "ldapsearch failed ($RC)!"
494 test $KILLSERVERS != no && kill -HUP $KILLPIDS
499 echo "Testing higher than unchecked limit requested for unchecked limited ID..."
500 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
501 -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \
502 '(objectClass=*)' > $SEARCHOUT 2>&1
504 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
507 if test x"$COUNT" != x ; then
508 echo "...error: didn't bump into server-side unchecked limit (got $COUNT entries)"
510 echo "...error: did not expect ldapsearch success ($RC)!"
512 test $KILLSERVERS != no && kill -HUP $KILLPIDS
516 echo "...bumped into unchecked administrative limit"
519 echo "ldapsearch failed ($RC)!"
520 test $KILLSERVERS != no && kill -HUP $KILLPIDS
525 echo "Testing no limits requested for unchecked limited group..."
526 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
527 -D 'cn=Unchecked Limited User 2,ou=People,dc=example,dc=com' \
528 '(objectClass=*)' > $SEARCHOUT 2>&1
530 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
533 if test x"$COUNT" != x ; then
534 echo "...error: didn't bump into server-side unchecked limit (got $COUNT entries)"
536 echo "...error: did not expect ldapsearch success ($RC)!"
538 test $KILLSERVERS != no && kill -HUP $KILLPIDS
542 echo "...bumped into unchecked administrative limit"
545 echo "ldapsearch failed ($RC)!"
546 test $KILLSERVERS != no && kill -HUP $KILLPIDS
551 echo "Testing no limits requested for limited regex..."
552 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
553 -D 'cn=Foo User,ou=People,dc=example,dc=com' \
554 '(objectClass=*)' > $SEARCHOUT 2>&1
556 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
559 if test x"$COUNT" != x ; then
560 echo "...didn't bump into server-side size limit (got $COUNT entries)"
562 echo "...error: did not expect ldapsearch success ($RC)!"
563 test $KILLSERVERS != no && kill -HUP $KILLPIDS
568 if test "x$COUNT" != "x" ; then
569 echo "...bumped into server-side size limit ($COUNT)"
571 echo "...error: bumped into server-side size limit, but got no entries!"
572 test $KILLSERVERS != no && kill -HUP $KILLPIDS
577 echo "ldapsearch failed ($RC)!"
578 test $KILLSERVERS != no && kill -HUP $KILLPIDS
583 echo "Testing no limits requested for limited onelevel..."
584 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
585 -D 'cn=Bar User,ou=People,dc=example,dc=com' \
586 '(objectClass=*)' > $SEARCHOUT 2>&1
588 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
591 if test x"$COUNT" != x ; then
592 echo "...didn't bump into server-side size limit (got $COUNT entries)"
594 echo "...error: did not expect ldapsearch success ($RC)!"
595 test $KILLSERVERS != no && kill -HUP $KILLPIDS
600 if test "x$COUNT" != "x" ; then
601 echo "...bumped into server-side size limit ($COUNT)"
603 echo "...error: bumped into server-side size limit, but got no entries!"
604 test $KILLSERVERS != no && kill -HUP $KILLPIDS
609 echo "ldapsearch failed ($RC)!"
610 test $KILLSERVERS != no && kill -HUP $KILLPIDS
615 echo "Testing no limit requested for limited children..."
616 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
617 -D 'cn=Unchecked Limited Users,ou=Groups,dc=example,dc=com' \
618 '(objectClass=*)' > $SEARCHOUT 2>&1
620 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
623 if test x"$COUNT" != x ; then
624 echo "...didn't bump into server-side size limit (got $COUNT entries)"
626 echo "...error: did not expect ldapsearch success ($RC)!"
627 test $KILLSERVERS != no && kill -HUP $KILLPIDS
632 if test "x$COUNT" != "x" ; then
633 echo "...bumped into server-side size limit ($COUNT)"
635 echo "...error: bumped into server-side size limit, but got no entries!"
636 test $KILLSERVERS != no && kill -HUP $KILLPIDS
641 echo "ldapsearch failed ($RC)!"
642 test $KILLSERVERS != no && kill -HUP $KILLPIDS
647 echo "Testing no limit requested for limited subtree..."
648 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
649 -D 'cn=Unchecked Limited User 3,ou=Admin,dc=example,dc=com' \
650 '(objectClass=*)' > $SEARCHOUT 2>&1
652 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
655 if test x"$COUNT" != x ; then
656 echo "...didn't bump into server-side size limit (got $COUNT entries)"
658 echo "...error: did not expect ldapsearch success ($RC)!"
659 test $KILLSERVERS != no && kill -HUP $KILLPIDS
664 if test "x$COUNT" != "x" ; then
665 echo "...bumped into server-side size limit ($COUNT)"
667 echo "...error: bumped into server-side size limit, but got no entries!"
668 test $KILLSERVERS != no && kill -HUP $KILLPIDS
673 echo "ldapsearch failed ($RC)!"
674 test $KILLSERVERS != no && kill -HUP $KILLPIDS
679 echo "Testing no limit requested for limited users..."
680 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
681 -D 'cn=Special User,dc=example,dc=com' \
682 '(objectClass=*)' > $SEARCHOUT 2>&1
684 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
687 if test x"$COUNT" != x ; then
688 echo "...didn't bump into server-side size limit (got $COUNT entries)"
690 echo "...error: did not expect ldapsearch success ($RC)!"
691 test $KILLSERVERS != no && kill -HUP $KILLPIDS
696 if test "x$COUNT" != "x" ; then
697 echo "...bumped into server-side size limit ($COUNT)"
699 echo "...error: bumped into server-side size limit, but got no entries!"
700 test $KILLSERVERS != no && kill -HUP $KILLPIDS
705 echo "ldapsearch failed ($RC)!"
706 test $KILLSERVERS != no && kill -HUP $KILLPIDS
711 echo "Testing no limit requested for limited anonymous..."
712 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
713 '(objectClass=*)' > $SEARCHOUT 2>&1
715 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
718 if test x"$COUNT" != x ; then
719 echo "...didn't bump into server-side size limit (got $COUNT entries)"
721 echo "...error: did not expect ldapsearch success ($RC)!"
722 test $KILLSERVERS != no && kill -HUP $KILLPIDS
727 if test "x$COUNT" != "x" ; then
728 echo "...bumped into server-side size limit ($COUNT)"
730 echo "...error: bumped into server-side size limit, but got no entries!"
731 test $KILLSERVERS != no && kill -HUP $KILLPIDS
736 echo "ldapsearch failed ($RC)!"
737 test $KILLSERVERS != no && kill -HUP $KILLPIDS
744 # only bdb|hdb currently supports pagedResults control
747 test $KILLSERVERS != no && kill -HUP $KILLPIDS
749 echo ">>>>> Test succeeded"
754 if test x"$SLAPD_PAGE_SIZE" != x ; then
755 PAGESIZE="$SLAPD_PAGE_SIZE"
756 if test "$PAGESIZE" -le 0 ; then
757 test $KILLSERVERS != no && kill -HUP $KILLPIDS
760 echo "Testing with pagedResults control disabled"
762 echo ">>>>> Test succeeded"
770 echo "Testing regular search limits with pagedResults control (page size $PAGESIZE)"
773 echo "Testing no limits requested for unlimited ID..."
774 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
775 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
776 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' >$SEARCHOUT 2>&1
778 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
781 if test x"$COUNT" != x ; then
782 echo "...success (got $COUNT entries)"
784 echo "...error: did not expect ldapsearch success ($RC)!"
785 test $KILLSERVERS != no && kill -HUP $KILLPIDS
790 echo "ldapsearch failed ($RC)!"
791 test $KILLSERVERS != no && kill -HUP $KILLPIDS
797 echo "Testing size limit request ($SIZELIMIT) for unlimited ID..."
798 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
799 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
800 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
802 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
805 if test x"$COUNT" != x ; then
806 if test "$COUNT" -gt "$SIZELIMIT" ; then
807 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
808 test $KILLSERVERS != no && kill -HUP $KILLPIDS
811 echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)"
813 echo "...error: did not expect ldapsearch success ($RC)!"
814 test $KILLSERVERS != no && kill -HUP $KILLPIDS
819 if test x"$COUNT" != x ; then
820 if test $COUNT = $SIZELIMIT ; then
821 echo "...bumped into requested size limit ($SIZELIMIT)"
823 echo "...error: got $COUNT entries while requesting $SIZELIMIT..."
824 test $KILLSERVERS != no && kill -HUP $KILLPIDS
828 echo "...error: bumped into server-side size limit, but got no entries!"
829 test $KILLSERVERS != no && kill -HUP $KILLPIDS
834 echo "ldapsearch failed ($RC)!"
835 test $KILLSERVERS != no && kill -HUP $KILLPIDS
841 echo "Testing time limit request ($TIMELIMIT s) for unlimited ID..."
842 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -l $TIMELIMIT \
843 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
844 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
846 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
849 if test x"$COUNT" != x ; then
850 echo "...didn't bump into the requested time limit ($TIMELIMIT s; got $COUNT entries)"
852 echo "...error: did not expect ldapsearch success ($RC)!"
853 test $KILLSERVERS != no && kill -HUP $KILLPIDS
858 if test x"$COUNT" = x ; then
861 echo "...bumped into requested time limit ($TIMELIMIT s; got $COUNT entries)"
864 echo "ldapsearch failed ($RC)!"
865 test $KILLSERVERS != no && kill -HUP $KILLPIDS
870 echo "Testing no limits requested for soft limited ID..."
871 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
872 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
873 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
875 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
878 if test x"$COUNT" != x ; then
879 echo "...didn't bump into server-side size limit (got $COUNT entries)"
881 echo "...error: did not expect ldapsearch success ($RC)!"
882 test $KILLSERVERS != no && kill -HUP $KILLPIDS
887 if test x"$COUNT" != x ; then
888 echo "...bumped into server-side size limit (got $COUNT entries)"
890 echo "...error: bumped into server-side size limit, but got no entries!"
891 test $KILLSERVERS != no && kill -HUP $KILLPIDS
896 echo "ldapsearch failed ($RC)!"
897 test $KILLSERVERS != no && kill -HUP $KILLPIDS
903 echo "Testing lower than soft limit request ($SIZELIMIT) for soft limited ID..."
904 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
905 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
906 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
908 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
911 if test x"$COUNT" != x ; then
912 if test "$COUNT" -gt "$SIZELIMIT" ; then
913 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
914 test $KILLSERVERS != no && kill -HUP $KILLPIDS
917 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
919 echo "...error: did not expect ldapsearch success ($RC)!"
920 test $KILLSERVERS != no && kill -HUP $KILLPIDS
925 if test "x$COUNT" != "x" ; then
926 if test "x$SIZELIMIT" = "x$COUNT" ; then
927 echo "...bumped into requested ($SIZELIMIT) size limit"
929 echo "...bumped into server-side size limit ($COUNT)"
932 echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
936 echo "ldapsearch failed ($RC)!"
937 test $KILLSERVERS != no && kill -HUP $KILLPIDS
943 echo "Testing higher than soft limit request ($SIZELIMIT) for soft limited ID..."
944 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
945 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
946 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
948 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
951 if test x"$COUNT" != x ; then
952 if test "$COUNT" -gt "$SIZELIMIT" ; then
953 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
954 test $KILLSERVERS != no && kill -HUP $KILLPIDS
957 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
959 echo "...error: did not expect ldapsearch success ($RC)!"
960 test $KILLSERVERS != no && kill -HUP $KILLPIDS
965 if test "x$COUNT" != "x" ; then
966 if test "x$SIZELIMIT" = "x$COUNT" ; then
967 echo "...bumped into requested ($SIZELIMIT) size limit"
969 echo "...bumped into server-side size limit ($COUNT)"
972 echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
976 echo "ldapsearch failed ($RC)!"
977 test $KILLSERVERS != no && kill -HUP $KILLPIDS
983 echo "Testing lower than hard limit request ($SIZELIMIT) for hard limited ID..."
984 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
985 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
986 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
988 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
991 if test x"$COUNT" != x ; then
992 if test "$COUNT" -gt "$SIZELIMIT" ; then
993 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
994 test $KILLSERVERS != no && kill -HUP $KILLPIDS
997 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
999 echo "...error: did not expect ldapsearch success ($RC)!"
1000 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1005 if test x"$COUNT" != x ; then
1006 if test "$COUNT" = "$SIZELIMIT" ; then
1007 echo "...bumped into requested ($SIZELIMIT) size limit"
1009 echo "...error: got size limit $SIZELIMIT but $COUNT entries"
1010 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1014 echo "...error: bumped into server-side size limit, but got no entries!"
1015 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1020 echo "ldapsearch failed ($RC)!"
1021 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1027 echo "Testing higher than hard limit request ($SIZELIMIT) for hard limited ID..."
1028 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
1029 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
1030 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1032 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1035 if test x"$COUNT" != x ; then
1036 if test "$COUNT" -gt "$SIZELIMIT" ; then
1037 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
1038 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1041 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
1043 echo "...error: did not expect ldapsearch success ($RC)!"
1044 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1049 if test x"$COUNT" != x ; then
1050 if test "$COUNT" = "$SIZELIMIT" ; then
1051 echo "...error: bumped into requested ($SIZELIMIT) size limit"
1052 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1055 echo "...got size limit $COUNT instead of requested $SIZELIMIT entries"
1058 echo "...error: bumped into server-side size limit, but got no entries!"
1059 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1064 # echo "...bumped into hard size administrative limit"
1067 echo "ldapsearch failed ($RC)!"
1068 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1074 echo "Testing max limit request ($SIZELIMIT) for hard limited ID..."
1075 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
1076 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
1077 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1079 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1082 if test x"$COUNT" != x ; then
1083 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
1085 echo "...error: did not expect ldapsearch success ($RC)!"
1086 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1091 if test x"$COUNT" != x ; then
1092 echo "...bumped into requested ($SIZELIMIT=$COUNT) size limit"
1094 echo "...error: bumped into size limit but got no entries!"
1095 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1100 # echo "...bumped into hard size administrative limit"
1103 echo "ldapsearch failed ($RC)!"
1104 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1109 echo "Testing lower than unchecked limit request for unchecked limited ID..."
1110 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1111 -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \
1112 -E '!pr='$PAGESIZE'/noprompt' '(uid=uncheckedlimited)' > $SEARCHOUT 2>&1
1114 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1117 if test x"$COUNT" != x ; then
1118 echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
1120 echo "...error: did not expect ldapsearch success ($RC)!"
1121 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1126 # echo "...bumped into unchecked administrative limit"
1129 echo "ldapsearch failed ($RC)!"
1130 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1135 echo "Testing higher than unchecked limit requested for unchecked limited ID..."
1136 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1137 -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \
1138 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1140 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1143 if test x"$COUNT" != x ; then
1144 echo "...error: didn't bump into server-side unchecked limit (got $COUNT entries)"
1146 echo "...error: did not expect ldapsearch success ($RC)!"
1148 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1152 echo "...bumped into unchecked administrative limit"
1155 echo "ldapsearch failed ($RC)!"
1156 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1162 echo "Testing specific search limits with pagedResults control"
1165 echo "Testing no limit requested for unlimited page size ID..."
1166 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1167 -D 'cn=Unlimited User,ou=Paged Results Users,dc=example,dc=com' \
1168 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1170 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1173 if test x"$COUNT" != x ; then
1174 echo "...success; didn't bump into server-side size limit (got $COUNT entries)"
1176 echo "...error: did not expect ldapsearch success ($RC)!"
1177 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1182 if test x"$COUNT" != x ; then
1183 echo "...bumped into server-side size limit (got $COUNT entries)"
1185 echo "...error: bumped into server-side size limit, but got no entries!"
1186 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1191 echo "ldapsearch failed ($RC)!"
1192 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1197 echo "Testing no limit requested for limited page size ID..."
1198 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1199 -D 'cn=Page Size Limited User,ou=Paged Results Users,dc=example,dc=com' \
1200 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1202 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1205 echo "...success; didn't bump into server-side page size limit (got $COUNT entries)"
1208 echo "...bumped into page size limit ($COUNT)"
1211 echo "...bumped into page size administrative limit"
1214 echo "ldapsearch failed ($RC)!"
1215 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1220 echo "Testing no limit requested for pagedResults disabled ID..."
1221 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1222 -D 'cn=Paged Results Disabled User,ou=Paged Results Users,dc=example,dc=com' \
1223 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1225 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1228 echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
1231 echo "...bumped into server-side size limit ($COUNT)"
1234 echo "...bumped into pagedResults disabled administrative limit"
1237 echo "ldapsearch failed ($RC)!"
1238 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1243 echo "Testing no limit requested for pagedResults total count limited ID..."
1244 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1245 -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1246 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1248 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1251 echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
1254 echo "...bumped into server-side size limit ($COUNT)"
1257 echo "...bumped into pagedResults total count administrative limit"
1260 echo "ldapsearch failed ($RC)!"
1261 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1267 echo "Testing higher than hard but lower then total count limit requested for pagedResults total count limited ID..."
1268 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1269 -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1270 -z $SIZELIMIT -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1272 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1275 echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side unchecked limit (got $COUNT entries)"
1278 if test "x$COUNT" != "x" ; then
1279 if test "x$SIZELIMIT" = "x$COUNT" ; then
1280 echo "...bumped into requested ($SIZELIMIT) size limit"
1282 echo "...bumped into server-side size limit ($COUNT)"
1285 echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
1289 echo "...bumped into either hard size or pagedResults total count administrative limit"
1292 echo "ldapsearch failed ($RC)!"
1293 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1299 echo "Testing higher than total count limit requested for pagedResults total count limited ID..."
1300 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1301 -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1302 -z $SIZELIMIT -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1304 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1307 echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side unchecked limit (got $COUNT entries)"
1310 if test "x$COUNT" != "x" ; then
1311 if test "x$SIZELIMIT" = "x$COUNT" ; then
1312 echo "...bumped into requested ($SIZELIMIT) size limit"
1314 echo "...bumped into server-side size limit ($COUNT)"
1317 echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
1321 echo "...bumped into pagedResults total count administrative limit"
1324 echo "ldapsearch failed ($RC)!"
1325 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1331 echo "Testing max limit requested for pagedResults total count limited ID..."
1332 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1333 -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1334 -z $SIZELIMIT -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1336 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1339 echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side unchecked limit (got $COUNT entries)"
1342 if test "x$COUNT" != "x" ; then
1343 if test "x$SIZELIMIT" = "x$COUNT" ; then
1344 echo "...bumped into requested ($SIZELIMIT) size limit"
1346 echo "...bumped into server-side size limit ($COUNT)"
1349 echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
1353 echo "...bumped into pagedResults total count administrative limit"
1356 echo "ldapsearch failed ($RC)!"
1357 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1362 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1364 echo ">>>>> Test succeeded"
1366 test $KILLSERVERS != no && wait