Sync usage with man page.
[netbsd-mini2440.git] / external / bsd / openldap / dist / tests / scripts / test025-limits
blobd171ea54d4e51bf2817a7f41697c41c8278beb22
1 #! /bin/sh
2 # $OpenLDAP: pkg/ldap/tests/scripts/test025-limits,v 1.19.2.5 2008/02/11 23:26:51 kurt Exp $
3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 ##
5 ## Copyright 1998-2008 The OpenLDAP Foundation.
6 ## All rights reserved.
7 ##
8 ## Redistribution and use in source and binary forms, with or without
9 ## modification, are permitted only as authorized by the OpenLDAP
10 ## Public License.
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
26 RC=$?
27 if test $RC != 0 ; then
28 echo "slapadd failed ($RC)!"
29 exit $RC
32 echo "Running slapindex to index slapd database..."
33 . $CONFFILTER $BACKEND $MONITORDB < $LIMITSCONF > $CONF1
34 $SLAPINDEX -f $CONF1
35 RC=$?
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 &
43 PID=$!
44 if test $WAIT != 0 ; then
45 echo PID $PID
46 read foo
48 KILLPIDS="$PID"
50 sleep 1
52 echo "Testing slapd searching..."
53 for i in 0 1 2 3 4 5; do
54 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
55 '(objectclass=*)' > /dev/null 2>&1
56 RC=$?
57 if test $RC = 0 ; then
58 break
60 echo "Waiting 5 seconds for slapd to start..."
61 sleep 5
62 done
64 if test $RC != 0 ; then
65 echo "ldapsearch failed ($RC)!"
66 test $KILLSERVERS != no && kill -HUP $KILLPIDS
67 exit $RC
70 cat /dev/null > $SEARCHOUT
72 echo ""
73 echo "Testing regular search limits"
74 echo ""
76 echo "Testing no limits requested for unlimited ID..."
77 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
78 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
79 '(objectClass=*)' >$SEARCHOUT 2>&1
80 RC=$?
81 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
82 case $RC in
84 if test x"$COUNT" != x ; then
85 echo "...success (got $COUNT entries)"
86 else
87 echo "...error: did not expect ldapsearch success ($RC)!"
88 test $KILLSERVERS != no && kill -HUP $KILLPIDS
89 exit 1
93 echo "ldapsearch failed ($RC)!"
94 test $KILLSERVERS != no && kill -HUP $KILLPIDS
95 exit $RC
97 esac
99 echo "Testing no limits requested for rootdn=$MANAGERDN..."
100 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
101 -D "$MANAGERDN" \
102 '(objectClass=*)' >$SEARCHOUT 2>&1
103 RC=$?
104 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
105 case $RC in
107 if test x"$COUNT" != x ; then
108 echo "...success (got $COUNT entries)"
109 else
110 echo "...error: did not expect ldapsearch success ($RC)!"
111 test $KILLSERVERS != no && kill -HUP $KILLPIDS
112 exit 1
116 echo "ldapsearch failed ($RC)!"
117 test $KILLSERVERS != no && kill -HUP $KILLPIDS
118 exit $RC
120 esac
122 SIZELIMIT=4
123 echo "Testing limit requested for rootdn=$MANAGERDN..."
124 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
125 -D "$MANAGERDN" \
126 '(objectClass=*)' >$SEARCHOUT 2>&1
127 RC=$?
128 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
129 case $RC in
131 if test x"$COUNT" != x ; then
132 if test "$COUNT" -gt "$SIZELIMIT" ; then
133 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
134 test $KILLSERVERS != no && kill -HUP $KILLPIDS
135 exit 1
137 echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)"
138 else
139 echo "...error: did not expect ldapsearch success ($RC)!"
140 test $KILLSERVERS != no && kill -HUP $KILLPIDS
141 exit 1
145 if test x"$COUNT" != x ; then
146 if test "$COUNT" = "$SIZELIMIT" ; then
147 echo "...bumped into requested size limit ($SIZELIMIT)"
148 else
149 echo "...error: got $COUNT entries with a requested sizelimit of $SIZELIMIT"
150 test $KILLSERVERS != no && kill -HUP $KILLPIDS
151 exit $RC
153 else
154 echo "...error: bumped into server-side size limit, but got no entries!"
155 test $KILLSERVERS != no && kill -HUP $KILLPIDS
156 exit $RC
160 echo "ldapsearch failed ($RC)!"
161 test $KILLSERVERS != no && kill -HUP $KILLPIDS
162 exit $RC
164 esac
166 SIZELIMIT=2
167 echo "Testing size limit request ($SIZELIMIT) for unlimited ID..."
168 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
169 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
170 '(objectClass=*)' > $SEARCHOUT 2>&1
171 RC=$?
172 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
173 case $RC in
175 if test x"$COUNT" != x ; then
176 if test "$COUNT" -gt "$SIZELIMIT" ; then
177 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
178 test $KILLSERVERS != no && kill -HUP $KILLPIDS
179 exit 1
181 echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)"
182 else
183 echo "...error: did not expect ldapsearch success ($RC)!"
184 test $KILLSERVERS != no && kill -HUP $KILLPIDS
185 exit 1
189 if test x"$COUNT" != x ; then
190 if test "$COUNT" = "$SIZELIMIT" ; then
191 echo "...bumped into requested size limit ($SIZELIMIT)"
192 else
193 echo "...error: got $COUNT entries with a requested sizelimit of $SIZELIMIT"
194 test $KILLSERVERS != no && kill -HUP $KILLPIDS
195 exit $RC
197 else
198 echo "...error: bumped into server-side size limit, but got no entries!"
199 test $KILLSERVERS != no && kill -HUP $KILLPIDS
200 exit $RC
204 echo "ldapsearch failed ($RC)!"
205 test $KILLSERVERS != no && kill -HUP $KILLPIDS
206 exit $RC
208 esac
210 TIMELIMIT=10
211 echo "Testing time limit request ($TIMELIMIT s) for unlimited ID..."
212 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -l $TIMELIMIT \
213 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
214 '(objectClass=*)' > $SEARCHOUT 2>&1
215 RC=$?
216 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
217 case $RC in
219 if test x"$COUNT" != x ; then
220 echo "...didn't bump into the requested time limit ($TIMELIMIT s; got $COUNT entries)"
221 else
222 echo "...error: did not expect ldapsearch success ($RC)!"
223 test $KILLSERVERS != no && kill -HUP $KILLPIDS
224 exit 1
228 if test x"$COUNT" != x ; then
229 COUNT=0
231 echo "...bumped into requested time limit ($TIMELIMIT s; got $COUNT entries)"
234 echo "ldapsearch failed ($RC)!"
235 test $KILLSERVERS != no && kill -HUP $KILLPIDS
236 exit $RC
238 esac
240 echo "Testing no limits requested for soft limited ID..."
241 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
242 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
243 '(objectClass=*)' > $SEARCHOUT 2>&1
244 RC=$?
245 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
246 case $RC in
248 if test x"$COUNT" != x ; then
249 echo "...didn't bump into server-side size limit (got $COUNT entries)"
250 else
251 echo "...error: did not expect ldapsearch success ($RC)!"
252 test $KILLSERVERS != no && kill -HUP $KILLPIDS
253 exit 1
257 if test x"$COUNT" != x ; then
258 echo "...bumped into server-side size limit (got $COUNT entries)"
259 else
260 echo "...error: bumped into server-side size limit, but got no entries!"
261 test $KILLSERVERS != no && kill -HUP $KILLPIDS
262 exit $RC
266 echo "ldapsearch failed ($RC)!"
267 test $KILLSERVERS != no && kill -HUP $KILLPIDS
268 exit $RC
270 esac
272 SIZELIMIT=2
273 echo "Testing lower than soft limit request ($SIZELIMIT) for soft limited ID..."
274 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
275 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
276 '(objectClass=*)' > $SEARCHOUT 2>&1
277 RC=$?
278 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
279 case $RC in
281 if test x"$COUNT" != x ; then
282 if test "$COUNT" -gt "$SIZELIMIT" ; then
283 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
284 test $KILLSERVERS != no && kill -HUP $KILLPIDS
285 exit 1
287 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
288 else
289 echo "...error: did not expect ldapsearch success ($RC)!"
290 test $KILLSERVERS != no && kill -HUP $KILLPIDS
291 exit 1
295 if test "x$COUNT" != "x" ; then
296 if test "x$SIZELIMIT" = "x$COUNT" ; then
297 echo "...bumped into requested ($SIZELIMIT) size limit"
298 else
299 echo "...bumped into server-side size limit ($COUNT)"
301 else
302 echo "...error: bumped into server-side size limit, but got no entries!"
303 test $KILLSERVERS != no && kill -HUP $KILLPIDS
304 exit $RC
308 echo "ldapsearch failed ($RC)!"
309 test $KILLSERVERS != no && kill -HUP $KILLPIDS
310 exit $RC
312 esac
314 SIZELIMIT=100
315 echo "Testing higher than soft limit request ($SIZELIMIT) for soft limited ID..."
316 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
317 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
318 '(objectClass=*)' > $SEARCHOUT 2>&1
319 RC=$?
320 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
321 case $RC in
323 if test x"$COUNT" != x ; then
324 if test "$COUNT" -gt "$SIZELIMIT" ; then
325 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
326 test $KILLSERVERS != no && kill -HUP $KILLPIDS
327 exit 1
329 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
330 else
331 echo "...error: did not expect ldapsearch success ($RC)!"
332 test $KILLSERVERS != no && kill -HUP $KILLPIDS
333 exit 1
337 if test "x$COUNT" != "x" ; then
338 if test "x$SIZELIMIT" = "x$COUNT" ; then
339 echo "...bumped into requested ($SIZELIMIT) size limit"
340 else
341 echo "...bumped into server-side size limit ($COUNT)"
343 else
344 echo "...error: bumped into server-side size limit, but got no entries!"
345 test $KILLSERVERS != no && kill -HUP $KILLPIDS
346 exit $RC
350 echo "ldapsearch failed ($RC)!"
351 test $KILLSERVERS != no && kill -HUP $KILLPIDS
352 exit $RC
354 esac
356 SIZELIMIT=2
357 echo "Testing lower than hard limit request ($SIZELIMIT) for hard limited ID..."
358 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
359 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
360 '(objectClass=*)' > $SEARCHOUT 2>&1
361 RC=$?
362 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
363 case $RC in
365 if test x"$COUNT" != x ; then
366 if test "$COUNT" -gt "$SIZELIMIT" ; then
367 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
368 test $KILLSERVERS != no && kill -HUP $KILLPIDS
369 exit 1
371 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
372 else
373 echo "...error: did not expect ldapsearch success ($RC)!"
374 test $KILLSERVERS != no && kill -HUP $KILLPIDS
375 exit 1
379 echo "...bumped into requested ($SIZELIMIT) size limit"
382 echo "ldapsearch failed ($RC)!"
383 test $KILLSERVERS != no && kill -HUP $KILLPIDS
384 exit $RC
386 esac
388 SIZELIMIT=100
389 echo "Testing higher than hard limit request ($SIZELIMIT) for hard limited ID..."
390 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
391 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
392 '(objectClass=*)' > $SEARCHOUT 2>&1
393 RC=$?
394 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
395 case $RC in
397 if test x"$COUNT" != x ; then
398 if test "$COUNT" -gt "$SIZELIMIT" ; then
399 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
400 test $KILLSERVERS != no && kill -HUP $KILLPIDS
401 exit 1
403 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
404 else
405 echo "...error: did not expect ldapsearch success ($RC)!"
406 test $KILLSERVERS != no && kill -HUP $KILLPIDS
407 exit 1
411 if test x"$COUNT" != x ; then
412 if test "$COUNT" = "$SIZELIMIT" ; then
413 echo "...error: bumped into requested ($SIZELIMIT) size limit"
414 test $KILLSERVERS != no && kill -HUP $KILLPIDS
415 exit $RC
416 else
417 echo "...got size limit $COUNT instead of requested $SIZELIMIT entries"
419 else
420 echo "...error: bumped into server-side size limit, but got no entries!"
421 test $KILLSERVERS != no && kill -HUP $KILLPIDS
422 exit $RC
425 # 11)
426 # echo "...bumped into server-side hard size administrative limit"
427 # ;;
429 echo "ldapsearch failed ($RC)!"
430 test $KILLSERVERS != no && kill -HUP $KILLPIDS
431 exit $RC
433 esac
435 SIZELIMIT=max
436 echo "Testing max limit request ($SIZELIMIT) for hard limited ID..."
437 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
438 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
439 '(objectClass=*)' > $SEARCHOUT 2>&1
440 RC=$?
441 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
442 case $RC in
444 if test x"$COUNT" != x ; then
445 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
446 else
447 echo "...error: did not expect ldapsearch success ($RC)!"
448 test $KILLSERVERS != no && kill -HUP $KILLPIDS
449 exit 1
453 if test x"$COUNT" != x ; then
454 echo "...bumped into requested ($SIZELIMIT=$COUNT) size limit"
455 else
456 echo "...error: bumped into server-side size limit, but got no entries!"
457 test $KILLSERVERS != no && kill -HUP $KILLPIDS
458 exit $RC
461 # 11)
462 # echo "...bumped into server-side hard size administrative limit"
463 # ;;
465 echo "ldapsearch failed ($RC)!"
466 test $KILLSERVERS != no && kill -HUP $KILLPIDS
467 exit $RC
469 esac
471 echo "Testing lower than unchecked limit request for unchecked limited ID..."
472 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
473 -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \
474 '(uid=uncheckedlimited)' > $SEARCHOUT 2>&1
475 RC=$?
476 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
477 case $RC in
479 if test x"$COUNT" != x ; then
480 echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
481 else
482 echo "...error: did not expect ldapsearch success ($RC)!"
483 test $KILLSERVERS != no && kill -HUP $KILLPIDS
484 exit 1
488 echo "...error: bumped into unchecked administrative limit"
489 test $KILLSERVERS != no && kill -HUP $KILLPIDS
490 exit $RC
493 echo "ldapsearch failed ($RC)!"
494 test $KILLSERVERS != no && kill -HUP $KILLPIDS
495 exit $RC
497 esac
499 case $BACKEND in bdb | hdb)
501 echo "Testing higher than unchecked limit requested for unchecked limited ID..."
502 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
503 -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \
504 '(objectClass=*)' > $SEARCHOUT 2>&1
505 RC=$?
506 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
507 case $RC in
509 if test x"$COUNT" != x ; then
510 echo "...error: didn't bump into server-side unchecked limit (got $COUNT entries)"
511 else
512 echo "...error: did not expect ldapsearch success ($RC)!"
514 test $KILLSERVERS != no && kill -HUP $KILLPIDS
515 exit 1
518 echo "...bumped into unchecked administrative limit"
521 echo "ldapsearch failed ($RC)!"
522 test $KILLSERVERS != no && kill -HUP $KILLPIDS
523 exit $RC
525 esac
527 echo "Testing no limits requested for unchecked limited group..."
528 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
529 -D 'cn=Unchecked Limited User 2,ou=People,dc=example,dc=com' \
530 '(objectClass=*)' > $SEARCHOUT 2>&1
531 RC=$?
532 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
533 case $RC in
535 if test x"$COUNT" != x ; then
536 echo "...error: didn't bump into server-side unchecked limit (got $COUNT entries)"
537 else
538 echo "...error: did not expect ldapsearch success ($RC)!"
540 test $KILLSERVERS != no && kill -HUP $KILLPIDS
541 exit 1
544 echo "...bumped into unchecked administrative limit"
547 echo "ldapsearch failed ($RC)!"
548 test $KILLSERVERS != no && kill -HUP $KILLPIDS
549 exit $RC
551 esac
553 *) echo "Skipping test for unchecked limit with $BACKEND backend." ;;
554 esac
556 echo "Testing no limits requested for limited regex..."
557 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
558 -D 'cn=Foo User,ou=People,dc=example,dc=com' \
559 '(objectClass=*)' > $SEARCHOUT 2>&1
560 RC=$?
561 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
562 case $RC in
564 if test x"$COUNT" != x ; then
565 echo "...didn't bump into server-side size limit (got $COUNT entries)"
566 else
567 echo "...error: did not expect ldapsearch success ($RC)!"
568 test $KILLSERVERS != no && kill -HUP $KILLPIDS
569 exit 1
573 if test "x$COUNT" != "x" ; then
574 echo "...bumped into server-side size limit ($COUNT)"
575 else
576 echo "...error: bumped into server-side size limit, but got no entries!"
577 test $KILLSERVERS != no && kill -HUP $KILLPIDS
578 exit $RC
582 echo "ldapsearch failed ($RC)!"
583 test $KILLSERVERS != no && kill -HUP $KILLPIDS
584 exit $RC
586 esac
588 echo "Testing no limits requested for limited onelevel..."
589 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
590 -D 'cn=Bar User,ou=People,dc=example,dc=com' \
591 '(objectClass=*)' > $SEARCHOUT 2>&1
592 RC=$?
593 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
594 case $RC in
596 if test x"$COUNT" != x ; then
597 echo "...didn't bump into server-side size limit (got $COUNT entries)"
598 else
599 echo "...error: did not expect ldapsearch success ($RC)!"
600 test $KILLSERVERS != no && kill -HUP $KILLPIDS
601 exit 1
605 if test "x$COUNT" != "x" ; then
606 echo "...bumped into server-side size limit ($COUNT)"
607 else
608 echo "...error: bumped into server-side size limit, but got no entries!"
609 test $KILLSERVERS != no && kill -HUP $KILLPIDS
610 exit $RC
614 echo "ldapsearch failed ($RC)!"
615 test $KILLSERVERS != no && kill -HUP $KILLPIDS
616 exit $RC
618 esac
620 echo "Testing no limit requested for limited children..."
621 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
622 -D 'cn=Unchecked Limited Users,ou=Groups,dc=example,dc=com' \
623 '(objectClass=*)' > $SEARCHOUT 2>&1
624 RC=$?
625 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
626 case $RC in
628 if test x"$COUNT" != x ; then
629 echo "...didn't bump into server-side size limit (got $COUNT entries)"
630 else
631 echo "...error: did not expect ldapsearch success ($RC)!"
632 test $KILLSERVERS != no && kill -HUP $KILLPIDS
633 exit 1
637 if test "x$COUNT" != "x" ; then
638 echo "...bumped into server-side size limit ($COUNT)"
639 else
640 echo "...error: bumped into server-side size limit, but got no entries!"
641 test $KILLSERVERS != no && kill -HUP $KILLPIDS
642 exit $RC
646 echo "ldapsearch failed ($RC)!"
647 test $KILLSERVERS != no && kill -HUP $KILLPIDS
648 exit $RC
650 esac
652 echo "Testing no limit requested for limited subtree..."
653 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
654 -D 'cn=Unchecked Limited User 3,ou=Admin,dc=example,dc=com' \
655 '(objectClass=*)' > $SEARCHOUT 2>&1
656 RC=$?
657 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
658 case $RC in
660 if test x"$COUNT" != x ; then
661 echo "...didn't bump into server-side size limit (got $COUNT entries)"
662 else
663 echo "...error: did not expect ldapsearch success ($RC)!"
664 test $KILLSERVERS != no && kill -HUP $KILLPIDS
665 exit 1
669 if test "x$COUNT" != "x" ; then
670 echo "...bumped into server-side size limit ($COUNT)"
671 else
672 echo "...error: bumped into server-side size limit, but got no entries!"
673 test $KILLSERVERS != no && kill -HUP $KILLPIDS
674 exit $RC
678 echo "ldapsearch failed ($RC)!"
679 test $KILLSERVERS != no && kill -HUP $KILLPIDS
680 exit $RC
682 esac
684 echo "Testing no limit requested for limited users..."
685 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
686 -D 'cn=Special User,dc=example,dc=com' \
687 '(objectClass=*)' > $SEARCHOUT 2>&1
688 RC=$?
689 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
690 case $RC in
692 if test x"$COUNT" != x ; then
693 echo "...didn't bump into server-side size limit (got $COUNT entries)"
694 else
695 echo "...error: did not expect ldapsearch success ($RC)!"
696 test $KILLSERVERS != no && kill -HUP $KILLPIDS
697 exit 1
701 if test "x$COUNT" != "x" ; then
702 echo "...bumped into server-side size limit ($COUNT)"
703 else
704 echo "...error: bumped into server-side size limit, but got no entries!"
705 test $KILLSERVERS != no && kill -HUP $KILLPIDS
706 exit $RC
710 echo "ldapsearch failed ($RC)!"
711 test $KILLSERVERS != no && kill -HUP $KILLPIDS
712 exit $RC
714 esac
716 echo "Testing no limit requested for limited anonymous..."
717 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
718 '(objectClass=*)' > $SEARCHOUT 2>&1
719 RC=$?
720 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
721 case $RC in
723 if test x"$COUNT" != x ; then
724 echo "...didn't bump into server-side size limit (got $COUNT entries)"
725 else
726 echo "...error: did not expect ldapsearch success ($RC)!"
727 test $KILLSERVERS != no && kill -HUP $KILLPIDS
728 exit 1
732 if test "x$COUNT" != "x" ; then
733 echo "...bumped into server-side size limit ($COUNT)"
734 else
735 echo "...error: bumped into server-side size limit, but got no entries!"
736 test $KILLSERVERS != no && kill -HUP $KILLPIDS
737 exit $RC
741 echo "ldapsearch failed ($RC)!"
742 test $KILLSERVERS != no && kill -HUP $KILLPIDS
743 exit $RC
745 esac
747 case $BACKEND in
748 bdb | hdb)
749 # only bdb|hdb currently supports pagedResults control
752 test $KILLSERVERS != no && kill -HUP $KILLPIDS
754 echo ">>>>> Test succeeded"
755 exit 0
757 esac
759 if test x"$SLAPD_PAGE_SIZE" != x ; then
760 PAGESIZE="$SLAPD_PAGE_SIZE"
761 if test "$PAGESIZE" -le 0 ; then
762 test $KILLSERVERS != no && kill -HUP $KILLPIDS
764 echo ""
765 echo "Testing with pagedResults control disabled"
766 echo ""
767 echo ">>>>> Test succeeded"
768 exit 0
770 else
771 PAGESIZE=5
774 echo ""
775 echo "Testing regular search limits with pagedResults control (page size $PAGESIZE)"
776 echo ""
778 echo "Testing no limits requested for unlimited ID..."
779 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
780 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
781 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' >$SEARCHOUT 2>&1
782 RC=$?
783 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
784 case $RC in
786 if test x"$COUNT" != x ; then
787 echo "...success (got $COUNT entries)"
788 else
789 echo "...error: did not expect ldapsearch success ($RC)!"
790 test $KILLSERVERS != no && kill -HUP $KILLPIDS
791 exit 1
795 echo "ldapsearch failed ($RC)!"
796 test $KILLSERVERS != no && kill -HUP $KILLPIDS
797 exit $RC
799 esac
801 SIZELIMIT=2
802 echo "Testing size limit request ($SIZELIMIT) for unlimited ID..."
803 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
804 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
805 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
806 RC=$?
807 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
808 case $RC in
810 if test x"$COUNT" != x ; then
811 if test "$COUNT" -gt "$SIZELIMIT" ; then
812 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
813 test $KILLSERVERS != no && kill -HUP $KILLPIDS
814 exit 1
816 echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)"
817 else
818 echo "...error: did not expect ldapsearch success ($RC)!"
819 test $KILLSERVERS != no && kill -HUP $KILLPIDS
820 exit 1
824 if test x"$COUNT" != x ; then
825 if test $COUNT = $SIZELIMIT ; then
826 echo "...bumped into requested size limit ($SIZELIMIT)"
827 else
828 echo "...error: got $COUNT entries while requesting $SIZELIMIT..."
829 test $KILLSERVERS != no && kill -HUP $KILLPIDS
830 exit $RC
832 else
833 echo "...error: bumped into server-side size limit, but got no entries!"
834 test $KILLSERVERS != no && kill -HUP $KILLPIDS
835 exit $RC
839 echo "ldapsearch failed ($RC)!"
840 test $KILLSERVERS != no && kill -HUP $KILLPIDS
841 exit $RC
843 esac
845 TIMELIMIT=10
846 echo "Testing time limit request ($TIMELIMIT s) for unlimited ID..."
847 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -l $TIMELIMIT \
848 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
849 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
850 RC=$?
851 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
852 case $RC in
854 if test x"$COUNT" != x ; then
855 echo "...didn't bump into the requested time limit ($TIMELIMIT s; got $COUNT entries)"
856 else
857 echo "...error: did not expect ldapsearch success ($RC)!"
858 test $KILLSERVERS != no && kill -HUP $KILLPIDS
859 exit 1
863 if test x"$COUNT" = x ; then
864 COUNT=0
866 echo "...bumped into requested time limit ($TIMELIMIT s; got $COUNT entries)"
869 echo "ldapsearch failed ($RC)!"
870 test $KILLSERVERS != no && kill -HUP $KILLPIDS
871 exit $RC
873 esac
875 echo "Testing no limits requested for soft limited ID..."
876 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
877 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
878 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
879 RC=$?
880 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
881 case $RC in
883 if test x"$COUNT" != x ; then
884 echo "...didn't bump into server-side size limit (got $COUNT entries)"
885 else
886 echo "...error: did not expect ldapsearch success ($RC)!"
887 test $KILLSERVERS != no && kill -HUP $KILLPIDS
888 exit 1
892 if test x"$COUNT" != x ; then
893 echo "...bumped into server-side size limit (got $COUNT entries)"
894 else
895 echo "...error: bumped into server-side size limit, but got no entries!"
896 test $KILLSERVERS != no && kill -HUP $KILLPIDS
897 exit $RC
901 echo "ldapsearch failed ($RC)!"
902 test $KILLSERVERS != no && kill -HUP $KILLPIDS
903 exit $RC
905 esac
907 SIZELIMIT=2
908 echo "Testing lower than soft limit request ($SIZELIMIT) for soft limited ID..."
909 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
910 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
911 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
912 RC=$?
913 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
914 case $RC in
916 if test x"$COUNT" != x ; then
917 if test "$COUNT" -gt "$SIZELIMIT" ; then
918 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
919 test $KILLSERVERS != no && kill -HUP $KILLPIDS
920 exit 1
922 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
923 else
924 echo "...error: did not expect ldapsearch success ($RC)!"
925 test $KILLSERVERS != no && kill -HUP $KILLPIDS
926 exit 1
930 if test "x$COUNT" != "x" ; then
931 if test "x$SIZELIMIT" = "x$COUNT" ; then
932 echo "...bumped into requested ($SIZELIMIT) size limit"
933 else
934 echo "...bumped into server-side size limit ($COUNT)"
936 else
937 echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
941 echo "ldapsearch failed ($RC)!"
942 test $KILLSERVERS != no && kill -HUP $KILLPIDS
943 exit $RC
945 esac
947 SIZELIMIT=100
948 echo "Testing higher than soft limit request ($SIZELIMIT) for soft limited ID..."
949 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
950 -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
951 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
952 RC=$?
953 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
954 case $RC in
956 if test x"$COUNT" != x ; then
957 if test "$COUNT" -gt "$SIZELIMIT" ; then
958 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
959 test $KILLSERVERS != no && kill -HUP $KILLPIDS
960 exit 1
962 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
963 else
964 echo "...error: did not expect ldapsearch success ($RC)!"
965 test $KILLSERVERS != no && kill -HUP $KILLPIDS
966 exit 1
970 if test "x$COUNT" != "x" ; then
971 if test "x$SIZELIMIT" = "x$COUNT" ; then
972 echo "...bumped into requested ($SIZELIMIT) size limit"
973 else
974 echo "...bumped into server-side size limit ($COUNT)"
976 else
977 echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
981 echo "ldapsearch failed ($RC)!"
982 test $KILLSERVERS != no && kill -HUP $KILLPIDS
983 exit $RC
985 esac
987 SIZELIMIT=2
988 echo "Testing lower than hard limit request ($SIZELIMIT) for hard limited ID..."
989 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
990 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
991 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
992 RC=$?
993 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
994 case $RC in
996 if test x"$COUNT" != x ; then
997 if test "$COUNT" -gt "$SIZELIMIT" ; then
998 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
999 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1000 exit 1
1002 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
1003 else
1004 echo "...error: did not expect ldapsearch success ($RC)!"
1005 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1006 exit 1
1010 if test x"$COUNT" != x ; then
1011 if test "$COUNT" = "$SIZELIMIT" ; then
1012 echo "...bumped into requested ($SIZELIMIT) size limit"
1013 else
1014 echo "...error: got size limit $SIZELIMIT but $COUNT entries"
1015 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1016 exit $RC
1018 else
1019 echo "...error: bumped into server-side size limit, but got no entries!"
1020 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1021 exit $RC
1025 echo "ldapsearch failed ($RC)!"
1026 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1027 exit $RC
1029 esac
1031 SIZELIMIT=100
1032 echo "Testing higher than hard limit request ($SIZELIMIT) for hard limited ID..."
1033 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
1034 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
1035 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1036 RC=$?
1037 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1038 case $RC in
1040 if test x"$COUNT" != x ; then
1041 if test "$COUNT" -gt "$SIZELIMIT" ; then
1042 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
1043 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1044 exit 1
1046 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
1047 else
1048 echo "...error: did not expect ldapsearch success ($RC)!"
1049 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1050 exit 1
1054 if test x"$COUNT" != x ; then
1055 if test "$COUNT" = "$SIZELIMIT" ; then
1056 echo "...error: bumped into requested ($SIZELIMIT) size limit"
1057 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1058 exit $RC
1059 else
1060 echo "...got size limit $COUNT instead of requested $SIZELIMIT entries"
1062 else
1063 echo "...error: bumped into server-side size limit, but got no entries!"
1064 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1065 exit $RC
1068 # 11)
1069 # echo "...bumped into hard size administrative limit"
1070 # ;;
1072 echo "ldapsearch failed ($RC)!"
1073 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1074 exit $RC
1076 esac
1078 SIZELIMIT=max
1079 echo "Testing max limit request ($SIZELIMIT) for hard limited ID..."
1080 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
1081 -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
1082 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1083 RC=$?
1084 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1085 case $RC in
1087 if test x"$COUNT" != x ; then
1088 echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
1089 else
1090 echo "...error: did not expect ldapsearch success ($RC)!"
1091 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1092 exit 1
1096 if test x"$COUNT" != x ; then
1097 echo "...bumped into requested ($SIZELIMIT=$COUNT) size limit"
1098 else
1099 echo "...error: bumped into size limit but got no entries!"
1100 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1101 exit $RC
1104 # 11)
1105 # echo "...bumped into hard size administrative limit"
1106 # ;;
1108 echo "ldapsearch failed ($RC)!"
1109 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1110 exit $RC
1112 esac
1114 echo "Testing lower than unchecked limit request for unchecked limited ID..."
1115 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1116 -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \
1117 -E '!pr='$PAGESIZE'/noprompt' '(uid=uncheckedlimited)' > $SEARCHOUT 2>&1
1118 RC=$?
1119 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1120 case $RC in
1122 if test x"$COUNT" != x ; then
1123 echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
1124 else
1125 echo "...error: did not expect ldapsearch success ($RC)!"
1126 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1127 exit 1
1130 # 11)
1131 # echo "...bumped into unchecked administrative limit"
1132 # ;;
1134 echo "ldapsearch failed ($RC)!"
1135 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1136 exit $RC
1138 esac
1140 echo "Testing higher than unchecked limit requested for unchecked limited ID..."
1141 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1142 -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \
1143 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1144 RC=$?
1145 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1146 case $RC in
1148 if test x"$COUNT" != x ; then
1149 echo "...error: didn't bump into server-side unchecked limit (got $COUNT entries)"
1150 else
1151 echo "...error: did not expect ldapsearch success ($RC)!"
1153 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1154 exit 1
1157 echo "...bumped into unchecked administrative limit"
1160 echo "ldapsearch failed ($RC)!"
1161 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1162 exit $RC
1164 esac
1166 echo ""
1167 echo "Testing specific search limits with pagedResults control"
1168 echo ""
1170 echo "Testing no limit requested for unlimited page size ID..."
1171 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1172 -D 'cn=Unlimited User,ou=Paged Results Users,dc=example,dc=com' \
1173 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1174 RC=$?
1175 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1176 case $RC in
1178 if test x"$COUNT" != x ; then
1179 echo "...success; didn't bump into server-side size limit (got $COUNT entries)"
1180 else
1181 echo "...error: did not expect ldapsearch success ($RC)!"
1182 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1183 exit 1
1187 if test x"$COUNT" != x ; then
1188 echo "...bumped into server-side size limit (got $COUNT entries)"
1189 else
1190 echo "...error: bumped into server-side size limit, but got no entries!"
1191 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1192 exit $RC
1196 echo "ldapsearch failed ($RC)!"
1197 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1198 exit $RC
1200 esac
1202 echo "Testing no limit requested for limited page size ID..."
1203 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1204 -D 'cn=Page Size Limited User,ou=Paged Results Users,dc=example,dc=com' \
1205 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1206 RC=$?
1207 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1208 case $RC in
1210 echo "...success; didn't bump into server-side page size limit (got $COUNT entries)"
1213 echo "...bumped into page size limit ($COUNT)"
1216 echo "...bumped into page size administrative limit"
1219 echo "ldapsearch failed ($RC)!"
1220 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1221 exit $RC
1223 esac
1225 echo "Testing no limit requested for pagedResults disabled ID..."
1226 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1227 -D 'cn=Paged Results Disabled User,ou=Paged Results Users,dc=example,dc=com' \
1228 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1229 RC=$?
1230 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1231 case $RC in
1233 echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
1236 echo "...bumped into server-side size limit ($COUNT)"
1239 echo "...bumped into pagedResults disabled administrative limit"
1242 echo "ldapsearch failed ($RC)!"
1243 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1244 exit $RC
1246 esac
1248 echo "Testing no limit requested for pagedResults total count limited ID..."
1249 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1250 -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1251 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1252 RC=$?
1253 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1254 case $RC in
1256 echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
1259 echo "...bumped into server-side size limit ($COUNT)"
1262 echo "...bumped into pagedResults total count administrative limit"
1265 echo "ldapsearch failed ($RC)!"
1266 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1267 exit $RC
1269 esac
1271 SIZELIMIT=8
1272 echo "Testing higher than hard but lower then total count limit requested for pagedResults total count limited ID..."
1273 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1274 -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1275 -z $SIZELIMIT -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1276 RC=$?
1277 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1278 case $RC in
1280 echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side unchecked limit (got $COUNT entries)"
1283 if test "x$COUNT" != "x" ; then
1284 if test "x$SIZELIMIT" = "x$COUNT" ; then
1285 echo "...bumped into requested ($SIZELIMIT) size limit"
1286 else
1287 echo "...bumped into server-side size limit ($COUNT)"
1289 else
1290 echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
1294 echo "...bumped into either hard size or pagedResults total count administrative limit"
1297 echo "ldapsearch failed ($RC)!"
1298 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1299 exit $RC
1301 esac
1303 SIZELIMIT=15
1304 echo "Testing higher than total count limit requested for pagedResults total count limited ID..."
1305 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1306 -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1307 -z $SIZELIMIT -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1308 RC=$?
1309 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1310 case $RC in
1312 echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side unchecked limit (got $COUNT entries)"
1315 if test "x$COUNT" != "x" ; then
1316 if test "x$SIZELIMIT" = "x$COUNT" ; then
1317 echo "...bumped into requested ($SIZELIMIT) size limit"
1318 else
1319 echo "...bumped into server-side size limit ($COUNT)"
1321 else
1322 echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
1326 echo "...bumped into pagedResults total count administrative limit"
1329 echo "ldapsearch failed ($RC)!"
1330 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1331 exit $RC
1333 esac
1335 SIZELIMIT=max
1336 echo "Testing max limit requested for pagedResults total count limited ID..."
1337 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1338 -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1339 -z $SIZELIMIT -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1340 RC=$?
1341 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1342 case $RC in
1344 echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side unchecked limit (got $COUNT entries)"
1347 if test "x$COUNT" != "x" ; then
1348 if test "x$SIZELIMIT" = "x$COUNT" ; then
1349 echo "...bumped into requested ($SIZELIMIT) size limit"
1350 else
1351 echo "...bumped into server-side size limit ($COUNT)"
1353 else
1354 echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
1358 echo "...bumped into pagedResults total count administrative limit"
1361 echo "ldapsearch failed ($RC)!"
1362 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1363 exit $RC
1365 esac
1367 # ITS#4479
1368 PAGESIZE=1
1369 SIZELIMIT=2
1370 echo "Testing size limit request ($SIZELIMIT) for unlimited ID and pagesize=$PAGESIZE..."
1371 $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
1372 -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
1373 -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1374 RC=$?
1375 COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1376 case $RC in
1378 if test x"$COUNT" != x ; then
1379 if test "$COUNT" -gt "$SIZELIMIT" ; then
1380 echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
1381 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1382 exit 1
1384 echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)"
1385 else
1386 echo "...error: did not expect ldapsearch success ($RC)!"
1387 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1388 exit 1
1392 if test x"$COUNT" != x ; then
1393 if test $COUNT = $SIZELIMIT ; then
1394 echo "...bumped into requested size limit ($SIZELIMIT)"
1395 else
1396 echo "...error: got $COUNT entries while requesting $SIZELIMIT..."
1397 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1398 exit $RC
1400 else
1401 echo "...error: bumped into server-side size limit, but got no entries!"
1402 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1403 exit $RC
1407 echo "ldapsearch failed ($RC)!"
1408 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1409 exit $RC
1411 esac
1413 test $KILLSERVERS != no && kill -HUP $KILLPIDS
1415 echo ">>>>> Test succeeded"
1417 test $KILLSERVERS != no && wait
1419 exit 0