3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2010 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 if test $BACKEND = null; then
22 echo "Limits irrelevant to $BACKEND backend, test skipped"
26 mkdir -p $TESTDIR $DBDIR1
28 echo "Running slapadd to build slapd database..."
29 . $CONFFILTER $BACKEND $MONITORDB < $LIMITSCONF > $ADDCONF
30 $SLAPADD -f $ADDCONF -l $LDIFLIMITS
32 if test $RC != 0 ; then
33 echo "slapadd failed ($RC)!"
37 echo "Running slapindex to index slapd database..."
38 . $CONFFILTER $BACKEND $MONITORDB < $LIMITSCONF > $CONF1
41 if test $RC != 0 ; then
42 echo "warning: slapindex failed ($RC)"
43 echo " assuming no indexing support"
46 echo "Starting slapd on TCP/IP port $PORT1..."
47 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
49 if test $WAIT != 0 ; then
57 echo "Testing slapd searching..."
58 for i in 0 1 2 3 4 5; do
59 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
60 '(objectclass=*)' > /dev/null 2>&1
62 if test $RC = 0 ; then
65 echo "Waiting 5 seconds for slapd to start..."
69 if test $RC != 0 ; then
70 echo "ldapsearch failed ($RC)!"
71 test $KILLSERVERS != no && kill -HUP $KILLPIDS
75 cat /dev/null > $SEARCHOUT
78 echo "Testing regular search limits"
81 echo "Testing no limits requested for unlimited ID..."
82 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
83 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
84 '(objectClass=*)' >$SEARCHOUT 2>&1
86 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
89 if test x"$COUNT" != x ; then
90 echo "...success (got $COUNT entries)"
92 echo "...error: did not expect ldapsearch success ($RC)!"
93 test $KILLSERVERS != no && kill -HUP $KILLPIDS
98 echo "ldapsearch failed ($RC)!"
99 test $KILLSERVERS != no && kill -HUP $KILLPIDS
104 echo "Testing no limits requested for rootdn=$MANAGERDN..."
105 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
107 '(objectClass=*)' >$SEARCHOUT 2>&1
109 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
112 if test x"$COUNT" != x ; then
113 echo "...success (got $COUNT entries)"
115 echo "...error: did not expect ldapsearch success ($RC)!"
116 test $KILLSERVERS != no && kill -HUP $KILLPIDS
121 echo "ldapsearch failed ($RC)!"
122 test $KILLSERVERS != no && kill -HUP $KILLPIDS
128 echo "Testing limit requested for rootdn=$MANAGERDN..."
129 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
131 '(objectClass=*)' >$SEARCHOUT 2>&1
133 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
136 if test x"$COUNT" != x ; then
137 if test "$COUNT" -gt "$SIZELIMIT" ; then
138 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
139 test $KILLSERVERS != no && kill -HUP $KILLPIDS
142 echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)"
144 echo "...error: did not expect ldapsearch success ($RC)!"
145 test $KILLSERVERS != no && kill -HUP $KILLPIDS
150 if test x"$COUNT" != x ; then
151 if test "$COUNT" = "$SIZELIMIT" ; then
152 echo "...bumped into requested size limit ($SIZELIMIT)"
154 echo "...error: got $COUNT entries with a requested sizelimit of $SIZELIMIT"
155 test $KILLSERVERS != no && kill -HUP $KILLPIDS
159 echo "...error: bumped into server-side size limit, but got no entries!"
160 test $KILLSERVERS != no && kill -HUP $KILLPIDS
165 echo "ldapsearch failed ($RC)!"
166 test $KILLSERVERS != no && kill -HUP $KILLPIDS
172 echo "Testing size limit request ($SIZELIMIT) for unlimited ID..."
173 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
174 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
175 '(objectClass=*)' > $SEARCHOUT 2>&1
177 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
180 if test x"$COUNT" != x ; then
181 if test "$COUNT" -gt "$SIZELIMIT" ; then
182 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
183 test $KILLSERVERS != no && kill -HUP $KILLPIDS
186 echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)"
188 echo "...error: did not expect ldapsearch success ($RC)!"
189 test $KILLSERVERS != no && kill -HUP $KILLPIDS
194 if test x"$COUNT" != x ; then
195 if test "$COUNT" = "$SIZELIMIT" ; then
196 echo "...bumped into requested size limit ($SIZELIMIT)"
198 echo "...error: got $COUNT entries with a requested sizelimit of $SIZELIMIT"
199 test $KILLSERVERS != no && kill -HUP $KILLPIDS
203 echo "...error: bumped into server-side size limit, but got no entries!"
204 test $KILLSERVERS != no && kill -HUP $KILLPIDS
209 echo "ldapsearch failed ($RC)!"
210 test $KILLSERVERS != no && kill -HUP $KILLPIDS
216 echo "Testing time limit request ($TIMELIMIT s) for unlimited ID..."
217 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -l $TIMELIMIT \
218 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
219 '(objectClass=*)' > $SEARCHOUT 2>&1
221 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
224 if test x"$COUNT" != x ; then
225 echo "...didn't bump into the requested time limit ($TIMELIMIT s; got $COUNT entries)"
227 echo "...error: did not expect ldapsearch success ($RC)!"
228 test $KILLSERVERS != no && kill -HUP $KILLPIDS
233 if test x"$COUNT" != x ; then
236 echo "...bumped into requested time limit ($TIMELIMIT s; got $COUNT entries)"
239 echo "ldapsearch failed ($RC)!"
240 test $KILLSERVERS != no && kill -HUP $KILLPIDS
245 echo "Testing no limits requested for soft limited ID..."
246 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
247 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
248 '(objectClass=*)' > $SEARCHOUT 2>&1
250 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
253 if test x"$COUNT" != x ; then
254 echo "...didn't bump into server-side size limit (got $COUNT entries)"
256 echo "...error: did not expect ldapsearch success ($RC)!"
257 test $KILLSERVERS != no && kill -HUP $KILLPIDS
262 if test x"$COUNT" != x ; then
263 echo "...bumped into server-side size limit (got $COUNT entries)"
265 echo "...error: bumped into server-side size limit, but got no entries!"
266 test $KILLSERVERS != no && kill -HUP $KILLPIDS
271 echo "ldapsearch failed ($RC)!"
272 test $KILLSERVERS != no && kill -HUP $KILLPIDS
278 echo "Testing lower than soft limit request ($SIZELIMIT) for soft limited ID..."
279 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
280 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
281 '(objectClass=*)' > $SEARCHOUT 2>&1
283 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
286 if test x"$COUNT" != x ; then
287 if test "$COUNT" -gt "$SIZELIMIT" ; then
288 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
289 test $KILLSERVERS != no && kill -HUP $KILLPIDS
292 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
294 echo "...error: did not expect ldapsearch success ($RC)!"
295 test $KILLSERVERS != no && kill -HUP $KILLPIDS
300 if test "x$COUNT" != "x" ; then
301 if test "x$SIZELIMIT" = "x$COUNT" ; then
302 echo "...bumped into requested ($SIZELIMIT) size limit"
304 echo "...bumped into server-side size limit ($COUNT)"
307 echo "...error: bumped into server-side size limit, but got no entries!"
308 test $KILLSERVERS != no && kill -HUP $KILLPIDS
313 echo "ldapsearch failed ($RC)!"
314 test $KILLSERVERS != no && kill -HUP $KILLPIDS
320 echo "Testing higher than soft limit request ($SIZELIMIT) for soft limited ID..."
321 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
322 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
323 '(objectClass=*)' > $SEARCHOUT 2>&1
325 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
328 if test x"$COUNT" != x ; then
329 if test "$COUNT" -gt "$SIZELIMIT" ; then
330 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
331 test $KILLSERVERS != no && kill -HUP $KILLPIDS
334 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
336 echo "...error: did not expect ldapsearch success ($RC)!"
337 test $KILLSERVERS != no && kill -HUP $KILLPIDS
342 if test "x$COUNT" != "x" ; then
343 if test "x$SIZELIMIT" = "x$COUNT" ; then
344 echo "...bumped into requested ($SIZELIMIT) size limit"
346 echo "...bumped into server-side size limit ($COUNT)"
349 echo "...error: bumped into server-side size limit, but got no entries!"
350 test $KILLSERVERS != no && kill -HUP $KILLPIDS
355 echo "ldapsearch failed ($RC)!"
356 test $KILLSERVERS != no && kill -HUP $KILLPIDS
362 echo "Testing lower than hard limit request ($SIZELIMIT) for hard limited ID..."
363 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
364 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
365 '(objectClass=*)' > $SEARCHOUT 2>&1
367 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
370 if test x"$COUNT" != x ; then
371 if test "$COUNT" -gt "$SIZELIMIT" ; then
372 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
373 test $KILLSERVERS != no && kill -HUP $KILLPIDS
376 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
378 echo "...error: did not expect ldapsearch success ($RC)!"
379 test $KILLSERVERS != no && kill -HUP $KILLPIDS
384 echo "...bumped into requested ($SIZELIMIT) size limit"
387 echo "ldapsearch failed ($RC)!"
388 test $KILLSERVERS != no && kill -HUP $KILLPIDS
394 echo "Testing higher than hard limit request ($SIZELIMIT) for hard limited ID..."
395 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
396 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
397 '(objectClass=*)' > $SEARCHOUT 2>&1
399 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
402 if test x"$COUNT" != x ; then
403 if test "$COUNT" -gt "$SIZELIMIT" ; then
404 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
405 test $KILLSERVERS != no && kill -HUP $KILLPIDS
408 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
410 echo "...error: did not expect ldapsearch success ($RC)!"
411 test $KILLSERVERS != no && kill -HUP $KILLPIDS
416 if test x"$COUNT" != x ; then
417 if test "$COUNT" = "$SIZELIMIT" ; then
418 echo "...error: bumped into requested ($SIZELIMIT) size limit"
419 test $KILLSERVERS != no && kill -HUP $KILLPIDS
422 echo "...got size limit $COUNT instead of requested $SIZELIMIT entries"
425 echo "...error: bumped into server-side size limit, but got no entries!"
426 test $KILLSERVERS != no && kill -HUP $KILLPIDS
431 # echo "...bumped into server-side hard size administrative limit"
434 echo "ldapsearch failed ($RC)!"
435 test $KILLSERVERS != no && kill -HUP $KILLPIDS
441 echo "Testing max limit request ($SIZELIMIT) for hard limited ID..."
442 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
443 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
444 '(objectClass=*)' > $SEARCHOUT 2>&1
446 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
449 if test x"$COUNT" != x ; then
450 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
452 echo "...error: did not expect ldapsearch success ($RC)!"
453 test $KILLSERVERS != no && kill -HUP $KILLPIDS
458 if test x"$COUNT" != x ; then
459 echo "...bumped into requested ($SIZELIMIT=$COUNT) size limit"
461 echo "...error: bumped into server-side size limit, but got no entries!"
462 test $KILLSERVERS != no && kill -HUP $KILLPIDS
467 # echo "...bumped into server-side hard size administrative limit"
470 echo "ldapsearch failed ($RC)!"
471 test $KILLSERVERS != no && kill -HUP $KILLPIDS
476 echo "Testing lower than unchecked limit request for unchecked limited ID..."
477 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
478 -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \
479 '(uid=uncheckedlimited)' > $SEARCHOUT 2>&1
481 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
484 if test x"$COUNT" != x ; then
485 echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
487 echo "...error: did not expect ldapsearch success ($RC)!"
488 test $KILLSERVERS != no && kill -HUP $KILLPIDS
493 echo "...error: bumped into unchecked administrative limit"
494 test $KILLSERVERS != no && kill -HUP $KILLPIDS
498 echo "ldapsearch failed ($RC)!"
499 test $KILLSERVERS != no && kill -HUP $KILLPIDS
504 case $BACKEND in bdb | hdb)
506 echo "Testing higher than unchecked limit requested for unchecked limited ID..."
507 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
508 -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \
509 '(objectClass=*)' > $SEARCHOUT 2>&1
511 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
514 if test x"$COUNT" != x ; then
515 echo "...error: didn't bump into server-side unchecked limit (got $COUNT entries)"
517 echo "...error: did not expect ldapsearch success ($RC)!"
519 test $KILLSERVERS != no && kill -HUP $KILLPIDS
523 echo "...bumped into unchecked administrative limit"
526 echo "ldapsearch failed ($RC)!"
527 test $KILLSERVERS != no && kill -HUP $KILLPIDS
532 echo "Testing no limits requested for unchecked limited group..."
533 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
534 -D 'cn=Unchecked Limited User 2,ou=People,dc=example,dc=com' \
535 '(objectClass=*)' > $SEARCHOUT 2>&1
537 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
540 if test x"$COUNT" != x ; then
541 echo "...error: didn't bump into server-side unchecked limit (got $COUNT entries)"
543 echo "...error: did not expect ldapsearch success ($RC)!"
545 test $KILLSERVERS != no && kill -HUP $KILLPIDS
549 echo "...bumped into unchecked administrative limit"
552 echo "ldapsearch failed ($RC)!"
553 test $KILLSERVERS != no && kill -HUP $KILLPIDS
558 *) echo "Skipping test for unchecked limit with $BACKEND backend." ;;
561 echo "Testing no limits requested for limited regex..."
562 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
563 -D 'cn=Foo User,ou=People,dc=example,dc=com' \
564 '(objectClass=*)' > $SEARCHOUT 2>&1
566 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
569 if test x"$COUNT" != x ; then
570 echo "...didn't bump into server-side size limit (got $COUNT entries)"
572 echo "...error: did not expect ldapsearch success ($RC)!"
573 test $KILLSERVERS != no && kill -HUP $KILLPIDS
578 if test "x$COUNT" != "x" ; then
579 echo "...bumped into server-side size limit ($COUNT)"
581 echo "...error: bumped into server-side size limit, but got no entries!"
582 test $KILLSERVERS != no && kill -HUP $KILLPIDS
587 echo "ldapsearch failed ($RC)!"
588 test $KILLSERVERS != no && kill -HUP $KILLPIDS
593 echo "Testing no limits requested for limited onelevel..."
594 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
595 -D 'cn=Bar User,ou=People,dc=example,dc=com' \
596 '(objectClass=*)' > $SEARCHOUT 2>&1
598 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
601 if test x"$COUNT" != x ; then
602 echo "...didn't bump into server-side size limit (got $COUNT entries)"
604 echo "...error: did not expect ldapsearch success ($RC)!"
605 test $KILLSERVERS != no && kill -HUP $KILLPIDS
610 if test "x$COUNT" != "x" ; then
611 echo "...bumped into server-side size limit ($COUNT)"
613 echo "...error: bumped into server-side size limit, but got no entries!"
614 test $KILLSERVERS != no && kill -HUP $KILLPIDS
619 echo "ldapsearch failed ($RC)!"
620 test $KILLSERVERS != no && kill -HUP $KILLPIDS
625 echo "Testing no limit requested for limited children..."
626 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
627 -D 'cn=Unchecked Limited Users,ou=Groups,dc=example,dc=com' \
628 '(objectClass=*)' > $SEARCHOUT 2>&1
630 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
633 if test x"$COUNT" != x ; then
634 echo "...didn't bump into server-side size limit (got $COUNT entries)"
636 echo "...error: did not expect ldapsearch success ($RC)!"
637 test $KILLSERVERS != no && kill -HUP $KILLPIDS
642 if test "x$COUNT" != "x" ; then
643 echo "...bumped into server-side size limit ($COUNT)"
645 echo "...error: bumped into server-side size limit, but got no entries!"
646 test $KILLSERVERS != no && kill -HUP $KILLPIDS
651 echo "ldapsearch failed ($RC)!"
652 test $KILLSERVERS != no && kill -HUP $KILLPIDS
657 echo "Testing no limit requested for limited subtree..."
658 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
659 -D 'cn=Unchecked Limited User 3,ou=Admin,dc=example,dc=com' \
660 '(objectClass=*)' > $SEARCHOUT 2>&1
662 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
665 if test x"$COUNT" != x ; then
666 echo "...didn't bump into server-side size limit (got $COUNT entries)"
668 echo "...error: did not expect ldapsearch success ($RC)!"
669 test $KILLSERVERS != no && kill -HUP $KILLPIDS
674 if test "x$COUNT" != "x" ; then
675 echo "...bumped into server-side size limit ($COUNT)"
677 echo "...error: bumped into server-side size limit, but got no entries!"
678 test $KILLSERVERS != no && kill -HUP $KILLPIDS
683 echo "ldapsearch failed ($RC)!"
684 test $KILLSERVERS != no && kill -HUP $KILLPIDS
689 echo "Testing no limit requested for limited users..."
690 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
691 -D 'cn=Special User,dc=example,dc=com' \
692 '(objectClass=*)' > $SEARCHOUT 2>&1
694 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
697 if test x"$COUNT" != x ; then
698 echo "...didn't bump into server-side size limit (got $COUNT entries)"
700 echo "...error: did not expect ldapsearch success ($RC)!"
701 test $KILLSERVERS != no && kill -HUP $KILLPIDS
706 if test "x$COUNT" != "x" ; then
707 echo "...bumped into server-side size limit ($COUNT)"
709 echo "...error: bumped into server-side size limit, but got no entries!"
710 test $KILLSERVERS != no && kill -HUP $KILLPIDS
715 echo "ldapsearch failed ($RC)!"
716 test $KILLSERVERS != no && kill -HUP $KILLPIDS
721 echo "Testing no limit requested for limited anonymous..."
722 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
723 '(objectClass=*)' > $SEARCHOUT 2>&1
725 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
728 if test x"$COUNT" != x ; then
729 echo "...didn't bump into server-side size limit (got $COUNT entries)"
731 echo "...error: did not expect ldapsearch success ($RC)!"
732 test $KILLSERVERS != no && kill -HUP $KILLPIDS
737 if test "x$COUNT" != "x" ; then
738 echo "...bumped into server-side size limit ($COUNT)"
740 echo "...error: bumped into server-side size limit, but got no entries!"
741 test $KILLSERVERS != no && kill -HUP $KILLPIDS
746 echo "ldapsearch failed ($RC)!"
747 test $KILLSERVERS != no && kill -HUP $KILLPIDS
754 # only bdb|hdb currently supports pagedResults control
757 test $KILLSERVERS != no && kill -HUP $KILLPIDS
759 echo ">>>>> Test succeeded"
764 if test x"$SLAPD_PAGE_SIZE" != x ; then
765 PAGESIZE="$SLAPD_PAGE_SIZE"
766 if test "$PAGESIZE" -le 0 ; then
767 test $KILLSERVERS != no && kill -HUP $KILLPIDS
770 echo "Testing with pagedResults control disabled"
772 echo ">>>>> Test succeeded"
780 echo "Testing regular search limits with pagedResults control (page size $PAGESIZE)"
783 echo "Testing no limits requested for unlimited ID..."
784 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
785 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
786 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' >$SEARCHOUT 2>&1
788 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
791 if test x"$COUNT" != x ; then
792 echo "...success (got $COUNT entries)"
794 echo "...error: did not expect ldapsearch success ($RC)!"
795 test $KILLSERVERS != no && kill -HUP $KILLPIDS
800 echo "ldapsearch failed ($RC)!"
801 test $KILLSERVERS != no && kill -HUP $KILLPIDS
807 echo "Testing size limit request ($SIZELIMIT) for unlimited ID..."
808 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
809 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
810 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
812 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
815 if test x"$COUNT" != x ; then
816 if test "$COUNT" -gt "$SIZELIMIT" ; then
817 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
818 test $KILLSERVERS != no && kill -HUP $KILLPIDS
821 echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)"
823 echo "...error: did not expect ldapsearch success ($RC)!"
824 test $KILLSERVERS != no && kill -HUP $KILLPIDS
829 if test x"$COUNT" != x ; then
830 if test $COUNT = $SIZELIMIT ; then
831 echo "...bumped into requested size limit ($SIZELIMIT)"
833 echo "...error: got $COUNT entries while requesting $SIZELIMIT..."
834 test $KILLSERVERS != no && kill -HUP $KILLPIDS
838 echo "...error: bumped into server-side size limit, but got no entries!"
839 test $KILLSERVERS != no && kill -HUP $KILLPIDS
844 echo "ldapsearch failed ($RC)!"
845 test $KILLSERVERS != no && kill -HUP $KILLPIDS
851 echo "Testing time limit request ($TIMELIMIT s) for unlimited ID..."
852 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -l $TIMELIMIT \
853 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
854 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
856 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
859 if test x"$COUNT" != x ; then
860 echo "...didn't bump into the requested time limit ($TIMELIMIT s; got $COUNT entries)"
862 echo "...error: did not expect ldapsearch success ($RC)!"
863 test $KILLSERVERS != no && kill -HUP $KILLPIDS
868 if test x"$COUNT" = x ; then
871 echo "...bumped into requested time limit ($TIMELIMIT s; got $COUNT entries)"
874 echo "ldapsearch failed ($RC)!"
875 test $KILLSERVERS != no && kill -HUP $KILLPIDS
880 echo "Testing no limits requested for soft limited ID..."
881 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
882 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
883 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
885 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
888 if test x"$COUNT" != x ; then
889 echo "...didn't bump into server-side size limit (got $COUNT entries)"
891 echo "...error: did not expect ldapsearch success ($RC)!"
892 test $KILLSERVERS != no && kill -HUP $KILLPIDS
897 if test x"$COUNT" != x ; then
898 echo "...bumped into server-side size limit (got $COUNT entries)"
900 echo "...error: bumped into server-side size limit, but got no entries!"
901 test $KILLSERVERS != no && kill -HUP $KILLPIDS
906 echo "ldapsearch failed ($RC)!"
907 test $KILLSERVERS != no && kill -HUP $KILLPIDS
913 echo "Testing lower than soft limit request ($SIZELIMIT) for soft limited ID..."
914 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
915 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
916 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
918 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
921 if test x"$COUNT" != x ; then
922 if test "$COUNT" -gt "$SIZELIMIT" ; then
923 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
924 test $KILLSERVERS != no && kill -HUP $KILLPIDS
927 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
929 echo "...error: did not expect ldapsearch success ($RC)!"
930 test $KILLSERVERS != no && kill -HUP $KILLPIDS
935 if test "x$COUNT" != "x" ; then
936 if test "x$SIZELIMIT" = "x$COUNT" ; then
937 echo "...bumped into requested ($SIZELIMIT) size limit"
939 echo "...bumped into server-side size limit ($COUNT)"
942 echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
946 echo "ldapsearch failed ($RC)!"
947 test $KILLSERVERS != no && kill -HUP $KILLPIDS
953 echo "Testing higher than soft limit request ($SIZELIMIT) for soft limited ID..."
954 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
955 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
956 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
958 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
961 if test x"$COUNT" != x ; then
962 if test "$COUNT" -gt "$SIZELIMIT" ; then
963 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
964 test $KILLSERVERS != no && kill -HUP $KILLPIDS
967 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
969 echo "...error: did not expect ldapsearch success ($RC)!"
970 test $KILLSERVERS != no && kill -HUP $KILLPIDS
975 if test "x$COUNT" != "x" ; then
976 if test "x$SIZELIMIT" = "x$COUNT" ; then
977 echo "...bumped into requested ($SIZELIMIT) size limit"
979 echo "...bumped into server-side size limit ($COUNT)"
982 echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
986 echo "ldapsearch failed ($RC)!"
987 test $KILLSERVERS != no && kill -HUP $KILLPIDS
993 echo "Testing lower than hard limit request ($SIZELIMIT) for hard limited ID..."
994 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
995 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
996 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
998 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1001 if test x"$COUNT" != x ; then
1002 if test "$COUNT" -gt "$SIZELIMIT" ; then
1003 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
1004 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1007 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
1009 echo "...error: did not expect ldapsearch success ($RC)!"
1010 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1015 if test x"$COUNT" != x ; then
1016 if test "$COUNT" = "$SIZELIMIT" ; then
1017 echo "...bumped into requested ($SIZELIMIT) size limit"
1019 echo "...error: got size limit $SIZELIMIT but $COUNT entries"
1020 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1024 echo "...error: bumped into server-side size limit, but got no entries!"
1025 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1030 echo "ldapsearch failed ($RC)!"
1031 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1037 echo "Testing higher than hard limit request ($SIZELIMIT) for hard limited ID..."
1038 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
1039 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
1040 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1042 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1045 if test x"$COUNT" != x ; then
1046 if test "$COUNT" -gt "$SIZELIMIT" ; then
1047 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
1048 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1051 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
1053 echo "...error: did not expect ldapsearch success ($RC)!"
1054 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1059 if test x"$COUNT" != x ; then
1060 if test "$COUNT" = "$SIZELIMIT" ; then
1061 echo "...error: bumped into requested ($SIZELIMIT) size limit"
1062 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1065 echo "...got size limit $COUNT instead of requested $SIZELIMIT entries"
1068 echo "...error: bumped into server-side size limit, but got no entries!"
1069 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1074 # echo "...bumped into hard size administrative limit"
1077 echo "ldapsearch failed ($RC)!"
1078 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1084 echo "Testing max limit request ($SIZELIMIT) for hard limited ID..."
1085 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
1086 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
1087 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1089 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1092 if test x"$COUNT" != x ; then
1093 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
1095 echo "...error: did not expect ldapsearch success ($RC)!"
1096 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1101 if test x"$COUNT" != x ; then
1102 echo "...bumped into requested ($SIZELIMIT=$COUNT) size limit"
1104 echo "...error: bumped into size limit but got no entries!"
1105 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1110 # echo "...bumped into hard size administrative limit"
1113 echo "ldapsearch failed ($RC)!"
1114 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1119 echo "Testing lower than unchecked limit request for unchecked limited ID..."
1120 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1121 -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \
1122 -E '!pr='$PAGESIZE'/noprompt' '(uid=uncheckedlimited)' > $SEARCHOUT 2>&1
1124 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1127 if test x"$COUNT" != x ; then
1128 echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
1130 echo "...error: did not expect ldapsearch success ($RC)!"
1131 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1136 # echo "...bumped into unchecked administrative limit"
1139 echo "ldapsearch failed ($RC)!"
1140 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1145 echo "Testing higher than unchecked limit requested for unchecked limited ID..."
1146 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1147 -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \
1148 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1150 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1153 if test x"$COUNT" != x ; then
1154 echo "...error: didn't bump into server-side unchecked limit (got $COUNT entries)"
1156 echo "...error: did not expect ldapsearch success ($RC)!"
1158 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1162 echo "...bumped into unchecked administrative limit"
1165 echo "ldapsearch failed ($RC)!"
1166 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1172 echo "Testing specific search limits with pagedResults control"
1175 echo "Testing no limit requested for unlimited page size ID..."
1176 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1177 -D 'cn=Unlimited User,ou=Paged Results Users,dc=example,dc=com' \
1178 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1180 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1183 if test x"$COUNT" != x ; then
1184 echo "...success; didn't bump into server-side size limit (got $COUNT entries)"
1186 echo "...error: did not expect ldapsearch success ($RC)!"
1187 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1192 if test x"$COUNT" != x ; then
1193 echo "...bumped into server-side size limit (got $COUNT entries)"
1195 echo "...error: bumped into server-side size limit, but got no entries!"
1196 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1201 echo "ldapsearch failed ($RC)!"
1202 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1207 echo "Testing no limit requested for limited page size ID..."
1208 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1209 -D 'cn=Page Size Limited User,ou=Paged Results Users,dc=example,dc=com' \
1210 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1212 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1215 echo "...success; didn't bump into server-side page size limit (got $COUNT entries)"
1218 echo "...bumped into page size limit ($COUNT)"
1221 echo "...bumped into page size administrative limit"
1224 echo "ldapsearch failed ($RC)!"
1225 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1230 echo "Testing no limit requested for pagedResults disabled ID..."
1231 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1232 -D 'cn=Paged Results Disabled User,ou=Paged Results Users,dc=example,dc=com' \
1233 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1235 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1238 echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
1241 echo "...bumped into server-side size limit ($COUNT)"
1244 echo "...bumped into pagedResults disabled administrative limit"
1247 echo "ldapsearch failed ($RC)!"
1248 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1253 echo "Testing no limit requested for pagedResults total count limited ID..."
1254 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1255 -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1256 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1258 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1261 echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
1264 echo "...bumped into server-side size limit ($COUNT)"
1267 echo "...bumped into pagedResults total count administrative limit"
1270 echo "ldapsearch failed ($RC)!"
1271 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1277 echo "Testing higher than hard but lower then total count limit requested for pagedResults total count limited ID..."
1278 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1279 -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1280 -z $SIZELIMIT -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1282 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1285 echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side unchecked limit (got $COUNT entries)"
1288 if test "x$COUNT" != "x" ; then
1289 if test "x$SIZELIMIT" = "x$COUNT" ; then
1290 echo "...bumped into requested ($SIZELIMIT) size limit"
1292 echo "...bumped into server-side size limit ($COUNT)"
1295 echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
1299 echo "...bumped into either hard size or pagedResults total count administrative limit"
1302 echo "ldapsearch failed ($RC)!"
1303 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1309 echo "Testing higher than total count limit requested for pagedResults total count limited ID..."
1310 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1311 -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1312 -z $SIZELIMIT -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1314 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1317 echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side unchecked limit (got $COUNT entries)"
1320 if test "x$COUNT" != "x" ; then
1321 if test "x$SIZELIMIT" = "x$COUNT" ; then
1322 echo "...bumped into requested ($SIZELIMIT) size limit"
1324 echo "...bumped into server-side size limit ($COUNT)"
1327 echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
1331 echo "...bumped into pagedResults total count administrative limit"
1334 echo "ldapsearch failed ($RC)!"
1335 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1341 echo "Testing max limit requested for pagedResults total count limited ID..."
1342 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1343 -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1344 -z $SIZELIMIT -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1346 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1349 echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side unchecked limit (got $COUNT entries)"
1352 if test "x$COUNT" != "x" ; then
1353 if test "x$SIZELIMIT" = "x$COUNT" ; then
1354 echo "...bumped into requested ($SIZELIMIT) size limit"
1356 echo "...bumped into server-side size limit ($COUNT)"
1359 echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
1363 echo "...bumped into pagedResults total count administrative limit"
1366 echo "ldapsearch failed ($RC)!"
1367 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1375 echo "Testing size limit request ($SIZELIMIT) for unlimited ID and pagesize=$PAGESIZE..."
1376 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
1377 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
1378 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1380 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1383 if test x"$COUNT" != x ; then
1384 if test "$COUNT" -gt "$SIZELIMIT" ; then
1385 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
1386 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1389 echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)"
1391 echo "...error: did not expect ldapsearch success ($RC)!"
1392 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1397 if test x"$COUNT" != x ; then
1398 if test $COUNT = $SIZELIMIT ; then
1399 echo "...bumped into requested size limit ($SIZELIMIT)"
1401 echo "...error: got $COUNT entries while requesting $SIZELIMIT..."
1402 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1406 echo "...error: bumped into server-side size limit, but got no entries!"
1407 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1412 echo "ldapsearch failed ($RC)!"
1413 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1418 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1420 echo ">>>>> Test succeeded"
1422 test $KILLSERVERS != no && wait