3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2005 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
50 echo "Testing slapd searching..."
51 for i in 0 1 2 3 4 5; do
52 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
53 '(objectclass=*)' > /dev/null 2>&1
55 if test $RC = 0 ; then
58 echo "Waiting 5 seconds for slapd to start..."
62 if test $RC != 0 ; then
63 echo "ldapsearch failed ($RC)!"
64 test $KILLSERVERS != no && kill -HUP $KILLPIDS
68 cat /dev/null > $SEARCHOUT
71 echo "Testing regular search limits"
74 echo "Testing no limits requested for unlimited ID..."
75 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
76 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
77 '(objectClass=*)' >$SEARCHOUT 2>&1
79 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
82 if test x"$COUNT" != x ; then
83 echo "...success (got $COUNT entries)"
85 echo "...error: did not expect ldapsearch success ($RC)!"
86 test $KILLSERVERS != no && kill -HUP $KILLPIDS
91 echo "ldapsearch failed ($RC)!"
92 test $KILLSERVERS != no && kill -HUP $KILLPIDS
97 echo "Testing no limits requested for rootdn=$MANAGERDN..."
98 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
100 '(objectClass=*)' >$SEARCHOUT 2>&1
102 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
105 if test x"$COUNT" != x ; then
106 echo "...success (got $COUNT entries)"
108 echo "...error: did not expect ldapsearch success ($RC)!"
109 test $KILLSERVERS != no && kill -HUP $KILLPIDS
114 echo "ldapsearch failed ($RC)!"
115 test $KILLSERVERS != no && kill -HUP $KILLPIDS
121 echo "Testing limit requested for rootdn=$MANAGERDN..."
122 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
124 '(objectClass=*)' >$SEARCHOUT 2>&1
126 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
129 if test x"$COUNT" != x ; then
130 if test "$COUNT" -gt "$SIZELIMIT" ; then
131 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
132 test $KILLSERVERS != no && kill -HUP $KILLPIDS
135 echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)"
137 echo "...error: did not expect ldapsearch success ($RC)!"
138 test $KILLSERVERS != no && kill -HUP $KILLPIDS
143 if test x"$COUNT" != x ; then
144 if test "$COUNT" = "$SIZELIMIT" ; then
145 echo "...bumped into requested size limit ($SIZELIMIT)"
147 echo "...error: got $COUNT entries with a requested sizelimit of $SIZELIMIT"
148 test $KILLSERVERS != no && kill -HUP $KILLPIDS
152 echo "...error: bumped into server-side size limit, but got no entries!"
153 test $KILLSERVERS != no && kill -HUP $KILLPIDS
158 echo "ldapsearch failed ($RC)!"
159 test $KILLSERVERS != no && kill -HUP $KILLPIDS
165 echo "Testing size limit request ($SIZELIMIT) for unlimited ID..."
166 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
167 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
168 '(objectClass=*)' > $SEARCHOUT 2>&1
170 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
173 if test x"$COUNT" != x ; then
174 if test "$COUNT" -gt "$SIZELIMIT" ; then
175 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
176 test $KILLSERVERS != no && kill -HUP $KILLPIDS
179 echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)"
181 echo "...error: did not expect ldapsearch success ($RC)!"
182 test $KILLSERVERS != no && kill -HUP $KILLPIDS
187 if test x"$COUNT" != x ; then
188 if test "$COUNT" = "$SIZELIMIT" ; then
189 echo "...bumped into requested size limit ($SIZELIMIT)"
191 echo "...error: got $COUNT entries with a requested sizelimit of $SIZELIMIT"
192 test $KILLSERVERS != no && kill -HUP $KILLPIDS
196 echo "...error: bumped into server-side size limit, but got no entries!"
197 test $KILLSERVERS != no && kill -HUP $KILLPIDS
202 echo "ldapsearch failed ($RC)!"
203 test $KILLSERVERS != no && kill -HUP $KILLPIDS
209 echo "Testing time limit request ($TIMELIMIT s) for unlimited ID..."
210 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -l $TIMELIMIT \
211 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
212 '(objectClass=*)' > $SEARCHOUT 2>&1
214 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
217 if test x"$COUNT" != x ; then
218 echo "...didn't bump into the requested time limit ($TIMELIMIT s; got $COUNT entries)"
220 echo "...error: did not expect ldapsearch success ($RC)!"
221 test $KILLSERVERS != no && kill -HUP $KILLPIDS
226 if test x"$COUNT" != x ; then
229 echo "...bumped into requested time limit ($TIMELIMIT s; got $COUNT entries)"
232 echo "ldapsearch failed ($RC)!"
233 test $KILLSERVERS != no && kill -HUP $KILLPIDS
238 echo "Testing no limits requested for soft limited ID..."
239 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
240 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
241 '(objectClass=*)' > $SEARCHOUT 2>&1
243 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
246 if test x"$COUNT" != x ; then
247 echo "...didn't bump into server-side size limit (got $COUNT entries)"
249 echo "...error: did not expect ldapsearch success ($RC)!"
250 test $KILLSERVERS != no && kill -HUP $KILLPIDS
255 if test x"$COUNT" != x ; then
256 echo "...bumped into server-side size limit (got $COUNT entries)"
258 echo "...error: bumped into server-side size limit, but got no entries!"
259 test $KILLSERVERS != no && kill -HUP $KILLPIDS
264 echo "ldapsearch failed ($RC)!"
265 test $KILLSERVERS != no && kill -HUP $KILLPIDS
271 echo "Testing lower than soft limit request ($SIZELIMIT) for soft limited ID..."
272 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
273 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
274 '(objectClass=*)' > $SEARCHOUT 2>&1
276 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
279 if test x"$COUNT" != x ; then
280 if test "$COUNT" -gt "$SIZELIMIT" ; then
281 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
282 test $KILLSERVERS != no && kill -HUP $KILLPIDS
285 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
287 echo "...error: did not expect ldapsearch success ($RC)!"
288 test $KILLSERVERS != no && kill -HUP $KILLPIDS
293 if test "x$COUNT" != "x" ; then
294 if test "x$SIZELIMIT" = "x$COUNT" ; then
295 echo "...bumped into requested ($SIZELIMIT) size limit"
297 echo "...bumped into server-side size limit ($COUNT)"
300 echo "...error: bumped into server-side size limit, but got no entries!"
301 test $KILLSERVERS != no && kill -HUP $KILLPIDS
306 echo "ldapsearch failed ($RC)!"
307 test $KILLSERVERS != no && kill -HUP $KILLPIDS
313 echo "Testing higher than soft limit request ($SIZELIMIT) for soft limited ID..."
314 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
315 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
316 '(objectClass=*)' > $SEARCHOUT 2>&1
318 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
321 if test x"$COUNT" != x ; then
322 if test "$COUNT" -gt "$SIZELIMIT" ; then
323 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
324 test $KILLSERVERS != no && kill -HUP $KILLPIDS
327 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
329 echo "...error: did not expect ldapsearch success ($RC)!"
330 test $KILLSERVERS != no && kill -HUP $KILLPIDS
335 if test "x$COUNT" != "x" ; then
336 if test "x$SIZELIMIT" = "x$COUNT" ; then
337 echo "...bumped into requested ($SIZELIMIT) size limit"
339 echo "...bumped into server-side size limit ($COUNT)"
342 echo "...error: bumped into server-side size limit, but got no entries!"
343 test $KILLSERVERS != no && kill -HUP $KILLPIDS
348 echo "ldapsearch failed ($RC)!"
349 test $KILLSERVERS != no && kill -HUP $KILLPIDS
355 echo "Testing lower than hard limit request ($SIZELIMIT) for hard limited ID..."
356 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
357 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
358 '(objectClass=*)' > $SEARCHOUT 2>&1
360 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
363 if test x"$COUNT" != x ; then
364 if test "$COUNT" -gt "$SIZELIMIT" ; then
365 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
366 test $KILLSERVERS != no && kill -HUP $KILLPIDS
369 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
371 echo "...error: did not expect ldapsearch success ($RC)!"
372 test $KILLSERVERS != no && kill -HUP $KILLPIDS
377 echo "...bumped into requested ($SIZELIMIT) size limit"
380 echo "ldapsearch failed ($RC)!"
381 test $KILLSERVERS != no && kill -HUP $KILLPIDS
387 echo "Testing higher than hard limit request ($SIZELIMIT) for hard limited ID..."
388 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
389 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
390 '(objectClass=*)' > $SEARCHOUT 2>&1
392 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
395 if test x"$COUNT" != x ; then
396 if test "$COUNT" -gt "$SIZELIMIT" ; then
397 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
398 test $KILLSERVERS != no && kill -HUP $KILLPIDS
401 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
403 echo "...error: did not expect ldapsearch success ($RC)!"
404 test $KILLSERVERS != no && kill -HUP $KILLPIDS
409 if test x"$COUNT" != x ; then
410 if test "$COUNT" = "$SIZELIMIT" ; then
411 echo "...error: bumped into requested ($SIZELIMIT) size limit"
412 test $KILLSERVERS != no && kill -HUP $KILLPIDS
415 echo "...got size limit $COUNT instead of requested $SIZELIMIT entries"
418 echo "...error: bumped into server-side size limit, but got no entries!"
419 test $KILLSERVERS != no && kill -HUP $KILLPIDS
424 # echo "...bumped into server-side hard size administrative limit"
427 echo "ldapsearch failed ($RC)!"
428 test $KILLSERVERS != no && kill -HUP $KILLPIDS
434 echo "Testing max limit request ($SIZELIMIT) for hard limited ID..."
435 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
436 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
437 '(objectClass=*)' > $SEARCHOUT 2>&1
439 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
442 if test x"$COUNT" != x ; then
443 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
445 echo "...error: did not expect ldapsearch success ($RC)!"
446 test $KILLSERVERS != no && kill -HUP $KILLPIDS
451 if test x"$COUNT" != x ; then
452 echo "...bumped into requested ($SIZELIMIT=$COUNT) size limit"
454 echo "...error: bumped into server-side size limit, but got no entries!"
455 test $KILLSERVERS != no && kill -HUP $KILLPIDS
460 # echo "...bumped into server-side hard size administrative limit"
463 echo "ldapsearch failed ($RC)!"
464 test $KILLSERVERS != no && kill -HUP $KILLPIDS
469 echo "Testing lower than unchecked limit request for unchecked limited ID..."
470 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
471 -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \
472 '(uid=uncheckedlimited)' > $SEARCHOUT 2>&1
474 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
477 if test x"$COUNT" != x ; then
478 echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
480 echo "...error: did not expect ldapsearch success ($RC)!"
481 test $KILLSERVERS != no && kill -HUP $KILLPIDS
486 echo "...error: bumped into unchecked administrative limit"
487 test $KILLSERVERS != no && kill -HUP $KILLPIDS
491 echo "ldapsearch failed ($RC)!"
492 test $KILLSERVERS != no && kill -HUP $KILLPIDS
497 echo "Testing higher than unchecked limit requested for unchecked limited ID..."
498 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
499 -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \
500 '(objectClass=*)' > $SEARCHOUT 2>&1
502 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
505 if test x"$COUNT" != x ; then
506 echo "...error: didn't bump into server-side unchecked limit (got $COUNT entries)"
508 echo "...error: did not expect ldapsearch success ($RC)!"
510 test $KILLSERVERS != no && kill -HUP $KILLPIDS
514 echo "...bumped into unchecked administrative limit"
517 echo "ldapsearch failed ($RC)!"
518 test $KILLSERVERS != no && kill -HUP $KILLPIDS
523 echo "Testing no limits requested for unchecked limited group..."
524 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
525 -D 'cn=Unchecked Limited User 2,ou=People,dc=example,dc=com' \
526 '(objectClass=*)' > $SEARCHOUT 2>&1
528 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
531 if test x"$COUNT" != x ; then
532 echo "...error: didn't bump into server-side unchecked limit (got $COUNT entries)"
534 echo "...error: did not expect ldapsearch success ($RC)!"
536 test $KILLSERVERS != no && kill -HUP $KILLPIDS
540 echo "...bumped into unchecked administrative limit"
543 echo "ldapsearch failed ($RC)!"
544 test $KILLSERVERS != no && kill -HUP $KILLPIDS
549 echo "Testing no limits requested for limited regex..."
550 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
551 -D 'cn=Foo User,ou=People,dc=example,dc=com' \
552 '(objectClass=*)' > $SEARCHOUT 2>&1
554 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
557 if test x"$COUNT" != x ; then
558 echo "...didn't bump into server-side size limit (got $COUNT entries)"
560 echo "...error: did not expect ldapsearch success ($RC)!"
561 test $KILLSERVERS != no && kill -HUP $KILLPIDS
566 if test "x$COUNT" != "x" ; then
567 echo "...bumped into server-side size limit ($COUNT)"
569 echo "...error: bumped into server-side size limit, but got no entries!"
570 test $KILLSERVERS != no && kill -HUP $KILLPIDS
575 echo "ldapsearch failed ($RC)!"
576 test $KILLSERVERS != no && kill -HUP $KILLPIDS
581 echo "Testing no limits requested for limited onelevel..."
582 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
583 -D 'cn=Bar User,ou=People,dc=example,dc=com' \
584 '(objectClass=*)' > $SEARCHOUT 2>&1
586 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
589 if test x"$COUNT" != x ; then
590 echo "...didn't bump into server-side size limit (got $COUNT entries)"
592 echo "...error: did not expect ldapsearch success ($RC)!"
593 test $KILLSERVERS != no && kill -HUP $KILLPIDS
598 if test "x$COUNT" != "x" ; then
599 echo "...bumped into server-side size limit ($COUNT)"
601 echo "...error: bumped into server-side size limit, but got no entries!"
602 test $KILLSERVERS != no && kill -HUP $KILLPIDS
607 echo "ldapsearch failed ($RC)!"
608 test $KILLSERVERS != no && kill -HUP $KILLPIDS
613 echo "Testing no limit requested for limited children..."
614 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
615 -D 'cn=Unchecked Limited Users,ou=Groups,dc=example,dc=com' \
616 '(objectClass=*)' > $SEARCHOUT 2>&1
618 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
621 if test x"$COUNT" != x ; then
622 echo "...didn't bump into server-side size limit (got $COUNT entries)"
624 echo "...error: did not expect ldapsearch success ($RC)!"
625 test $KILLSERVERS != no && kill -HUP $KILLPIDS
630 if test "x$COUNT" != "x" ; then
631 echo "...bumped into server-side size limit ($COUNT)"
633 echo "...error: bumped into server-side size limit, but got no entries!"
634 test $KILLSERVERS != no && kill -HUP $KILLPIDS
639 echo "ldapsearch failed ($RC)!"
640 test $KILLSERVERS != no && kill -HUP $KILLPIDS
645 echo "Testing no limit requested for limited subtree..."
646 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
647 -D 'cn=Unchecked Limited User 3,ou=Admin,dc=example,dc=com' \
648 '(objectClass=*)' > $SEARCHOUT 2>&1
650 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
653 if test x"$COUNT" != x ; then
654 echo "...didn't bump into server-side size limit (got $COUNT entries)"
656 echo "...error: did not expect ldapsearch success ($RC)!"
657 test $KILLSERVERS != no && kill -HUP $KILLPIDS
662 if test "x$COUNT" != "x" ; then
663 echo "...bumped into server-side size limit ($COUNT)"
665 echo "...error: bumped into server-side size limit, but got no entries!"
666 test $KILLSERVERS != no && kill -HUP $KILLPIDS
671 echo "ldapsearch failed ($RC)!"
672 test $KILLSERVERS != no && kill -HUP $KILLPIDS
677 echo "Testing no limit requested for limited users..."
678 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
679 -D 'cn=Special User,dc=example,dc=com' \
680 '(objectClass=*)' > $SEARCHOUT 2>&1
682 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
685 if test x"$COUNT" != x ; then
686 echo "...didn't bump into server-side size limit (got $COUNT entries)"
688 echo "...error: did not expect ldapsearch success ($RC)!"
689 test $KILLSERVERS != no && kill -HUP $KILLPIDS
694 if test "x$COUNT" != "x" ; then
695 echo "...bumped into server-side size limit ($COUNT)"
697 echo "...error: bumped into server-side size limit, but got no entries!"
698 test $KILLSERVERS != no && kill -HUP $KILLPIDS
703 echo "ldapsearch failed ($RC)!"
704 test $KILLSERVERS != no && kill -HUP $KILLPIDS
709 echo "Testing no limit requested for limited anonymous..."
710 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
711 '(objectClass=*)' > $SEARCHOUT 2>&1
713 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
716 if test x"$COUNT" != x ; then
717 echo "...didn't bump into server-side size limit (got $COUNT entries)"
719 echo "...error: did not expect ldapsearch success ($RC)!"
720 test $KILLSERVERS != no && kill -HUP $KILLPIDS
725 if test "x$COUNT" != "x" ; then
726 echo "...bumped into server-side size limit ($COUNT)"
728 echo "...error: bumped into server-side size limit, but got no entries!"
729 test $KILLSERVERS != no && kill -HUP $KILLPIDS
734 echo "ldapsearch failed ($RC)!"
735 test $KILLSERVERS != no && kill -HUP $KILLPIDS
742 # only bdb|hdb currently supports pagedResults control
745 test $KILLSERVERS != no && kill -HUP $KILLPIDS
747 echo ">>>>> Test succeeded"
752 if test x"$SLAPD_PAGE_SIZE" != x ; then
753 PAGESIZE="$SLAPD_PAGE_SIZE"
754 if test "$PAGESIZE" -le 0 ; then
755 test $KILLSERVERS != no && kill -HUP $KILLPIDS
758 echo "Testing with pagedResults control disabled"
760 echo ">>>>> Test succeeded"
768 echo "Testing regular search limits with pagedResults control (page size $PAGESIZE)"
771 echo "Testing no limits requested for unlimited ID..."
772 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
773 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
774 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' >$SEARCHOUT 2>&1
776 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
779 if test x"$COUNT" != x ; then
780 echo "...success (got $COUNT entries)"
782 echo "...error: did not expect ldapsearch success ($RC)!"
783 test $KILLSERVERS != no && kill -HUP $KILLPIDS
788 echo "ldapsearch failed ($RC)!"
789 test $KILLSERVERS != no && kill -HUP $KILLPIDS
795 echo "Testing size limit request ($SIZELIMIT) for unlimited ID..."
796 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
797 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
798 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
800 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
803 if test x"$COUNT" != x ; then
804 if test "$COUNT" -gt "$SIZELIMIT" ; then
805 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
806 test $KILLSERVERS != no && kill -HUP $KILLPIDS
809 echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)"
811 echo "...error: did not expect ldapsearch success ($RC)!"
812 test $KILLSERVERS != no && kill -HUP $KILLPIDS
817 if test x"$COUNT" != x ; then
818 if test $COUNT = $SIZELIMIT ; then
819 echo "...bumped into requested size limit ($SIZELIMIT)"
821 echo "...error: got $COUNT entries while requesting $SIZELIMIT..."
822 test $KILLSERVERS != no && kill -HUP $KILLPIDS
826 echo "...error: bumped into server-side size limit, but got no entries!"
827 test $KILLSERVERS != no && kill -HUP $KILLPIDS
832 echo "ldapsearch failed ($RC)!"
833 test $KILLSERVERS != no && kill -HUP $KILLPIDS
839 echo "Testing time limit request ($TIMELIMIT s) for unlimited ID..."
840 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -l $TIMELIMIT \
841 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
842 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
844 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
847 if test x"$COUNT" != x ; then
848 echo "...didn't bump into the requested time limit ($TIMELIMIT s; got $COUNT entries)"
850 echo "...error: did not expect ldapsearch success ($RC)!"
851 test $KILLSERVERS != no && kill -HUP $KILLPIDS
856 if test x"$COUNT" = x ; then
859 echo "...bumped into requested time limit ($TIMELIMIT s; got $COUNT entries)"
862 echo "ldapsearch failed ($RC)!"
863 test $KILLSERVERS != no && kill -HUP $KILLPIDS
868 echo "Testing no limits requested for soft limited ID..."
869 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
870 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
871 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
873 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
876 if test x"$COUNT" != x ; then
877 echo "...didn't bump into server-side size limit (got $COUNT entries)"
879 echo "...error: did not expect ldapsearch success ($RC)!"
880 test $KILLSERVERS != no && kill -HUP $KILLPIDS
885 if test x"$COUNT" != x ; then
886 echo "...bumped into server-side size limit (got $COUNT entries)"
888 echo "...error: bumped into server-side size limit, but got no entries!"
889 test $KILLSERVERS != no && kill -HUP $KILLPIDS
894 echo "ldapsearch failed ($RC)!"
895 test $KILLSERVERS != no && kill -HUP $KILLPIDS
901 echo "Testing lower than soft limit request ($SIZELIMIT) for soft limited ID..."
902 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
903 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
904 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
906 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
909 if test x"$COUNT" != x ; then
910 if test "$COUNT" -gt "$SIZELIMIT" ; then
911 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
912 test $KILLSERVERS != no && kill -HUP $KILLPIDS
915 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
917 echo "...error: did not expect ldapsearch success ($RC)!"
918 test $KILLSERVERS != no && kill -HUP $KILLPIDS
923 if test "x$COUNT" != "x" ; then
924 if test "x$SIZELIMIT" = "x$COUNT" ; then
925 echo "...bumped into requested ($SIZELIMIT) size limit"
927 echo "...bumped into server-side size limit ($COUNT)"
930 echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
934 echo "ldapsearch failed ($RC)!"
935 test $KILLSERVERS != no && kill -HUP $KILLPIDS
941 echo "Testing higher than soft limit request ($SIZELIMIT) for soft limited ID..."
942 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
943 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
944 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
946 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
949 if test x"$COUNT" != x ; then
950 if test "$COUNT" -gt "$SIZELIMIT" ; then
951 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
952 test $KILLSERVERS != no && kill -HUP $KILLPIDS
955 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
957 echo "...error: did not expect ldapsearch success ($RC)!"
958 test $KILLSERVERS != no && kill -HUP $KILLPIDS
963 if test "x$COUNT" != "x" ; then
964 if test "x$SIZELIMIT" = "x$COUNT" ; then
965 echo "...bumped into requested ($SIZELIMIT) size limit"
967 echo "...bumped into server-side size limit ($COUNT)"
970 echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
974 echo "ldapsearch failed ($RC)!"
975 test $KILLSERVERS != no && kill -HUP $KILLPIDS
981 echo "Testing lower than hard limit request ($SIZELIMIT) for hard limited ID..."
982 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
983 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
984 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
986 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
989 if test x"$COUNT" != x ; then
990 if test "$COUNT" -gt "$SIZELIMIT" ; then
991 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
992 test $KILLSERVERS != no && kill -HUP $KILLPIDS
995 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
997 echo "...error: did not expect ldapsearch success ($RC)!"
998 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1003 if test x"$COUNT" != x ; then
1004 if test "$COUNT" = "$SIZELIMIT" ; then
1005 echo "...bumped into requested ($SIZELIMIT) size limit"
1007 echo "...error: got size limit $SIZELIMIT but $COUNT entries"
1008 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1012 echo "...error: bumped into server-side size limit, but got no entries!"
1013 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1018 echo "ldapsearch failed ($RC)!"
1019 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1025 echo "Testing higher than hard limit request ($SIZELIMIT) for hard limited ID..."
1026 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
1027 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
1028 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1030 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1033 if test x"$COUNT" != x ; then
1034 if test "$COUNT" -gt "$SIZELIMIT" ; then
1035 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
1036 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1039 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
1041 echo "...error: did not expect ldapsearch success ($RC)!"
1042 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1047 if test x"$COUNT" != x ; then
1048 if test "$COUNT" = "$SIZELIMIT" ; then
1049 echo "...error: bumped into requested ($SIZELIMIT) size limit"
1050 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1053 echo "...got size limit $COUNT instead of requested $SIZELIMIT entries"
1056 echo "...error: bumped into server-side size limit, but got no entries!"
1057 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1062 # echo "...bumped into hard size administrative limit"
1065 echo "ldapsearch failed ($RC)!"
1066 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1072 echo "Testing max limit request ($SIZELIMIT) for hard limited ID..."
1073 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
1074 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
1075 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1077 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1080 if test x"$COUNT" != x ; then
1081 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
1083 echo "...error: did not expect ldapsearch success ($RC)!"
1084 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1089 if test x"$COUNT" != x ; then
1090 echo "...bumped into requested ($SIZELIMIT=$COUNT) size limit"
1092 echo "...error: bumped into size limit but got no entries!"
1093 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1098 # echo "...bumped into hard size administrative limit"
1101 echo "ldapsearch failed ($RC)!"
1102 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1107 echo "Testing lower than unchecked limit request for unchecked limited ID..."
1108 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1109 -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \
1110 -E '!pr='$PAGESIZE'/noprompt' '(uid=uncheckedlimited)' > $SEARCHOUT 2>&1
1112 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1115 if test x"$COUNT" != x ; then
1116 echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
1118 echo "...error: did not expect ldapsearch success ($RC)!"
1119 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1124 # echo "...bumped into unchecked administrative limit"
1127 echo "ldapsearch failed ($RC)!"
1128 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1133 echo "Testing higher than unchecked limit requested for unchecked limited ID..."
1134 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1135 -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \
1136 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1138 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1141 if test x"$COUNT" != x ; then
1142 echo "...error: didn't bump into server-side unchecked limit (got $COUNT entries)"
1144 echo "...error: did not expect ldapsearch success ($RC)!"
1146 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1150 echo "...bumped into unchecked administrative limit"
1153 echo "ldapsearch failed ($RC)!"
1154 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1160 echo "Testing specific search limits with pagedResults control"
1163 echo "Testing no limit requested for unlimited page size ID..."
1164 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1165 -D 'cn=Unlimited User,ou=Paged Results Users,dc=example,dc=com' \
1166 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1168 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1171 if test x"$COUNT" != x ; then
1172 echo "...success; didn't bump into server-side size limit (got $COUNT entries)"
1174 echo "...error: did not expect ldapsearch success ($RC)!"
1175 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1180 if test x"$COUNT" != x ; then
1181 echo "...bumped into server-side size limit (got $COUNT entries)"
1183 echo "...error: bumped into server-side size limit, but got no entries!"
1184 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1189 echo "ldapsearch failed ($RC)!"
1190 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1195 echo "Testing no limit requested for limited page size ID..."
1196 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1197 -D 'cn=Page Size Limited User,ou=Paged Results Users,dc=example,dc=com' \
1198 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1200 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1203 echo "...success; didn't bump into server-side page size limit (got $COUNT entries)"
1206 echo "...bumped into page size limit ($COUNT)"
1209 echo "...bumped into page size administrative limit"
1212 echo "ldapsearch failed ($RC)!"
1213 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1218 echo "Testing no limit requested for pagedResults disabled ID..."
1219 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1220 -D 'cn=Paged Results Disabled User,ou=Paged Results Users,dc=example,dc=com' \
1221 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1223 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1226 echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
1229 echo "...bumped into server-side size limit ($COUNT)"
1232 echo "...bumped into pagedResults disabled administrative limit"
1235 echo "ldapsearch failed ($RC)!"
1236 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1241 echo "Testing no limit requested for pagedResults total count limited ID..."
1242 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1243 -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1244 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1246 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1249 echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
1252 echo "...bumped into server-side size limit ($COUNT)"
1255 echo "...bumped into pagedResults total count administrative limit"
1258 echo "ldapsearch failed ($RC)!"
1259 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1265 echo "Testing higher than hard but lower then total count limit requested for pagedResults total count limited ID..."
1266 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1267 -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1268 -z $SIZELIMIT -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1270 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1273 echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side unchecked limit (got $COUNT entries)"
1276 if test "x$COUNT" != "x" ; then
1277 if test "x$SIZELIMIT" = "x$COUNT" ; then
1278 echo "...bumped into requested ($SIZELIMIT) size limit"
1280 echo "...bumped into server-side size limit ($COUNT)"
1283 echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
1287 echo "...bumped into either hard size or pagedResults total count administrative limit"
1290 echo "ldapsearch failed ($RC)!"
1291 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1297 echo "Testing higher than total count limit requested for pagedResults total count limited ID..."
1298 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1299 -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1300 -z $SIZELIMIT -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1302 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1305 echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side unchecked limit (got $COUNT entries)"
1308 if test "x$COUNT" != "x" ; then
1309 if test "x$SIZELIMIT" = "x$COUNT" ; then
1310 echo "...bumped into requested ($SIZELIMIT) size limit"
1312 echo "...bumped into server-side size limit ($COUNT)"
1315 echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
1319 echo "...bumped into pagedResults total count administrative limit"
1322 echo "ldapsearch failed ($RC)!"
1323 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1329 echo "Testing max limit requested for pagedResults total count limited ID..."
1330 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1331 -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1332 -z $SIZELIMIT -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1334 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1337 echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side unchecked limit (got $COUNT entries)"
1340 if test "x$COUNT" != "x" ; then
1341 if test "x$SIZELIMIT" = "x$COUNT" ; then
1342 echo "...bumped into requested ($SIZELIMIT) size limit"
1344 echo "...bumped into server-side size limit ($COUNT)"
1347 echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
1351 echo "...bumped into pagedResults total count administrative limit"
1354 echo "ldapsearch failed ($RC)!"
1355 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1360 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1362 echo ">>>>> Test succeeded"