test025-limits revision 1.1.1.3 1 1.1 lukem #! /bin/sh
2 1.1.1.3 adam # OpenLDAP: pkg/ldap/tests/scripts/test025-limits,v 1.19.2.8 2010/04/19 19:14:34 quanah Exp
3 1.1 lukem ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 1.1 lukem ##
5 1.1.1.3 adam ## Copyright 1998-2010 The OpenLDAP Foundation.
6 1.1 lukem ## All rights reserved.
7 1.1 lukem ##
8 1.1 lukem ## Redistribution and use in source and binary forms, with or without
9 1.1 lukem ## modification, are permitted only as authorized by the OpenLDAP
10 1.1 lukem ## Public License.
11 1.1 lukem ##
12 1.1 lukem ## A copy of this license is available in the file LICENSE in the
13 1.1 lukem ## top-level directory of the distribution or, alternatively, at
14 1.1 lukem ## <http://www.OpenLDAP.org/license.html>.
15 1.1 lukem
16 1.1 lukem ## FIXME: need to exclude legal but wrong results...
17 1.1 lukem
18 1.1 lukem echo "running defines.sh"
19 1.1 lukem . $SRCDIR/scripts/defines.sh
20 1.1 lukem
21 1.1.1.3 adam if test $BACKEND = null; then
22 1.1.1.3 adam echo "Limits irrelevant to $BACKEND backend, test skipped"
23 1.1.1.3 adam exit 0
24 1.1.1.3 adam fi
25 1.1.1.3 adam
26 1.1 lukem mkdir -p $TESTDIR $DBDIR1
27 1.1 lukem
28 1.1 lukem echo "Running slapadd to build slapd database..."
29 1.1 lukem . $CONFFILTER $BACKEND $MONITORDB < $LIMITSCONF > $ADDCONF
30 1.1 lukem $SLAPADD -f $ADDCONF -l $LDIFLIMITS
31 1.1 lukem RC=$?
32 1.1 lukem if test $RC != 0 ; then
33 1.1 lukem echo "slapadd failed ($RC)!"
34 1.1 lukem exit $RC
35 1.1 lukem fi
36 1.1 lukem
37 1.1 lukem echo "Running slapindex to index slapd database..."
38 1.1 lukem . $CONFFILTER $BACKEND $MONITORDB < $LIMITSCONF > $CONF1
39 1.1 lukem $SLAPINDEX -f $CONF1
40 1.1 lukem RC=$?
41 1.1 lukem if test $RC != 0 ; then
42 1.1 lukem echo "warning: slapindex failed ($RC)"
43 1.1 lukem echo " assuming no indexing support"
44 1.1 lukem fi
45 1.1 lukem
46 1.1 lukem echo "Starting slapd on TCP/IP port $PORT1..."
47 1.1 lukem $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
48 1.1 lukem PID=$!
49 1.1 lukem if test $WAIT != 0 ; then
50 1.1 lukem echo PID $PID
51 1.1 lukem read foo
52 1.1 lukem fi
53 1.1 lukem KILLPIDS="$PID"
54 1.1 lukem
55 1.1 lukem sleep 1
56 1.1 lukem
57 1.1 lukem echo "Testing slapd searching..."
58 1.1 lukem for i in 0 1 2 3 4 5; do
59 1.1 lukem $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
60 1.1 lukem '(objectclass=*)' > /dev/null 2>&1
61 1.1 lukem RC=$?
62 1.1 lukem if test $RC = 0 ; then
63 1.1 lukem break
64 1.1 lukem fi
65 1.1 lukem echo "Waiting 5 seconds for slapd to start..."
66 1.1 lukem sleep 5
67 1.1 lukem done
68 1.1 lukem
69 1.1 lukem if test $RC != 0 ; then
70 1.1 lukem echo "ldapsearch failed ($RC)!"
71 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
72 1.1 lukem exit $RC
73 1.1 lukem fi
74 1.1 lukem
75 1.1 lukem cat /dev/null > $SEARCHOUT
76 1.1 lukem
77 1.1 lukem echo ""
78 1.1 lukem echo "Testing regular search limits"
79 1.1 lukem echo ""
80 1.1 lukem
81 1.1 lukem echo "Testing no limits requested for unlimited ID..."
82 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
83 1.1 lukem -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
84 1.1 lukem '(objectClass=*)' >$SEARCHOUT 2>&1
85 1.1 lukem RC=$?
86 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
87 1.1 lukem case $RC in
88 1.1 lukem 0)
89 1.1 lukem if test x"$COUNT" != x ; then
90 1.1 lukem echo "...success (got $COUNT entries)"
91 1.1 lukem else
92 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
93 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
94 1.1 lukem exit 1
95 1.1 lukem fi
96 1.1 lukem ;;
97 1.1 lukem *)
98 1.1 lukem echo "ldapsearch failed ($RC)!"
99 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
100 1.1 lukem exit $RC
101 1.1 lukem ;;
102 1.1 lukem esac
103 1.1 lukem
104 1.1 lukem echo "Testing no limits requested for rootdn=$MANAGERDN..."
105 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
106 1.1 lukem -D "$MANAGERDN" \
107 1.1 lukem '(objectClass=*)' >$SEARCHOUT 2>&1
108 1.1 lukem RC=$?
109 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
110 1.1 lukem case $RC in
111 1.1 lukem 0)
112 1.1 lukem if test x"$COUNT" != x ; then
113 1.1 lukem echo "...success (got $COUNT entries)"
114 1.1 lukem else
115 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
116 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
117 1.1 lukem exit 1
118 1.1 lukem fi
119 1.1 lukem ;;
120 1.1 lukem *)
121 1.1 lukem echo "ldapsearch failed ($RC)!"
122 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
123 1.1 lukem exit $RC
124 1.1 lukem ;;
125 1.1 lukem esac
126 1.1 lukem
127 1.1 lukem SIZELIMIT=4
128 1.1 lukem echo "Testing limit requested for rootdn=$MANAGERDN..."
129 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
130 1.1 lukem -D "$MANAGERDN" \
131 1.1 lukem '(objectClass=*)' >$SEARCHOUT 2>&1
132 1.1 lukem RC=$?
133 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
134 1.1 lukem case $RC in
135 1.1 lukem 0)
136 1.1 lukem if test x"$COUNT" != x ; then
137 1.1 lukem if test "$COUNT" -gt "$SIZELIMIT" ; then
138 1.1 lukem echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
139 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
140 1.1 lukem exit 1
141 1.1 lukem fi
142 1.1 lukem echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)"
143 1.1 lukem else
144 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
145 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
146 1.1 lukem exit 1
147 1.1 lukem fi
148 1.1 lukem ;;
149 1.1 lukem 4)
150 1.1 lukem if test x"$COUNT" != x ; then
151 1.1 lukem if test "$COUNT" = "$SIZELIMIT" ; then
152 1.1 lukem echo "...bumped into requested size limit ($SIZELIMIT)"
153 1.1 lukem else
154 1.1 lukem echo "...error: got $COUNT entries with a requested sizelimit of $SIZELIMIT"
155 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
156 1.1 lukem exit $RC
157 1.1 lukem fi
158 1.1 lukem else
159 1.1 lukem echo "...error: bumped into server-side size limit, but got no entries!"
160 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
161 1.1 lukem exit $RC
162 1.1 lukem fi
163 1.1 lukem ;;
164 1.1 lukem *)
165 1.1 lukem echo "ldapsearch failed ($RC)!"
166 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
167 1.1 lukem exit $RC
168 1.1 lukem ;;
169 1.1 lukem esac
170 1.1 lukem
171 1.1 lukem SIZELIMIT=2
172 1.1 lukem echo "Testing size limit request ($SIZELIMIT) for unlimited ID..."
173 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
174 1.1 lukem -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
175 1.1 lukem '(objectClass=*)' > $SEARCHOUT 2>&1
176 1.1 lukem RC=$?
177 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
178 1.1 lukem case $RC in
179 1.1 lukem 0)
180 1.1 lukem if test x"$COUNT" != x ; then
181 1.1 lukem if test "$COUNT" -gt "$SIZELIMIT" ; then
182 1.1 lukem echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
183 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
184 1.1 lukem exit 1
185 1.1 lukem fi
186 1.1 lukem echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)"
187 1.1 lukem else
188 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
189 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
190 1.1 lukem exit 1
191 1.1 lukem fi
192 1.1 lukem ;;
193 1.1 lukem 4)
194 1.1 lukem if test x"$COUNT" != x ; then
195 1.1 lukem if test "$COUNT" = "$SIZELIMIT" ; then
196 1.1 lukem echo "...bumped into requested size limit ($SIZELIMIT)"
197 1.1 lukem else
198 1.1 lukem echo "...error: got $COUNT entries with a requested sizelimit of $SIZELIMIT"
199 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
200 1.1 lukem exit $RC
201 1.1 lukem fi
202 1.1 lukem else
203 1.1 lukem echo "...error: bumped into server-side size limit, but got no entries!"
204 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
205 1.1 lukem exit $RC
206 1.1 lukem fi
207 1.1 lukem ;;
208 1.1 lukem *)
209 1.1 lukem echo "ldapsearch failed ($RC)!"
210 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
211 1.1 lukem exit $RC
212 1.1 lukem ;;
213 1.1 lukem esac
214 1.1 lukem
215 1.1 lukem TIMELIMIT=10
216 1.1 lukem echo "Testing time limit request ($TIMELIMIT s) for unlimited ID..."
217 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -l $TIMELIMIT \
218 1.1 lukem -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
219 1.1 lukem '(objectClass=*)' > $SEARCHOUT 2>&1
220 1.1 lukem RC=$?
221 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
222 1.1 lukem case $RC in
223 1.1 lukem 0)
224 1.1 lukem if test x"$COUNT" != x ; then
225 1.1 lukem echo "...didn't bump into the requested time limit ($TIMELIMIT s; got $COUNT entries)"
226 1.1 lukem else
227 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
228 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
229 1.1 lukem exit 1
230 1.1 lukem fi
231 1.1 lukem ;;
232 1.1 lukem 3)
233 1.1 lukem if test x"$COUNT" != x ; then
234 1.1 lukem COUNT=0
235 1.1 lukem fi
236 1.1 lukem echo "...bumped into requested time limit ($TIMELIMIT s; got $COUNT entries)"
237 1.1 lukem ;;
238 1.1 lukem *)
239 1.1 lukem echo "ldapsearch failed ($RC)!"
240 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
241 1.1 lukem exit $RC
242 1.1 lukem ;;
243 1.1 lukem esac
244 1.1 lukem
245 1.1 lukem echo "Testing no limits requested for soft limited ID..."
246 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
247 1.1 lukem -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
248 1.1 lukem '(objectClass=*)' > $SEARCHOUT 2>&1
249 1.1 lukem RC=$?
250 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
251 1.1 lukem case $RC in
252 1.1 lukem 0)
253 1.1 lukem if test x"$COUNT" != x ; then
254 1.1 lukem echo "...didn't bump into server-side size limit (got $COUNT entries)"
255 1.1 lukem else
256 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
257 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
258 1.1 lukem exit 1
259 1.1 lukem fi
260 1.1 lukem ;;
261 1.1 lukem 4)
262 1.1 lukem if test x"$COUNT" != x ; then
263 1.1 lukem echo "...bumped into server-side size limit (got $COUNT entries)"
264 1.1 lukem else
265 1.1 lukem echo "...error: bumped into server-side size limit, but got no entries!"
266 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
267 1.1 lukem exit $RC
268 1.1 lukem fi
269 1.1 lukem ;;
270 1.1 lukem *)
271 1.1 lukem echo "ldapsearch failed ($RC)!"
272 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
273 1.1 lukem exit $RC
274 1.1 lukem ;;
275 1.1 lukem esac
276 1.1 lukem
277 1.1 lukem SIZELIMIT=2
278 1.1 lukem echo "Testing lower than soft limit request ($SIZELIMIT) for soft limited ID..."
279 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
280 1.1 lukem -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
281 1.1 lukem '(objectClass=*)' > $SEARCHOUT 2>&1
282 1.1 lukem RC=$?
283 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
284 1.1 lukem case $RC in
285 1.1 lukem 0)
286 1.1 lukem if test x"$COUNT" != x ; then
287 1.1 lukem if test "$COUNT" -gt "$SIZELIMIT" ; then
288 1.1 lukem echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
289 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
290 1.1 lukem exit 1
291 1.1 lukem fi
292 1.1 lukem echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
293 1.1 lukem else
294 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
295 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
296 1.1 lukem exit 1
297 1.1 lukem fi
298 1.1 lukem ;;
299 1.1 lukem 4)
300 1.1 lukem if test "x$COUNT" != "x" ; then
301 1.1 lukem if test "x$SIZELIMIT" = "x$COUNT" ; then
302 1.1 lukem echo "...bumped into requested ($SIZELIMIT) size limit"
303 1.1 lukem else
304 1.1 lukem echo "...bumped into server-side size limit ($COUNT)"
305 1.1 lukem fi
306 1.1 lukem else
307 1.1 lukem echo "...error: bumped into server-side size limit, but got no entries!"
308 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
309 1.1 lukem exit $RC
310 1.1 lukem fi
311 1.1 lukem ;;
312 1.1 lukem *)
313 1.1 lukem echo "ldapsearch failed ($RC)!"
314 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
315 1.1 lukem exit $RC
316 1.1 lukem ;;
317 1.1 lukem esac
318 1.1 lukem
319 1.1 lukem SIZELIMIT=100
320 1.1 lukem echo "Testing higher than soft limit request ($SIZELIMIT) for soft limited ID..."
321 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
322 1.1 lukem -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
323 1.1 lukem '(objectClass=*)' > $SEARCHOUT 2>&1
324 1.1 lukem RC=$?
325 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
326 1.1 lukem case $RC in
327 1.1 lukem 0)
328 1.1 lukem if test x"$COUNT" != x ; then
329 1.1 lukem if test "$COUNT" -gt "$SIZELIMIT" ; then
330 1.1 lukem echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
331 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
332 1.1 lukem exit 1
333 1.1 lukem fi
334 1.1 lukem echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
335 1.1 lukem else
336 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
337 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
338 1.1 lukem exit 1
339 1.1 lukem fi
340 1.1 lukem ;;
341 1.1 lukem 4)
342 1.1 lukem if test "x$COUNT" != "x" ; then
343 1.1 lukem if test "x$SIZELIMIT" = "x$COUNT" ; then
344 1.1 lukem echo "...bumped into requested ($SIZELIMIT) size limit"
345 1.1 lukem else
346 1.1 lukem echo "...bumped into server-side size limit ($COUNT)"
347 1.1 lukem fi
348 1.1 lukem else
349 1.1 lukem echo "...error: bumped into server-side size limit, but got no entries!"
350 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
351 1.1 lukem exit $RC
352 1.1 lukem fi
353 1.1 lukem ;;
354 1.1 lukem *)
355 1.1 lukem echo "ldapsearch failed ($RC)!"
356 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
357 1.1 lukem exit $RC
358 1.1 lukem ;;
359 1.1 lukem esac
360 1.1 lukem
361 1.1 lukem SIZELIMIT=2
362 1.1 lukem echo "Testing lower than hard limit request ($SIZELIMIT) for hard limited ID..."
363 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
364 1.1 lukem -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
365 1.1 lukem '(objectClass=*)' > $SEARCHOUT 2>&1
366 1.1 lukem RC=$?
367 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
368 1.1 lukem case $RC in
369 1.1 lukem 0)
370 1.1 lukem if test x"$COUNT" != x ; then
371 1.1 lukem if test "$COUNT" -gt "$SIZELIMIT" ; then
372 1.1 lukem echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
373 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
374 1.1 lukem exit 1
375 1.1 lukem fi
376 1.1 lukem echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
377 1.1 lukem else
378 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
379 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
380 1.1 lukem exit 1
381 1.1 lukem fi
382 1.1 lukem ;;
383 1.1 lukem 4)
384 1.1 lukem echo "...bumped into requested ($SIZELIMIT) size limit"
385 1.1 lukem ;;
386 1.1 lukem *)
387 1.1 lukem echo "ldapsearch failed ($RC)!"
388 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
389 1.1 lukem exit $RC
390 1.1 lukem ;;
391 1.1 lukem esac
392 1.1 lukem
393 1.1 lukem SIZELIMIT=100
394 1.1 lukem echo "Testing higher than hard limit request ($SIZELIMIT) for hard limited ID..."
395 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
396 1.1 lukem -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
397 1.1 lukem '(objectClass=*)' > $SEARCHOUT 2>&1
398 1.1 lukem RC=$?
399 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
400 1.1 lukem case $RC in
401 1.1 lukem 0)
402 1.1 lukem if test x"$COUNT" != x ; then
403 1.1 lukem if test "$COUNT" -gt "$SIZELIMIT" ; then
404 1.1 lukem echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
405 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
406 1.1 lukem exit 1
407 1.1 lukem fi
408 1.1 lukem echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
409 1.1 lukem else
410 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
411 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
412 1.1 lukem exit 1
413 1.1 lukem fi
414 1.1 lukem ;;
415 1.1 lukem 4)
416 1.1 lukem if test x"$COUNT" != x ; then
417 1.1 lukem if test "$COUNT" = "$SIZELIMIT" ; then
418 1.1 lukem echo "...error: bumped into requested ($SIZELIMIT) size limit"
419 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
420 1.1 lukem exit $RC
421 1.1 lukem else
422 1.1 lukem echo "...got size limit $COUNT instead of requested $SIZELIMIT entries"
423 1.1 lukem fi
424 1.1 lukem else
425 1.1 lukem echo "...error: bumped into server-side size limit, but got no entries!"
426 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
427 1.1 lukem exit $RC
428 1.1 lukem fi
429 1.1 lukem ;;
430 1.1 lukem # 11)
431 1.1 lukem # echo "...bumped into server-side hard size administrative limit"
432 1.1 lukem # ;;
433 1.1 lukem *)
434 1.1 lukem echo "ldapsearch failed ($RC)!"
435 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
436 1.1 lukem exit $RC
437 1.1 lukem ;;
438 1.1 lukem esac
439 1.1 lukem
440 1.1 lukem SIZELIMIT=max
441 1.1 lukem echo "Testing max limit request ($SIZELIMIT) for hard limited ID..."
442 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
443 1.1 lukem -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
444 1.1 lukem '(objectClass=*)' > $SEARCHOUT 2>&1
445 1.1 lukem RC=$?
446 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
447 1.1 lukem case $RC in
448 1.1 lukem 0)
449 1.1 lukem if test x"$COUNT" != x ; then
450 1.1 lukem echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
451 1.1 lukem else
452 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
453 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
454 1.1 lukem exit 1
455 1.1 lukem fi
456 1.1 lukem ;;
457 1.1 lukem 4)
458 1.1 lukem if test x"$COUNT" != x ; then
459 1.1 lukem echo "...bumped into requested ($SIZELIMIT=$COUNT) size limit"
460 1.1 lukem else
461 1.1 lukem echo "...error: bumped into server-side size limit, but got no entries!"
462 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
463 1.1 lukem exit $RC
464 1.1 lukem fi
465 1.1 lukem ;;
466 1.1 lukem # 11)
467 1.1 lukem # echo "...bumped into server-side hard size administrative limit"
468 1.1 lukem # ;;
469 1.1 lukem *)
470 1.1 lukem echo "ldapsearch failed ($RC)!"
471 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
472 1.1 lukem exit $RC
473 1.1 lukem ;;
474 1.1 lukem esac
475 1.1 lukem
476 1.1 lukem echo "Testing lower than unchecked limit request for unchecked limited ID..."
477 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
478 1.1 lukem -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \
479 1.1 lukem '(uid=uncheckedlimited)' > $SEARCHOUT 2>&1
480 1.1 lukem RC=$?
481 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
482 1.1 lukem case $RC in
483 1.1 lukem 0)
484 1.1 lukem if test x"$COUNT" != x ; then
485 1.1 lukem echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
486 1.1 lukem else
487 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
488 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
489 1.1 lukem exit 1
490 1.1 lukem fi
491 1.1 lukem ;;
492 1.1 lukem 11)
493 1.1 lukem echo "...error: bumped into unchecked administrative limit"
494 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
495 1.1 lukem exit $RC
496 1.1 lukem ;;
497 1.1 lukem *)
498 1.1 lukem echo "ldapsearch failed ($RC)!"
499 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
500 1.1 lukem exit $RC
501 1.1 lukem ;;
502 1.1 lukem esac
503 1.1 lukem
504 1.1 lukem case $BACKEND in bdb | hdb)
505 1.1 lukem
506 1.1 lukem echo "Testing higher than unchecked limit requested for unchecked limited ID..."
507 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
508 1.1 lukem -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \
509 1.1 lukem '(objectClass=*)' > $SEARCHOUT 2>&1
510 1.1 lukem RC=$?
511 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
512 1.1 lukem case $RC in
513 1.1 lukem 0)
514 1.1 lukem if test x"$COUNT" != x ; then
515 1.1 lukem echo "...error: didn't bump into server-side unchecked limit (got $COUNT entries)"
516 1.1 lukem else
517 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
518 1.1 lukem fi
519 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
520 1.1 lukem exit 1
521 1.1 lukem ;;
522 1.1 lukem 11)
523 1.1 lukem echo "...bumped into unchecked administrative limit"
524 1.1 lukem ;;
525 1.1 lukem *)
526 1.1 lukem echo "ldapsearch failed ($RC)!"
527 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
528 1.1 lukem exit $RC
529 1.1 lukem ;;
530 1.1 lukem esac
531 1.1 lukem
532 1.1 lukem echo "Testing no limits requested for unchecked limited group..."
533 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
534 1.1 lukem -D 'cn=Unchecked Limited User 2,ou=People,dc=example,dc=com' \
535 1.1 lukem '(objectClass=*)' > $SEARCHOUT 2>&1
536 1.1 lukem RC=$?
537 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
538 1.1 lukem case $RC in
539 1.1 lukem 0)
540 1.1 lukem if test x"$COUNT" != x ; then
541 1.1 lukem echo "...error: didn't bump into server-side unchecked limit (got $COUNT entries)"
542 1.1 lukem else
543 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
544 1.1 lukem fi
545 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
546 1.1 lukem exit 1
547 1.1 lukem ;;
548 1.1 lukem 11)
549 1.1 lukem echo "...bumped into unchecked administrative limit"
550 1.1 lukem ;;
551 1.1 lukem *)
552 1.1 lukem echo "ldapsearch failed ($RC)!"
553 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
554 1.1 lukem exit $RC
555 1.1 lukem ;;
556 1.1 lukem esac
557 1.1 lukem ;;
558 1.1 lukem *) echo "Skipping test for unchecked limit with $BACKEND backend." ;;
559 1.1 lukem esac
560 1.1 lukem
561 1.1 lukem echo "Testing no limits requested for limited regex..."
562 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
563 1.1 lukem -D 'cn=Foo User,ou=People,dc=example,dc=com' \
564 1.1 lukem '(objectClass=*)' > $SEARCHOUT 2>&1
565 1.1 lukem RC=$?
566 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
567 1.1 lukem case $RC in
568 1.1 lukem 0)
569 1.1 lukem if test x"$COUNT" != x ; then
570 1.1 lukem echo "...didn't bump into server-side size limit (got $COUNT entries)"
571 1.1 lukem else
572 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
573 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
574 1.1 lukem exit 1
575 1.1 lukem fi
576 1.1 lukem ;;
577 1.1 lukem 4)
578 1.1 lukem if test "x$COUNT" != "x" ; then
579 1.1 lukem echo "...bumped into server-side size limit ($COUNT)"
580 1.1 lukem else
581 1.1 lukem echo "...error: bumped into server-side size limit, but got no entries!"
582 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
583 1.1 lukem exit $RC
584 1.1 lukem fi
585 1.1 lukem ;;
586 1.1 lukem *)
587 1.1 lukem echo "ldapsearch failed ($RC)!"
588 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
589 1.1 lukem exit $RC
590 1.1 lukem ;;
591 1.1 lukem esac
592 1.1 lukem
593 1.1 lukem echo "Testing no limits requested for limited onelevel..."
594 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
595 1.1 lukem -D 'cn=Bar User,ou=People,dc=example,dc=com' \
596 1.1 lukem '(objectClass=*)' > $SEARCHOUT 2>&1
597 1.1 lukem RC=$?
598 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
599 1.1 lukem case $RC in
600 1.1 lukem 0)
601 1.1 lukem if test x"$COUNT" != x ; then
602 1.1 lukem echo "...didn't bump into server-side size limit (got $COUNT entries)"
603 1.1 lukem else
604 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
605 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
606 1.1 lukem exit 1
607 1.1 lukem fi
608 1.1 lukem ;;
609 1.1 lukem 4)
610 1.1 lukem if test "x$COUNT" != "x" ; then
611 1.1 lukem echo "...bumped into server-side size limit ($COUNT)"
612 1.1 lukem else
613 1.1 lukem echo "...error: bumped into server-side size limit, but got no entries!"
614 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
615 1.1 lukem exit $RC
616 1.1 lukem fi
617 1.1 lukem ;;
618 1.1 lukem *)
619 1.1 lukem echo "ldapsearch failed ($RC)!"
620 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
621 1.1 lukem exit $RC
622 1.1 lukem ;;
623 1.1 lukem esac
624 1.1 lukem
625 1.1 lukem echo "Testing no limit requested for limited children..."
626 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
627 1.1 lukem -D 'cn=Unchecked Limited Users,ou=Groups,dc=example,dc=com' \
628 1.1 lukem '(objectClass=*)' > $SEARCHOUT 2>&1
629 1.1 lukem RC=$?
630 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
631 1.1 lukem case $RC in
632 1.1 lukem 0)
633 1.1 lukem if test x"$COUNT" != x ; then
634 1.1 lukem echo "...didn't bump into server-side size limit (got $COUNT entries)"
635 1.1 lukem else
636 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
637 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
638 1.1 lukem exit 1
639 1.1 lukem fi
640 1.1 lukem ;;
641 1.1 lukem 4)
642 1.1 lukem if test "x$COUNT" != "x" ; then
643 1.1 lukem echo "...bumped into server-side size limit ($COUNT)"
644 1.1 lukem else
645 1.1 lukem echo "...error: bumped into server-side size limit, but got no entries!"
646 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
647 1.1 lukem exit $RC
648 1.1 lukem fi
649 1.1 lukem ;;
650 1.1 lukem *)
651 1.1 lukem echo "ldapsearch failed ($RC)!"
652 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
653 1.1 lukem exit $RC
654 1.1 lukem ;;
655 1.1 lukem esac
656 1.1 lukem
657 1.1 lukem echo "Testing no limit requested for limited subtree..."
658 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
659 1.1 lukem -D 'cn=Unchecked Limited User 3,ou=Admin,dc=example,dc=com' \
660 1.1 lukem '(objectClass=*)' > $SEARCHOUT 2>&1
661 1.1 lukem RC=$?
662 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
663 1.1 lukem case $RC in
664 1.1 lukem 0)
665 1.1 lukem if test x"$COUNT" != x ; then
666 1.1 lukem echo "...didn't bump into server-side size limit (got $COUNT entries)"
667 1.1 lukem else
668 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
669 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
670 1.1 lukem exit 1
671 1.1 lukem fi
672 1.1 lukem ;;
673 1.1 lukem 4)
674 1.1 lukem if test "x$COUNT" != "x" ; then
675 1.1 lukem echo "...bumped into server-side size limit ($COUNT)"
676 1.1 lukem else
677 1.1 lukem echo "...error: bumped into server-side size limit, but got no entries!"
678 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
679 1.1 lukem exit $RC
680 1.1 lukem fi
681 1.1 lukem ;;
682 1.1 lukem *)
683 1.1 lukem echo "ldapsearch failed ($RC)!"
684 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
685 1.1 lukem exit $RC
686 1.1 lukem ;;
687 1.1 lukem esac
688 1.1 lukem
689 1.1 lukem echo "Testing no limit requested for limited users..."
690 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
691 1.1 lukem -D 'cn=Special User,dc=example,dc=com' \
692 1.1 lukem '(objectClass=*)' > $SEARCHOUT 2>&1
693 1.1 lukem RC=$?
694 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
695 1.1 lukem case $RC in
696 1.1 lukem 0)
697 1.1 lukem if test x"$COUNT" != x ; then
698 1.1 lukem echo "...didn't bump into server-side size limit (got $COUNT entries)"
699 1.1 lukem else
700 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
701 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
702 1.1 lukem exit 1
703 1.1 lukem fi
704 1.1 lukem ;;
705 1.1 lukem 4)
706 1.1 lukem if test "x$COUNT" != "x" ; then
707 1.1 lukem echo "...bumped into server-side size limit ($COUNT)"
708 1.1 lukem else
709 1.1 lukem echo "...error: bumped into server-side size limit, but got no entries!"
710 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
711 1.1 lukem exit $RC
712 1.1 lukem fi
713 1.1 lukem ;;
714 1.1 lukem *)
715 1.1 lukem echo "ldapsearch failed ($RC)!"
716 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
717 1.1 lukem exit $RC
718 1.1 lukem ;;
719 1.1 lukem esac
720 1.1 lukem
721 1.1 lukem echo "Testing no limit requested for limited anonymous..."
722 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
723 1.1 lukem '(objectClass=*)' > $SEARCHOUT 2>&1
724 1.1 lukem RC=$?
725 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
726 1.1 lukem case $RC in
727 1.1 lukem 0)
728 1.1 lukem if test x"$COUNT" != x ; then
729 1.1 lukem echo "...didn't bump into server-side size limit (got $COUNT entries)"
730 1.1 lukem else
731 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
732 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
733 1.1 lukem exit 1
734 1.1 lukem fi
735 1.1 lukem ;;
736 1.1 lukem 4)
737 1.1 lukem if test "x$COUNT" != "x" ; then
738 1.1 lukem echo "...bumped into server-side size limit ($COUNT)"
739 1.1 lukem else
740 1.1 lukem echo "...error: bumped into server-side size limit, but got no entries!"
741 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
742 1.1 lukem exit $RC
743 1.1 lukem fi
744 1.1 lukem ;;
745 1.1 lukem *)
746 1.1 lukem echo "ldapsearch failed ($RC)!"
747 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
748 1.1 lukem exit $RC
749 1.1 lukem ;;
750 1.1 lukem esac
751 1.1 lukem
752 1.1 lukem case $BACKEND in
753 1.1 lukem bdb | hdb)
754 1.1 lukem # only bdb|hdb currently supports pagedResults control
755 1.1 lukem ;;
756 1.1 lukem *)
757 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
758 1.1 lukem
759 1.1 lukem echo ">>>>> Test succeeded"
760 1.1 lukem exit 0
761 1.1 lukem ;;
762 1.1 lukem esac
763 1.1 lukem
764 1.1 lukem if test x"$SLAPD_PAGE_SIZE" != x ; then
765 1.1 lukem PAGESIZE="$SLAPD_PAGE_SIZE"
766 1.1 lukem if test "$PAGESIZE" -le 0 ; then
767 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
768 1.1 lukem
769 1.1 lukem echo ""
770 1.1 lukem echo "Testing with pagedResults control disabled"
771 1.1 lukem echo ""
772 1.1 lukem echo ">>>>> Test succeeded"
773 1.1 lukem exit 0
774 1.1 lukem fi
775 1.1 lukem else
776 1.1 lukem PAGESIZE=5
777 1.1 lukem fi
778 1.1 lukem
779 1.1 lukem echo ""
780 1.1 lukem echo "Testing regular search limits with pagedResults control (page size $PAGESIZE)"
781 1.1 lukem echo ""
782 1.1 lukem
783 1.1 lukem echo "Testing no limits requested for unlimited ID..."
784 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
785 1.1 lukem -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
786 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' >$SEARCHOUT 2>&1
787 1.1 lukem RC=$?
788 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
789 1.1 lukem case $RC in
790 1.1 lukem 0)
791 1.1 lukem if test x"$COUNT" != x ; then
792 1.1 lukem echo "...success (got $COUNT entries)"
793 1.1 lukem else
794 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
795 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
796 1.1 lukem exit 1
797 1.1 lukem fi
798 1.1 lukem ;;
799 1.1 lukem *)
800 1.1 lukem echo "ldapsearch failed ($RC)!"
801 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
802 1.1 lukem exit $RC
803 1.1 lukem ;;
804 1.1 lukem esac
805 1.1 lukem
806 1.1 lukem SIZELIMIT=2
807 1.1 lukem echo "Testing size limit request ($SIZELIMIT) for unlimited ID..."
808 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
809 1.1 lukem -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
810 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
811 1.1 lukem RC=$?
812 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
813 1.1 lukem case $RC in
814 1.1 lukem 0)
815 1.1 lukem if test x"$COUNT" != x ; then
816 1.1 lukem if test "$COUNT" -gt "$SIZELIMIT" ; then
817 1.1 lukem echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
818 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
819 1.1 lukem exit 1
820 1.1 lukem fi
821 1.1 lukem echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)"
822 1.1 lukem else
823 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
824 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
825 1.1 lukem exit 1
826 1.1 lukem fi
827 1.1 lukem ;;
828 1.1 lukem 4)
829 1.1 lukem if test x"$COUNT" != x ; then
830 1.1 lukem if test $COUNT = $SIZELIMIT ; then
831 1.1 lukem echo "...bumped into requested size limit ($SIZELIMIT)"
832 1.1 lukem else
833 1.1 lukem echo "...error: got $COUNT entries while requesting $SIZELIMIT..."
834 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
835 1.1 lukem exit $RC
836 1.1 lukem fi
837 1.1 lukem else
838 1.1 lukem echo "...error: bumped into server-side size limit, but got no entries!"
839 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
840 1.1 lukem exit $RC
841 1.1 lukem fi
842 1.1 lukem ;;
843 1.1 lukem *)
844 1.1 lukem echo "ldapsearch failed ($RC)!"
845 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
846 1.1 lukem exit $RC
847 1.1 lukem ;;
848 1.1 lukem esac
849 1.1 lukem
850 1.1 lukem TIMELIMIT=10
851 1.1 lukem echo "Testing time limit request ($TIMELIMIT s) for unlimited ID..."
852 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -l $TIMELIMIT \
853 1.1 lukem -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
854 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
855 1.1 lukem RC=$?
856 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
857 1.1 lukem case $RC in
858 1.1 lukem 0)
859 1.1 lukem if test x"$COUNT" != x ; then
860 1.1 lukem echo "...didn't bump into the requested time limit ($TIMELIMIT s; got $COUNT entries)"
861 1.1 lukem else
862 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
863 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
864 1.1 lukem exit 1
865 1.1 lukem fi
866 1.1 lukem ;;
867 1.1 lukem 3)
868 1.1 lukem if test x"$COUNT" = x ; then
869 1.1 lukem COUNT=0
870 1.1 lukem fi
871 1.1 lukem echo "...bumped into requested time limit ($TIMELIMIT s; got $COUNT entries)"
872 1.1 lukem ;;
873 1.1 lukem *)
874 1.1 lukem echo "ldapsearch failed ($RC)!"
875 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
876 1.1 lukem exit $RC
877 1.1 lukem ;;
878 1.1 lukem esac
879 1.1 lukem
880 1.1 lukem echo "Testing no limits requested for soft limited ID..."
881 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
882 1.1 lukem -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
883 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
884 1.1 lukem RC=$?
885 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
886 1.1 lukem case $RC in
887 1.1 lukem 0)
888 1.1 lukem if test x"$COUNT" != x ; then
889 1.1 lukem echo "...didn't bump into server-side size limit (got $COUNT entries)"
890 1.1 lukem else
891 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
892 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
893 1.1 lukem exit 1
894 1.1 lukem fi
895 1.1 lukem ;;
896 1.1 lukem 4)
897 1.1 lukem if test x"$COUNT" != x ; then
898 1.1 lukem echo "...bumped into server-side size limit (got $COUNT entries)"
899 1.1 lukem else
900 1.1 lukem echo "...error: bumped into server-side size limit, but got no entries!"
901 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
902 1.1 lukem exit $RC
903 1.1 lukem fi
904 1.1 lukem ;;
905 1.1 lukem *)
906 1.1 lukem echo "ldapsearch failed ($RC)!"
907 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
908 1.1 lukem exit $RC
909 1.1 lukem ;;
910 1.1 lukem esac
911 1.1 lukem
912 1.1 lukem SIZELIMIT=2
913 1.1 lukem echo "Testing lower than soft limit request ($SIZELIMIT) for soft limited ID..."
914 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
915 1.1 lukem -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
916 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
917 1.1 lukem RC=$?
918 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
919 1.1 lukem case $RC in
920 1.1 lukem 0)
921 1.1 lukem if test x"$COUNT" != x ; then
922 1.1 lukem if test "$COUNT" -gt "$SIZELIMIT" ; then
923 1.1 lukem echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
924 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
925 1.1 lukem exit 1
926 1.1 lukem fi
927 1.1 lukem echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
928 1.1 lukem else
929 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
930 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
931 1.1 lukem exit 1
932 1.1 lukem fi
933 1.1 lukem ;;
934 1.1 lukem 4)
935 1.1 lukem if test "x$COUNT" != "x" ; then
936 1.1 lukem if test "x$SIZELIMIT" = "x$COUNT" ; then
937 1.1 lukem echo "...bumped into requested ($SIZELIMIT) size limit"
938 1.1 lukem else
939 1.1 lukem echo "...bumped into server-side size limit ($COUNT)"
940 1.1 lukem fi
941 1.1 lukem else
942 1.1 lukem echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
943 1.1 lukem fi
944 1.1 lukem ;;
945 1.1 lukem *)
946 1.1 lukem echo "ldapsearch failed ($RC)!"
947 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
948 1.1 lukem exit $RC
949 1.1 lukem ;;
950 1.1 lukem esac
951 1.1 lukem
952 1.1 lukem SIZELIMIT=100
953 1.1 lukem echo "Testing higher than soft limit request ($SIZELIMIT) for soft limited ID..."
954 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
955 1.1 lukem -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
956 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
957 1.1 lukem RC=$?
958 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
959 1.1 lukem case $RC in
960 1.1 lukem 0)
961 1.1 lukem if test x"$COUNT" != x ; then
962 1.1 lukem if test "$COUNT" -gt "$SIZELIMIT" ; then
963 1.1 lukem echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
964 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
965 1.1 lukem exit 1
966 1.1 lukem fi
967 1.1 lukem echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
968 1.1 lukem else
969 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
970 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
971 1.1 lukem exit 1
972 1.1 lukem fi
973 1.1 lukem ;;
974 1.1 lukem 4)
975 1.1 lukem if test "x$COUNT" != "x" ; then
976 1.1 lukem if test "x$SIZELIMIT" = "x$COUNT" ; then
977 1.1 lukem echo "...bumped into requested ($SIZELIMIT) size limit"
978 1.1 lukem else
979 1.1 lukem echo "...bumped into server-side size limit ($COUNT)"
980 1.1 lukem fi
981 1.1 lukem else
982 1.1 lukem echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
983 1.1 lukem fi
984 1.1 lukem ;;
985 1.1 lukem *)
986 1.1 lukem echo "ldapsearch failed ($RC)!"
987 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
988 1.1 lukem exit $RC
989 1.1 lukem ;;
990 1.1 lukem esac
991 1.1 lukem
992 1.1 lukem SIZELIMIT=2
993 1.1 lukem echo "Testing lower than hard limit request ($SIZELIMIT) for hard limited ID..."
994 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
995 1.1 lukem -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
996 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
997 1.1 lukem RC=$?
998 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
999 1.1 lukem case $RC in
1000 1.1 lukem 0)
1001 1.1 lukem if test x"$COUNT" != x ; then
1002 1.1 lukem if test "$COUNT" -gt "$SIZELIMIT" ; then
1003 1.1 lukem echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
1004 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1005 1.1 lukem exit 1
1006 1.1 lukem fi
1007 1.1 lukem echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
1008 1.1 lukem else
1009 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
1010 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1011 1.1 lukem exit 1
1012 1.1 lukem fi
1013 1.1 lukem ;;
1014 1.1 lukem 4)
1015 1.1 lukem if test x"$COUNT" != x ; then
1016 1.1 lukem if test "$COUNT" = "$SIZELIMIT" ; then
1017 1.1 lukem echo "...bumped into requested ($SIZELIMIT) size limit"
1018 1.1 lukem else
1019 1.1 lukem echo "...error: got size limit $SIZELIMIT but $COUNT entries"
1020 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1021 1.1 lukem exit $RC
1022 1.1 lukem fi
1023 1.1 lukem else
1024 1.1 lukem echo "...error: bumped into server-side size limit, but got no entries!"
1025 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1026 1.1 lukem exit $RC
1027 1.1 lukem fi
1028 1.1 lukem ;;
1029 1.1 lukem *)
1030 1.1 lukem echo "ldapsearch failed ($RC)!"
1031 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1032 1.1 lukem exit $RC
1033 1.1 lukem ;;
1034 1.1 lukem esac
1035 1.1 lukem
1036 1.1 lukem SIZELIMIT=100
1037 1.1 lukem echo "Testing higher than hard limit request ($SIZELIMIT) for hard limited ID..."
1038 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
1039 1.1 lukem -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
1040 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1041 1.1 lukem RC=$?
1042 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1043 1.1 lukem case $RC in
1044 1.1 lukem 0)
1045 1.1 lukem if test x"$COUNT" != x ; then
1046 1.1 lukem if test "$COUNT" -gt "$SIZELIMIT" ; then
1047 1.1 lukem echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
1048 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1049 1.1 lukem exit 1
1050 1.1 lukem fi
1051 1.1 lukem echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
1052 1.1 lukem else
1053 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
1054 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1055 1.1 lukem exit 1
1056 1.1 lukem fi
1057 1.1 lukem ;;
1058 1.1 lukem 4)
1059 1.1 lukem if test x"$COUNT" != x ; then
1060 1.1 lukem if test "$COUNT" = "$SIZELIMIT" ; then
1061 1.1 lukem echo "...error: bumped into requested ($SIZELIMIT) size limit"
1062 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1063 1.1 lukem exit $RC
1064 1.1 lukem else
1065 1.1 lukem echo "...got size limit $COUNT instead of requested $SIZELIMIT entries"
1066 1.1 lukem fi
1067 1.1 lukem else
1068 1.1 lukem echo "...error: bumped into server-side size limit, but got no entries!"
1069 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1070 1.1 lukem exit $RC
1071 1.1 lukem fi
1072 1.1 lukem ;;
1073 1.1 lukem # 11)
1074 1.1 lukem # echo "...bumped into hard size administrative limit"
1075 1.1 lukem # ;;
1076 1.1 lukem *)
1077 1.1 lukem echo "ldapsearch failed ($RC)!"
1078 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1079 1.1 lukem exit $RC
1080 1.1 lukem ;;
1081 1.1 lukem esac
1082 1.1 lukem
1083 1.1 lukem SIZELIMIT=max
1084 1.1 lukem echo "Testing max limit request ($SIZELIMIT) for hard limited ID..."
1085 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
1086 1.1 lukem -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
1087 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1088 1.1 lukem RC=$?
1089 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1090 1.1 lukem case $RC in
1091 1.1 lukem 0)
1092 1.1 lukem if test x"$COUNT" != x ; then
1093 1.1 lukem echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
1094 1.1 lukem else
1095 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
1096 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1097 1.1 lukem exit 1
1098 1.1 lukem fi
1099 1.1 lukem ;;
1100 1.1 lukem 4)
1101 1.1 lukem if test x"$COUNT" != x ; then
1102 1.1 lukem echo "...bumped into requested ($SIZELIMIT=$COUNT) size limit"
1103 1.1 lukem else
1104 1.1 lukem echo "...error: bumped into size limit but got no entries!"
1105 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1106 1.1 lukem exit $RC
1107 1.1 lukem fi
1108 1.1 lukem ;;
1109 1.1 lukem # 11)
1110 1.1 lukem # echo "...bumped into hard size administrative limit"
1111 1.1 lukem # ;;
1112 1.1 lukem *)
1113 1.1 lukem echo "ldapsearch failed ($RC)!"
1114 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1115 1.1 lukem exit $RC
1116 1.1 lukem ;;
1117 1.1 lukem esac
1118 1.1 lukem
1119 1.1 lukem echo "Testing lower than unchecked limit request for unchecked limited ID..."
1120 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1121 1.1 lukem -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \
1122 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(uid=uncheckedlimited)' > $SEARCHOUT 2>&1
1123 1.1 lukem RC=$?
1124 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1125 1.1 lukem case $RC in
1126 1.1 lukem 0)
1127 1.1 lukem if test x"$COUNT" != x ; then
1128 1.1 lukem echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
1129 1.1 lukem else
1130 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
1131 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1132 1.1 lukem exit 1
1133 1.1 lukem fi
1134 1.1 lukem ;;
1135 1.1 lukem # 11)
1136 1.1 lukem # echo "...bumped into unchecked administrative limit"
1137 1.1 lukem # ;;
1138 1.1 lukem *)
1139 1.1 lukem echo "ldapsearch failed ($RC)!"
1140 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1141 1.1 lukem exit $RC
1142 1.1 lukem ;;
1143 1.1 lukem esac
1144 1.1 lukem
1145 1.1 lukem echo "Testing higher than unchecked limit requested for unchecked limited ID..."
1146 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1147 1.1 lukem -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \
1148 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1149 1.1 lukem RC=$?
1150 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1151 1.1 lukem case $RC in
1152 1.1 lukem 0)
1153 1.1 lukem if test x"$COUNT" != x ; then
1154 1.1 lukem echo "...error: didn't bump into server-side unchecked limit (got $COUNT entries)"
1155 1.1 lukem else
1156 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
1157 1.1 lukem fi
1158 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1159 1.1 lukem exit 1
1160 1.1 lukem ;;
1161 1.1 lukem 11)
1162 1.1 lukem echo "...bumped into unchecked administrative limit"
1163 1.1 lukem ;;
1164 1.1 lukem *)
1165 1.1 lukem echo "ldapsearch failed ($RC)!"
1166 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1167 1.1 lukem exit $RC
1168 1.1 lukem ;;
1169 1.1 lukem esac
1170 1.1 lukem
1171 1.1 lukem echo ""
1172 1.1 lukem echo "Testing specific search limits with pagedResults control"
1173 1.1 lukem echo ""
1174 1.1 lukem
1175 1.1 lukem echo "Testing no limit requested for unlimited page size ID..."
1176 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1177 1.1 lukem -D 'cn=Unlimited User,ou=Paged Results Users,dc=example,dc=com' \
1178 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1179 1.1 lukem RC=$?
1180 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1181 1.1 lukem case $RC in
1182 1.1 lukem 0)
1183 1.1 lukem if test x"$COUNT" != x ; then
1184 1.1 lukem echo "...success; didn't bump into server-side size limit (got $COUNT entries)"
1185 1.1 lukem else
1186 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
1187 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1188 1.1 lukem exit 1
1189 1.1 lukem fi
1190 1.1 lukem ;;
1191 1.1 lukem 4)
1192 1.1 lukem if test x"$COUNT" != x ; then
1193 1.1 lukem echo "...bumped into server-side size limit (got $COUNT entries)"
1194 1.1 lukem else
1195 1.1 lukem echo "...error: bumped into server-side size limit, but got no entries!"
1196 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1197 1.1 lukem exit $RC
1198 1.1 lukem fi
1199 1.1 lukem ;;
1200 1.1 lukem *)
1201 1.1 lukem echo "ldapsearch failed ($RC)!"
1202 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1203 1.1 lukem exit $RC
1204 1.1 lukem ;;
1205 1.1 lukem esac
1206 1.1 lukem
1207 1.1 lukem echo "Testing no limit requested for limited page size ID..."
1208 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1209 1.1 lukem -D 'cn=Page Size Limited User,ou=Paged Results Users,dc=example,dc=com' \
1210 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1211 1.1 lukem RC=$?
1212 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1213 1.1 lukem case $RC in
1214 1.1 lukem 0)
1215 1.1 lukem echo "...success; didn't bump into server-side page size limit (got $COUNT entries)"
1216 1.1 lukem ;;
1217 1.1 lukem 4)
1218 1.1 lukem echo "...bumped into page size limit ($COUNT)"
1219 1.1 lukem ;;
1220 1.1 lukem 11)
1221 1.1 lukem echo "...bumped into page size administrative limit"
1222 1.1 lukem ;;
1223 1.1 lukem *)
1224 1.1 lukem echo "ldapsearch failed ($RC)!"
1225 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1226 1.1 lukem exit $RC
1227 1.1 lukem ;;
1228 1.1 lukem esac
1229 1.1 lukem
1230 1.1 lukem echo "Testing no limit requested for pagedResults disabled ID..."
1231 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1232 1.1 lukem -D 'cn=Paged Results Disabled User,ou=Paged Results Users,dc=example,dc=com' \
1233 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1234 1.1 lukem RC=$?
1235 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1236 1.1 lukem case $RC in
1237 1.1 lukem 0)
1238 1.1 lukem echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
1239 1.1 lukem ;;
1240 1.1 lukem 4)
1241 1.1 lukem echo "...bumped into server-side size limit ($COUNT)"
1242 1.1 lukem ;;
1243 1.1 lukem 11)
1244 1.1 lukem echo "...bumped into pagedResults disabled administrative limit"
1245 1.1 lukem ;;
1246 1.1 lukem *)
1247 1.1 lukem echo "ldapsearch failed ($RC)!"
1248 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1249 1.1 lukem exit $RC
1250 1.1 lukem ;;
1251 1.1 lukem esac
1252 1.1 lukem
1253 1.1 lukem echo "Testing no limit requested for pagedResults total count limited ID..."
1254 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1255 1.1 lukem -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1256 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1257 1.1 lukem RC=$?
1258 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1259 1.1 lukem case $RC in
1260 1.1 lukem 0)
1261 1.1 lukem echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
1262 1.1 lukem ;;
1263 1.1 lukem 4)
1264 1.1 lukem echo "...bumped into server-side size limit ($COUNT)"
1265 1.1 lukem ;;
1266 1.1 lukem 11)
1267 1.1 lukem echo "...bumped into pagedResults total count administrative limit"
1268 1.1 lukem ;;
1269 1.1 lukem *)
1270 1.1 lukem echo "ldapsearch failed ($RC)!"
1271 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1272 1.1 lukem exit $RC
1273 1.1 lukem ;;
1274 1.1 lukem esac
1275 1.1 lukem
1276 1.1 lukem SIZELIMIT=8
1277 1.1 lukem echo "Testing higher than hard but lower then total count limit requested for pagedResults total count limited ID..."
1278 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1279 1.1 lukem -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1280 1.1 lukem -z $SIZELIMIT -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1281 1.1 lukem RC=$?
1282 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1283 1.1 lukem case $RC in
1284 1.1 lukem 0)
1285 1.1 lukem echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side unchecked limit (got $COUNT entries)"
1286 1.1 lukem ;;
1287 1.1 lukem 4)
1288 1.1 lukem if test "x$COUNT" != "x" ; then
1289 1.1 lukem if test "x$SIZELIMIT" = "x$COUNT" ; then
1290 1.1 lukem echo "...bumped into requested ($SIZELIMIT) size limit"
1291 1.1 lukem else
1292 1.1 lukem echo "...bumped into server-side size limit ($COUNT)"
1293 1.1 lukem fi
1294 1.1 lukem else
1295 1.1 lukem echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
1296 1.1 lukem fi
1297 1.1 lukem ;;
1298 1.1 lukem 11)
1299 1.1 lukem echo "...bumped into either hard size or pagedResults total count administrative limit"
1300 1.1 lukem ;;
1301 1.1 lukem *)
1302 1.1 lukem echo "ldapsearch failed ($RC)!"
1303 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1304 1.1 lukem exit $RC
1305 1.1 lukem ;;
1306 1.1 lukem esac
1307 1.1 lukem
1308 1.1 lukem SIZELIMIT=15
1309 1.1 lukem echo "Testing higher than total count limit requested for pagedResults total count limited ID..."
1310 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1311 1.1 lukem -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1312 1.1 lukem -z $SIZELIMIT -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1313 1.1 lukem RC=$?
1314 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1315 1.1 lukem case $RC in
1316 1.1 lukem 0)
1317 1.1 lukem echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side unchecked limit (got $COUNT entries)"
1318 1.1 lukem ;;
1319 1.1 lukem 4)
1320 1.1 lukem if test "x$COUNT" != "x" ; then
1321 1.1 lukem if test "x$SIZELIMIT" = "x$COUNT" ; then
1322 1.1 lukem echo "...bumped into requested ($SIZELIMIT) size limit"
1323 1.1 lukem else
1324 1.1 lukem echo "...bumped into server-side size limit ($COUNT)"
1325 1.1 lukem fi
1326 1.1 lukem else
1327 1.1 lukem echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
1328 1.1 lukem fi
1329 1.1 lukem ;;
1330 1.1 lukem 11)
1331 1.1 lukem echo "...bumped into pagedResults total count administrative limit"
1332 1.1 lukem ;;
1333 1.1 lukem *)
1334 1.1 lukem echo "ldapsearch failed ($RC)!"
1335 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1336 1.1 lukem exit $RC
1337 1.1 lukem ;;
1338 1.1 lukem esac
1339 1.1 lukem
1340 1.1 lukem SIZELIMIT=max
1341 1.1 lukem echo "Testing max limit requested for pagedResults total count limited ID..."
1342 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1343 1.1 lukem -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1344 1.1 lukem -z $SIZELIMIT -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1345 1.1 lukem RC=$?
1346 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1347 1.1 lukem case $RC in
1348 1.1 lukem 0)
1349 1.1 lukem echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side unchecked limit (got $COUNT entries)"
1350 1.1 lukem ;;
1351 1.1 lukem 4)
1352 1.1 lukem if test "x$COUNT" != "x" ; then
1353 1.1 lukem if test "x$SIZELIMIT" = "x$COUNT" ; then
1354 1.1 lukem echo "...bumped into requested ($SIZELIMIT) size limit"
1355 1.1 lukem else
1356 1.1 lukem echo "...bumped into server-side size limit ($COUNT)"
1357 1.1 lukem fi
1358 1.1 lukem else
1359 1.1 lukem echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
1360 1.1 lukem fi
1361 1.1 lukem ;;
1362 1.1 lukem 11)
1363 1.1 lukem echo "...bumped into pagedResults total count administrative limit"
1364 1.1 lukem ;;
1365 1.1 lukem *)
1366 1.1 lukem echo "ldapsearch failed ($RC)!"
1367 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1368 1.1 lukem exit $RC
1369 1.1 lukem ;;
1370 1.1 lukem esac
1371 1.1 lukem
1372 1.1 lukem # ITS#4479
1373 1.1 lukem PAGESIZE=1
1374 1.1 lukem SIZELIMIT=2
1375 1.1 lukem echo "Testing size limit request ($SIZELIMIT) for unlimited ID and pagesize=$PAGESIZE..."
1376 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
1377 1.1 lukem -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
1378 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1379 1.1 lukem RC=$?
1380 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1381 1.1 lukem case $RC in
1382 1.1 lukem 0)
1383 1.1 lukem if test x"$COUNT" != x ; then
1384 1.1 lukem if test "$COUNT" -gt "$SIZELIMIT" ; then
1385 1.1 lukem echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
1386 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1387 1.1 lukem exit 1
1388 1.1 lukem fi
1389 1.1 lukem echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)"
1390 1.1 lukem else
1391 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
1392 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1393 1.1 lukem exit 1
1394 1.1 lukem fi
1395 1.1 lukem ;;
1396 1.1 lukem 4)
1397 1.1 lukem if test x"$COUNT" != x ; then
1398 1.1 lukem if test $COUNT = $SIZELIMIT ; then
1399 1.1 lukem echo "...bumped into requested size limit ($SIZELIMIT)"
1400 1.1 lukem else
1401 1.1 lukem echo "...error: got $COUNT entries while requesting $SIZELIMIT..."
1402 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1403 1.1 lukem exit $RC
1404 1.1 lukem fi
1405 1.1 lukem else
1406 1.1 lukem echo "...error: bumped into server-side size limit, but got no entries!"
1407 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1408 1.1 lukem exit $RC
1409 1.1 lukem fi
1410 1.1 lukem ;;
1411 1.1 lukem *)
1412 1.1 lukem echo "ldapsearch failed ($RC)!"
1413 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1414 1.1 lukem exit $RC
1415 1.1 lukem ;;
1416 1.1 lukem esac
1417 1.1 lukem
1418 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1419 1.1 lukem
1420 1.1 lukem echo ">>>>> Test succeeded"
1421 1.1 lukem
1422 1.1 lukem test $KILLSERVERS != no && wait
1423 1.1 lukem
1424 1.1 lukem exit 0
1425