3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2017 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 if test $INDEXDB = indexdb ; then
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
752 if test $MAINDB != maindb ; then
753 # only bdb|hdb|mdb currently supports pagedResults control
754 test $KILLSERVERS != no && kill -HUP $KILLPIDS
756 echo ">>>>> Test succeeded"
760 if test x"$SLAPD_PAGE_SIZE" != x ; then
761 PAGESIZE="$SLAPD_PAGE_SIZE"
762 if test "$PAGESIZE" -le 0 ; then
763 test $KILLSERVERS != no && kill -HUP $KILLPIDS
766 echo "Testing with pagedResults control disabled"
768 echo ">>>>> Test succeeded"
776 echo "Testing regular search limits with pagedResults control (page size $PAGESIZE)"
779 echo "Testing no limits requested for unlimited ID..."
780 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
781 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
782 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' >$SEARCHOUT 2>&1
784 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
787 if test x"$COUNT" != x ; then
788 echo "...success (got $COUNT entries)"
790 echo "...error: did not expect ldapsearch success ($RC)!"
791 test $KILLSERVERS != no && kill -HUP $KILLPIDS
796 echo "ldapsearch failed ($RC)!"
797 test $KILLSERVERS != no && kill -HUP $KILLPIDS
803 echo "Testing size limit request ($SIZELIMIT) for unlimited ID..."
804 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
805 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
806 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
808 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
811 if test x"$COUNT" != x ; then
812 if test "$COUNT" -gt "$SIZELIMIT" ; then
813 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
814 test $KILLSERVERS != no && kill -HUP $KILLPIDS
817 echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)"
819 echo "...error: did not expect ldapsearch success ($RC)!"
820 test $KILLSERVERS != no && kill -HUP $KILLPIDS
825 if test x"$COUNT" != x ; then
826 if test $COUNT = $SIZELIMIT ; then
827 echo "...bumped into requested size limit ($SIZELIMIT)"
829 echo "...error: got $COUNT entries while requesting $SIZELIMIT..."
830 test $KILLSERVERS != no && kill -HUP $KILLPIDS
834 echo "...error: bumped into server-side size limit, but got no entries!"
835 test $KILLSERVERS != no && kill -HUP $KILLPIDS
840 echo "ldapsearch failed ($RC)!"
841 test $KILLSERVERS != no && kill -HUP $KILLPIDS
847 echo "Testing time limit request ($TIMELIMIT s) for unlimited ID..."
848 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -l $TIMELIMIT \
849 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
850 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
852 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
855 if test x"$COUNT" != x ; then
856 echo "...didn't bump into the requested time limit ($TIMELIMIT s; got $COUNT entries)"
858 echo "...error: did not expect ldapsearch success ($RC)!"
859 test $KILLSERVERS != no && kill -HUP $KILLPIDS
864 if test x"$COUNT" = x ; then
867 echo "...bumped into requested time limit ($TIMELIMIT s; got $COUNT entries)"
870 echo "ldapsearch failed ($RC)!"
871 test $KILLSERVERS != no && kill -HUP $KILLPIDS
876 echo "Testing no limits requested for soft limited ID..."
877 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
878 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
879 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
881 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
884 if test x"$COUNT" != x ; then
885 echo "...didn't bump into server-side size limit (got $COUNT entries)"
887 echo "...error: did not expect ldapsearch success ($RC)!"
888 test $KILLSERVERS != no && kill -HUP $KILLPIDS
893 if test x"$COUNT" != x ; then
894 echo "...bumped into server-side size limit (got $COUNT entries)"
896 echo "...error: bumped into server-side size limit, but got no entries!"
897 test $KILLSERVERS != no && kill -HUP $KILLPIDS
902 echo "ldapsearch failed ($RC)!"
903 test $KILLSERVERS != no && kill -HUP $KILLPIDS
909 echo "Testing lower than soft limit request ($SIZELIMIT) for soft limited ID..."
910 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
911 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
912 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
914 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
917 if test x"$COUNT" != x ; then
918 if test "$COUNT" -gt "$SIZELIMIT" ; then
919 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
920 test $KILLSERVERS != no && kill -HUP $KILLPIDS
923 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
925 echo "...error: did not expect ldapsearch success ($RC)!"
926 test $KILLSERVERS != no && kill -HUP $KILLPIDS
931 if test "x$COUNT" != "x" ; then
932 if test "x$SIZELIMIT" = "x$COUNT" ; then
933 echo "...bumped into requested ($SIZELIMIT) size limit"
935 echo "...bumped into server-side size limit ($COUNT)"
938 echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
942 echo "ldapsearch failed ($RC)!"
943 test $KILLSERVERS != no && kill -HUP $KILLPIDS
949 echo "Testing higher than soft limit request ($SIZELIMIT) for soft limited ID..."
950 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
951 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
952 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
954 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
957 if test x"$COUNT" != x ; then
958 if test "$COUNT" -gt "$SIZELIMIT" ; then
959 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
960 test $KILLSERVERS != no && kill -HUP $KILLPIDS
963 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
965 echo "...error: did not expect ldapsearch success ($RC)!"
966 test $KILLSERVERS != no && kill -HUP $KILLPIDS
971 if test "x$COUNT" != "x" ; then
972 if test "x$SIZELIMIT" = "x$COUNT" ; then
973 echo "...bumped into requested ($SIZELIMIT) size limit"
975 echo "...bumped into server-side size limit ($COUNT)"
978 echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
982 echo "ldapsearch failed ($RC)!"
983 test $KILLSERVERS != no && kill -HUP $KILLPIDS
989 echo "Testing lower than hard limit request ($SIZELIMIT) for hard limited ID..."
990 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
991 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
992 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
994 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
997 if test x"$COUNT" != x ; then
998 if test "$COUNT" -gt "$SIZELIMIT" ; then
999 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
1000 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1003 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
1005 echo "...error: did not expect ldapsearch success ($RC)!"
1006 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1011 if test x"$COUNT" != x ; then
1012 if test "$COUNT" = "$SIZELIMIT" ; then
1013 echo "...bumped into requested ($SIZELIMIT) size limit"
1015 echo "...error: got size limit $SIZELIMIT but $COUNT entries"
1016 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1020 echo "...error: bumped into server-side size limit, but got no entries!"
1021 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1026 echo "ldapsearch failed ($RC)!"
1027 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1033 echo "Testing higher than hard limit request ($SIZELIMIT) for hard limited ID..."
1034 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
1035 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
1036 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1038 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1041 if test x"$COUNT" != x ; then
1042 if test "$COUNT" -gt "$SIZELIMIT" ; then
1043 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
1044 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1047 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
1049 echo "...error: did not expect ldapsearch success ($RC)!"
1050 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1055 if test x"$COUNT" != x ; then
1056 if test "$COUNT" = "$SIZELIMIT" ; then
1057 echo "...error: bumped into requested ($SIZELIMIT) size limit"
1058 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1061 echo "...got size limit $COUNT instead of requested $SIZELIMIT entries"
1064 echo "...error: bumped into server-side size limit, but got no entries!"
1065 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1070 # echo "...bumped into hard size administrative limit"
1073 echo "ldapsearch failed ($RC)!"
1074 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1080 echo "Testing max limit request ($SIZELIMIT) for hard limited ID..."
1081 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
1082 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
1083 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1085 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1088 if test x"$COUNT" != x ; then
1089 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
1091 echo "...error: did not expect ldapsearch success ($RC)!"
1092 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1097 if test x"$COUNT" != x ; then
1098 echo "...bumped into requested ($SIZELIMIT=$COUNT) size limit"
1100 echo "...error: bumped into size limit but got no entries!"
1101 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1106 # echo "...bumped into hard size administrative limit"
1109 echo "ldapsearch failed ($RC)!"
1110 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1115 echo "Testing lower than unchecked limit request for unchecked limited ID..."
1116 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1117 -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \
1118 -E '!pr='$PAGESIZE'/noprompt' '(uid=uncheckedlimited)' > $SEARCHOUT 2>&1
1120 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1123 if test x"$COUNT" != x ; then
1124 echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
1126 echo "...error: did not expect ldapsearch success ($RC)!"
1127 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1132 # echo "...bumped into unchecked administrative limit"
1135 echo "ldapsearch failed ($RC)!"
1136 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1141 echo "Testing higher than unchecked limit requested for unchecked limited ID..."
1142 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1143 -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \
1144 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1146 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1149 if test x"$COUNT" != x ; then
1150 echo "...error: didn't bump into server-side unchecked limit (got $COUNT entries)"
1152 echo "...error: did not expect ldapsearch success ($RC)!"
1154 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1158 echo "...bumped into unchecked administrative limit"
1161 echo "ldapsearch failed ($RC)!"
1162 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1168 echo "Testing specific search limits with pagedResults control"
1171 echo "Testing no limit requested for unlimited page size ID..."
1172 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1173 -D 'cn=Unlimited User,ou=Paged Results Users,dc=example,dc=com' \
1174 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1176 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1179 if test x"$COUNT" != x ; then
1180 echo "...success; didn't bump into server-side size limit (got $COUNT entries)"
1182 echo "...error: did not expect ldapsearch success ($RC)!"
1183 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1188 if test x"$COUNT" != x ; then
1189 echo "...bumped into server-side size limit (got $COUNT entries)"
1191 echo "...error: bumped into server-side size limit, but got no entries!"
1192 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1197 echo "ldapsearch failed ($RC)!"
1198 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1203 echo "Testing no limit requested for limited page size ID..."
1204 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1205 -D 'cn=Page Size Limited User,ou=Paged Results Users,dc=example,dc=com' \
1206 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1208 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1211 echo "...success; didn't bump into server-side page size limit (got $COUNT entries)"
1214 echo "...bumped into page size limit ($COUNT)"
1217 echo "...bumped into page size administrative limit"
1220 echo "ldapsearch failed ($RC)!"
1221 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1226 echo "Testing no limit requested for pagedResults disabled ID..."
1227 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1228 -D 'cn=Paged Results Disabled User,ou=Paged Results Users,dc=example,dc=com' \
1229 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1231 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1234 echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
1237 echo "...bumped into server-side size limit ($COUNT)"
1240 echo "...bumped into pagedResults disabled administrative limit"
1243 echo "ldapsearch failed ($RC)!"
1244 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1249 echo "Testing no limit requested for pagedResults total count limited ID..."
1250 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1251 -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1252 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1254 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1257 echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
1260 echo "...bumped into server-side size limit ($COUNT)"
1263 echo "...bumped into pagedResults total count administrative limit"
1266 echo "ldapsearch failed ($RC)!"
1267 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1273 echo "Testing higher than hard but lower then total count limit requested for pagedResults total count limited ID..."
1274 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1275 -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1276 -z $SIZELIMIT -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1278 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1281 echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side unchecked limit (got $COUNT entries)"
1284 if test "x$COUNT" != "x" ; then
1285 if test "x$SIZELIMIT" = "x$COUNT" ; then
1286 echo "...bumped into requested ($SIZELIMIT) size limit"
1288 echo "...bumped into server-side size limit ($COUNT)"
1291 echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
1295 echo "...bumped into either hard size or pagedResults total count administrative limit"
1298 echo "ldapsearch failed ($RC)!"
1299 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1305 echo "Testing higher than total count limit requested for pagedResults total count limited ID..."
1306 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1307 -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1308 -z $SIZELIMIT -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1310 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1313 echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side unchecked limit (got $COUNT entries)"
1316 if test "x$COUNT" != "x" ; then
1317 if test "x$SIZELIMIT" = "x$COUNT" ; then
1318 echo "...bumped into requested ($SIZELIMIT) size limit"
1320 echo "...bumped into server-side size limit ($COUNT)"
1323 echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
1327 echo "...bumped into pagedResults total count administrative limit"
1330 echo "ldapsearch failed ($RC)!"
1331 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1337 echo "Testing max limit requested for pagedResults total count limited ID..."
1338 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1339 -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1340 -z $SIZELIMIT -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1342 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1345 echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side unchecked limit (got $COUNT entries)"
1348 if test "x$COUNT" != "x" ; then
1349 if test "x$SIZELIMIT" = "x$COUNT" ; then
1350 echo "...bumped into requested ($SIZELIMIT) size limit"
1352 echo "...bumped into server-side size limit ($COUNT)"
1355 echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
1359 echo "...bumped into pagedResults total count administrative limit"
1362 echo "ldapsearch failed ($RC)!"
1363 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1371 echo "Testing size limit request ($SIZELIMIT) for unlimited ID and pagesize=$PAGESIZE..."
1372 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
1373 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
1374 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1376 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1379 if test x"$COUNT" != x ; then
1380 if test "$COUNT" -gt "$SIZELIMIT" ; then
1381 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
1382 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1385 echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)"
1387 echo "...error: did not expect ldapsearch success ($RC)!"
1388 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1393 if test x"$COUNT" != x ; then
1394 if test $COUNT = $SIZELIMIT ; then
1395 echo "...bumped into requested size limit ($SIZELIMIT)"
1397 echo "...error: got $COUNT entries while requesting $SIZELIMIT..."
1398 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1402 echo "...error: bumped into server-side size limit, but got no entries!"
1403 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1408 echo "ldapsearch failed ($RC)!"
1409 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1414 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1416 echo ">>>>> Test succeeded"
1418 test $KILLSERVERS != no && wait