test025-limits revision 1.1.1.4 1 1.1 lukem #! /bin/sh
2 1.1.1.4 tron # $OpenLDAP$
3 1.1 lukem ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 1.1 lukem ##
5 1.1.1.4 tron ## Copyright 1998-2014 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.1.4 tron if test $INDEXDB = indexdb ; then
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.1.4 tron else
558 1.1.1.4 tron echo "Skipping test for unchecked limit with $BACKEND backend."
559 1.1.1.4 tron fi
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.1.4 tron if test $MAINDB != maindb ; then
753 1.1.1.4 tron # only bdb|hdb|mdb currently supports pagedResults control
754 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
755 1.1 lukem
756 1.1 lukem echo ">>>>> Test succeeded"
757 1.1 lukem exit 0
758 1.1.1.4 tron fi
759 1.1 lukem
760 1.1 lukem if test x"$SLAPD_PAGE_SIZE" != x ; then
761 1.1 lukem PAGESIZE="$SLAPD_PAGE_SIZE"
762 1.1 lukem if test "$PAGESIZE" -le 0 ; then
763 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
764 1.1 lukem
765 1.1 lukem echo ""
766 1.1 lukem echo "Testing with pagedResults control disabled"
767 1.1 lukem echo ""
768 1.1 lukem echo ">>>>> Test succeeded"
769 1.1 lukem exit 0
770 1.1 lukem fi
771 1.1 lukem else
772 1.1 lukem PAGESIZE=5
773 1.1 lukem fi
774 1.1 lukem
775 1.1 lukem echo ""
776 1.1 lukem echo "Testing regular search limits with pagedResults control (page size $PAGESIZE)"
777 1.1 lukem echo ""
778 1.1 lukem
779 1.1 lukem echo "Testing no limits requested for unlimited ID..."
780 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
781 1.1 lukem -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
782 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' >$SEARCHOUT 2>&1
783 1.1 lukem RC=$?
784 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
785 1.1 lukem case $RC in
786 1.1 lukem 0)
787 1.1 lukem if test x"$COUNT" != x ; then
788 1.1 lukem echo "...success (got $COUNT entries)"
789 1.1 lukem else
790 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
791 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
792 1.1 lukem exit 1
793 1.1 lukem fi
794 1.1 lukem ;;
795 1.1 lukem *)
796 1.1 lukem echo "ldapsearch failed ($RC)!"
797 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
798 1.1 lukem exit $RC
799 1.1 lukem ;;
800 1.1 lukem esac
801 1.1 lukem
802 1.1 lukem SIZELIMIT=2
803 1.1 lukem echo "Testing size limit request ($SIZELIMIT) for unlimited ID..."
804 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
805 1.1 lukem -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
806 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
807 1.1 lukem RC=$?
808 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
809 1.1 lukem case $RC in
810 1.1 lukem 0)
811 1.1 lukem if test x"$COUNT" != x ; then
812 1.1 lukem if test "$COUNT" -gt "$SIZELIMIT" ; then
813 1.1 lukem echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
814 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
815 1.1 lukem exit 1
816 1.1 lukem fi
817 1.1 lukem echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)"
818 1.1 lukem else
819 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
820 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
821 1.1 lukem exit 1
822 1.1 lukem fi
823 1.1 lukem ;;
824 1.1 lukem 4)
825 1.1 lukem if test x"$COUNT" != x ; then
826 1.1 lukem if test $COUNT = $SIZELIMIT ; then
827 1.1 lukem echo "...bumped into requested size limit ($SIZELIMIT)"
828 1.1 lukem else
829 1.1 lukem echo "...error: got $COUNT entries while requesting $SIZELIMIT..."
830 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
831 1.1 lukem exit $RC
832 1.1 lukem fi
833 1.1 lukem else
834 1.1 lukem echo "...error: bumped into server-side size limit, but got no entries!"
835 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
836 1.1 lukem exit $RC
837 1.1 lukem fi
838 1.1 lukem ;;
839 1.1 lukem *)
840 1.1 lukem echo "ldapsearch failed ($RC)!"
841 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
842 1.1 lukem exit $RC
843 1.1 lukem ;;
844 1.1 lukem esac
845 1.1 lukem
846 1.1 lukem TIMELIMIT=10
847 1.1 lukem echo "Testing time limit request ($TIMELIMIT s) for unlimited ID..."
848 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -l $TIMELIMIT \
849 1.1 lukem -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
850 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
851 1.1 lukem RC=$?
852 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
853 1.1 lukem case $RC in
854 1.1 lukem 0)
855 1.1 lukem if test x"$COUNT" != x ; then
856 1.1 lukem echo "...didn't bump into the requested time limit ($TIMELIMIT s; got $COUNT entries)"
857 1.1 lukem else
858 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
859 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
860 1.1 lukem exit 1
861 1.1 lukem fi
862 1.1 lukem ;;
863 1.1 lukem 3)
864 1.1 lukem if test x"$COUNT" = x ; then
865 1.1 lukem COUNT=0
866 1.1 lukem fi
867 1.1 lukem echo "...bumped into requested time limit ($TIMELIMIT s; got $COUNT entries)"
868 1.1 lukem ;;
869 1.1 lukem *)
870 1.1 lukem echo "ldapsearch failed ($RC)!"
871 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
872 1.1 lukem exit $RC
873 1.1 lukem ;;
874 1.1 lukem esac
875 1.1 lukem
876 1.1 lukem echo "Testing no limits requested for soft limited ID..."
877 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
878 1.1 lukem -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
879 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
880 1.1 lukem RC=$?
881 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
882 1.1 lukem case $RC in
883 1.1 lukem 0)
884 1.1 lukem if test x"$COUNT" != x ; then
885 1.1 lukem echo "...didn't bump into server-side size limit (got $COUNT entries)"
886 1.1 lukem else
887 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
888 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
889 1.1 lukem exit 1
890 1.1 lukem fi
891 1.1 lukem ;;
892 1.1 lukem 4)
893 1.1 lukem if test x"$COUNT" != x ; then
894 1.1 lukem echo "...bumped into server-side size limit (got $COUNT entries)"
895 1.1 lukem else
896 1.1 lukem echo "...error: bumped into server-side size limit, but got no entries!"
897 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
898 1.1 lukem exit $RC
899 1.1 lukem fi
900 1.1 lukem ;;
901 1.1 lukem *)
902 1.1 lukem echo "ldapsearch failed ($RC)!"
903 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
904 1.1 lukem exit $RC
905 1.1 lukem ;;
906 1.1 lukem esac
907 1.1 lukem
908 1.1 lukem SIZELIMIT=2
909 1.1 lukem echo "Testing lower than soft limit request ($SIZELIMIT) for soft limited ID..."
910 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
911 1.1 lukem -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
912 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
913 1.1 lukem RC=$?
914 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
915 1.1 lukem case $RC in
916 1.1 lukem 0)
917 1.1 lukem if test x"$COUNT" != x ; then
918 1.1 lukem if test "$COUNT" -gt "$SIZELIMIT" ; then
919 1.1 lukem echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
920 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
921 1.1 lukem exit 1
922 1.1 lukem fi
923 1.1 lukem echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
924 1.1 lukem else
925 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
926 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
927 1.1 lukem exit 1
928 1.1 lukem fi
929 1.1 lukem ;;
930 1.1 lukem 4)
931 1.1 lukem if test "x$COUNT" != "x" ; then
932 1.1 lukem if test "x$SIZELIMIT" = "x$COUNT" ; then
933 1.1 lukem echo "...bumped into requested ($SIZELIMIT) size limit"
934 1.1 lukem else
935 1.1 lukem echo "...bumped into server-side size limit ($COUNT)"
936 1.1 lukem fi
937 1.1 lukem else
938 1.1 lukem echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
939 1.1 lukem fi
940 1.1 lukem ;;
941 1.1 lukem *)
942 1.1 lukem echo "ldapsearch failed ($RC)!"
943 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
944 1.1 lukem exit $RC
945 1.1 lukem ;;
946 1.1 lukem esac
947 1.1 lukem
948 1.1 lukem SIZELIMIT=100
949 1.1 lukem echo "Testing higher than soft limit request ($SIZELIMIT) for soft limited ID..."
950 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
951 1.1 lukem -D 'cn=Soft Limited User,ou=People,dc=example,dc=com' \
952 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
953 1.1 lukem RC=$?
954 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
955 1.1 lukem case $RC in
956 1.1 lukem 0)
957 1.1 lukem if test x"$COUNT" != x ; then
958 1.1 lukem if test "$COUNT" -gt "$SIZELIMIT" ; then
959 1.1 lukem echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
960 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
961 1.1 lukem exit 1
962 1.1 lukem fi
963 1.1 lukem echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
964 1.1 lukem else
965 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
966 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
967 1.1 lukem exit 1
968 1.1 lukem fi
969 1.1 lukem ;;
970 1.1 lukem 4)
971 1.1 lukem if test "x$COUNT" != "x" ; then
972 1.1 lukem if test "x$SIZELIMIT" = "x$COUNT" ; then
973 1.1 lukem echo "...bumped into requested ($SIZELIMIT) size limit"
974 1.1 lukem else
975 1.1 lukem echo "...bumped into server-side size limit ($COUNT)"
976 1.1 lukem fi
977 1.1 lukem else
978 1.1 lukem echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
979 1.1 lukem fi
980 1.1 lukem ;;
981 1.1 lukem *)
982 1.1 lukem echo "ldapsearch failed ($RC)!"
983 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
984 1.1 lukem exit $RC
985 1.1 lukem ;;
986 1.1 lukem esac
987 1.1 lukem
988 1.1 lukem SIZELIMIT=2
989 1.1 lukem echo "Testing lower than hard limit request ($SIZELIMIT) for hard limited ID..."
990 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
991 1.1 lukem -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
992 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
993 1.1 lukem RC=$?
994 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
995 1.1 lukem case $RC in
996 1.1 lukem 0)
997 1.1 lukem if test x"$COUNT" != x ; then
998 1.1 lukem if test "$COUNT" -gt "$SIZELIMIT" ; then
999 1.1 lukem echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
1000 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1001 1.1 lukem exit 1
1002 1.1 lukem fi
1003 1.1 lukem echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
1004 1.1 lukem else
1005 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
1006 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1007 1.1 lukem exit 1
1008 1.1 lukem fi
1009 1.1 lukem ;;
1010 1.1 lukem 4)
1011 1.1 lukem if test x"$COUNT" != x ; then
1012 1.1 lukem if test "$COUNT" = "$SIZELIMIT" ; then
1013 1.1 lukem echo "...bumped into requested ($SIZELIMIT) size limit"
1014 1.1 lukem else
1015 1.1 lukem echo "...error: got size limit $SIZELIMIT but $COUNT entries"
1016 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1017 1.1 lukem exit $RC
1018 1.1 lukem fi
1019 1.1 lukem else
1020 1.1 lukem echo "...error: bumped into server-side size limit, but got no entries!"
1021 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1022 1.1 lukem exit $RC
1023 1.1 lukem fi
1024 1.1 lukem ;;
1025 1.1 lukem *)
1026 1.1 lukem echo "ldapsearch failed ($RC)!"
1027 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1028 1.1 lukem exit $RC
1029 1.1 lukem ;;
1030 1.1 lukem esac
1031 1.1 lukem
1032 1.1 lukem SIZELIMIT=100
1033 1.1 lukem echo "Testing higher than hard limit request ($SIZELIMIT) for hard limited ID..."
1034 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
1035 1.1 lukem -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
1036 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1037 1.1 lukem RC=$?
1038 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1039 1.1 lukem case $RC in
1040 1.1 lukem 0)
1041 1.1 lukem if test x"$COUNT" != x ; then
1042 1.1 lukem if test "$COUNT" -gt "$SIZELIMIT" ; then
1043 1.1 lukem echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
1044 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1045 1.1 lukem exit 1
1046 1.1 lukem fi
1047 1.1 lukem echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
1048 1.1 lukem else
1049 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
1050 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1051 1.1 lukem exit 1
1052 1.1 lukem fi
1053 1.1 lukem ;;
1054 1.1 lukem 4)
1055 1.1 lukem if test x"$COUNT" != x ; then
1056 1.1 lukem if test "$COUNT" = "$SIZELIMIT" ; then
1057 1.1 lukem echo "...error: bumped into requested ($SIZELIMIT) size limit"
1058 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1059 1.1 lukem exit $RC
1060 1.1 lukem else
1061 1.1 lukem echo "...got size limit $COUNT instead of requested $SIZELIMIT entries"
1062 1.1 lukem fi
1063 1.1 lukem else
1064 1.1 lukem echo "...error: bumped into server-side size limit, but got no entries!"
1065 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1066 1.1 lukem exit $RC
1067 1.1 lukem fi
1068 1.1 lukem ;;
1069 1.1 lukem # 11)
1070 1.1 lukem # echo "...bumped into hard size administrative limit"
1071 1.1 lukem # ;;
1072 1.1 lukem *)
1073 1.1 lukem echo "ldapsearch failed ($RC)!"
1074 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1075 1.1 lukem exit $RC
1076 1.1 lukem ;;
1077 1.1 lukem esac
1078 1.1 lukem
1079 1.1 lukem SIZELIMIT=max
1080 1.1 lukem echo "Testing max limit request ($SIZELIMIT) for hard limited ID..."
1081 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
1082 1.1 lukem -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \
1083 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1084 1.1 lukem RC=$?
1085 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1086 1.1 lukem case $RC in
1087 1.1 lukem 0)
1088 1.1 lukem if test x"$COUNT" != x ; then
1089 1.1 lukem echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)"
1090 1.1 lukem else
1091 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
1092 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1093 1.1 lukem exit 1
1094 1.1 lukem fi
1095 1.1 lukem ;;
1096 1.1 lukem 4)
1097 1.1 lukem if test x"$COUNT" != x ; then
1098 1.1 lukem echo "...bumped into requested ($SIZELIMIT=$COUNT) size limit"
1099 1.1 lukem else
1100 1.1 lukem echo "...error: bumped into size limit but got no entries!"
1101 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1102 1.1 lukem exit $RC
1103 1.1 lukem fi
1104 1.1 lukem ;;
1105 1.1 lukem # 11)
1106 1.1 lukem # echo "...bumped into hard size administrative limit"
1107 1.1 lukem # ;;
1108 1.1 lukem *)
1109 1.1 lukem echo "ldapsearch failed ($RC)!"
1110 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1111 1.1 lukem exit $RC
1112 1.1 lukem ;;
1113 1.1 lukem esac
1114 1.1 lukem
1115 1.1 lukem echo "Testing lower than unchecked limit request for unchecked limited ID..."
1116 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1117 1.1 lukem -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \
1118 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(uid=uncheckedlimited)' > $SEARCHOUT 2>&1
1119 1.1 lukem RC=$?
1120 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1121 1.1 lukem case $RC in
1122 1.1 lukem 0)
1123 1.1 lukem if test x"$COUNT" != x ; then
1124 1.1 lukem echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
1125 1.1 lukem else
1126 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
1127 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1128 1.1 lukem exit 1
1129 1.1 lukem fi
1130 1.1 lukem ;;
1131 1.1 lukem # 11)
1132 1.1 lukem # echo "...bumped into unchecked administrative limit"
1133 1.1 lukem # ;;
1134 1.1 lukem *)
1135 1.1 lukem echo "ldapsearch failed ($RC)!"
1136 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1137 1.1 lukem exit $RC
1138 1.1 lukem ;;
1139 1.1 lukem esac
1140 1.1 lukem
1141 1.1 lukem echo "Testing higher than unchecked limit requested for unchecked limited ID..."
1142 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1143 1.1 lukem -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \
1144 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1145 1.1 lukem RC=$?
1146 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1147 1.1 lukem case $RC in
1148 1.1 lukem 0)
1149 1.1 lukem if test x"$COUNT" != x ; then
1150 1.1 lukem echo "...error: didn't bump into server-side unchecked limit (got $COUNT entries)"
1151 1.1 lukem else
1152 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
1153 1.1 lukem fi
1154 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1155 1.1 lukem exit 1
1156 1.1 lukem ;;
1157 1.1 lukem 11)
1158 1.1 lukem echo "...bumped into unchecked administrative limit"
1159 1.1 lukem ;;
1160 1.1 lukem *)
1161 1.1 lukem echo "ldapsearch failed ($RC)!"
1162 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1163 1.1 lukem exit $RC
1164 1.1 lukem ;;
1165 1.1 lukem esac
1166 1.1 lukem
1167 1.1 lukem echo ""
1168 1.1 lukem echo "Testing specific search limits with pagedResults control"
1169 1.1 lukem echo ""
1170 1.1 lukem
1171 1.1 lukem echo "Testing no limit requested for unlimited page size ID..."
1172 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1173 1.1 lukem -D 'cn=Unlimited User,ou=Paged Results Users,dc=example,dc=com' \
1174 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1175 1.1 lukem RC=$?
1176 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1177 1.1 lukem case $RC in
1178 1.1 lukem 0)
1179 1.1 lukem if test x"$COUNT" != x ; then
1180 1.1 lukem echo "...success; didn't bump into server-side size limit (got $COUNT entries)"
1181 1.1 lukem else
1182 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
1183 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1184 1.1 lukem exit 1
1185 1.1 lukem fi
1186 1.1 lukem ;;
1187 1.1 lukem 4)
1188 1.1 lukem if test x"$COUNT" != x ; then
1189 1.1 lukem echo "...bumped into server-side size limit (got $COUNT entries)"
1190 1.1 lukem else
1191 1.1 lukem echo "...error: bumped into server-side size limit, but got no entries!"
1192 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1193 1.1 lukem exit $RC
1194 1.1 lukem fi
1195 1.1 lukem ;;
1196 1.1 lukem *)
1197 1.1 lukem echo "ldapsearch failed ($RC)!"
1198 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1199 1.1 lukem exit $RC
1200 1.1 lukem ;;
1201 1.1 lukem esac
1202 1.1 lukem
1203 1.1 lukem echo "Testing no limit requested for limited page size ID..."
1204 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1205 1.1 lukem -D 'cn=Page Size Limited User,ou=Paged Results Users,dc=example,dc=com' \
1206 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1207 1.1 lukem RC=$?
1208 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1209 1.1 lukem case $RC in
1210 1.1 lukem 0)
1211 1.1 lukem echo "...success; didn't bump into server-side page size limit (got $COUNT entries)"
1212 1.1 lukem ;;
1213 1.1 lukem 4)
1214 1.1 lukem echo "...bumped into page size limit ($COUNT)"
1215 1.1 lukem ;;
1216 1.1 lukem 11)
1217 1.1 lukem echo "...bumped into page size administrative limit"
1218 1.1 lukem ;;
1219 1.1 lukem *)
1220 1.1 lukem echo "ldapsearch failed ($RC)!"
1221 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1222 1.1 lukem exit $RC
1223 1.1 lukem ;;
1224 1.1 lukem esac
1225 1.1 lukem
1226 1.1 lukem echo "Testing no limit requested for pagedResults disabled ID..."
1227 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1228 1.1 lukem -D 'cn=Paged Results Disabled User,ou=Paged Results Users,dc=example,dc=com' \
1229 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1230 1.1 lukem RC=$?
1231 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1232 1.1 lukem case $RC in
1233 1.1 lukem 0)
1234 1.1 lukem echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
1235 1.1 lukem ;;
1236 1.1 lukem 4)
1237 1.1 lukem echo "...bumped into server-side size limit ($COUNT)"
1238 1.1 lukem ;;
1239 1.1 lukem 11)
1240 1.1 lukem echo "...bumped into pagedResults disabled administrative limit"
1241 1.1 lukem ;;
1242 1.1 lukem *)
1243 1.1 lukem echo "ldapsearch failed ($RC)!"
1244 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1245 1.1 lukem exit $RC
1246 1.1 lukem ;;
1247 1.1 lukem esac
1248 1.1 lukem
1249 1.1 lukem echo "Testing no limit requested for pagedResults total count limited ID..."
1250 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1251 1.1 lukem -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1252 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1253 1.1 lukem RC=$?
1254 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1255 1.1 lukem case $RC in
1256 1.1 lukem 0)
1257 1.1 lukem echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)"
1258 1.1 lukem ;;
1259 1.1 lukem 4)
1260 1.1 lukem echo "...bumped into server-side size limit ($COUNT)"
1261 1.1 lukem ;;
1262 1.1 lukem 11)
1263 1.1 lukem echo "...bumped into pagedResults total count administrative limit"
1264 1.1 lukem ;;
1265 1.1 lukem *)
1266 1.1 lukem echo "ldapsearch failed ($RC)!"
1267 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1268 1.1 lukem exit $RC
1269 1.1 lukem ;;
1270 1.1 lukem esac
1271 1.1 lukem
1272 1.1 lukem SIZELIMIT=8
1273 1.1 lukem echo "Testing higher than hard but lower then total count limit requested for pagedResults total count limited ID..."
1274 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1275 1.1 lukem -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1276 1.1 lukem -z $SIZELIMIT -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1277 1.1 lukem RC=$?
1278 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1279 1.1 lukem case $RC in
1280 1.1 lukem 0)
1281 1.1 lukem echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side unchecked limit (got $COUNT entries)"
1282 1.1 lukem ;;
1283 1.1 lukem 4)
1284 1.1 lukem if test "x$COUNT" != "x" ; then
1285 1.1 lukem if test "x$SIZELIMIT" = "x$COUNT" ; then
1286 1.1 lukem echo "...bumped into requested ($SIZELIMIT) size limit"
1287 1.1 lukem else
1288 1.1 lukem echo "...bumped into server-side size limit ($COUNT)"
1289 1.1 lukem fi
1290 1.1 lukem else
1291 1.1 lukem echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
1292 1.1 lukem fi
1293 1.1 lukem ;;
1294 1.1 lukem 11)
1295 1.1 lukem echo "...bumped into either hard size or pagedResults total count administrative limit"
1296 1.1 lukem ;;
1297 1.1 lukem *)
1298 1.1 lukem echo "ldapsearch failed ($RC)!"
1299 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1300 1.1 lukem exit $RC
1301 1.1 lukem ;;
1302 1.1 lukem esac
1303 1.1 lukem
1304 1.1 lukem SIZELIMIT=15
1305 1.1 lukem echo "Testing higher than total count limit requested for pagedResults total count limited ID..."
1306 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1307 1.1 lukem -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1308 1.1 lukem -z $SIZELIMIT -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1309 1.1 lukem RC=$?
1310 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1311 1.1 lukem case $RC in
1312 1.1 lukem 0)
1313 1.1 lukem echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side unchecked limit (got $COUNT entries)"
1314 1.1 lukem ;;
1315 1.1 lukem 4)
1316 1.1 lukem if test "x$COUNT" != "x" ; then
1317 1.1 lukem if test "x$SIZELIMIT" = "x$COUNT" ; then
1318 1.1 lukem echo "...bumped into requested ($SIZELIMIT) size limit"
1319 1.1 lukem else
1320 1.1 lukem echo "...bumped into server-side size limit ($COUNT)"
1321 1.1 lukem fi
1322 1.1 lukem else
1323 1.1 lukem echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
1324 1.1 lukem fi
1325 1.1 lukem ;;
1326 1.1 lukem 11)
1327 1.1 lukem echo "...bumped into pagedResults total count administrative limit"
1328 1.1 lukem ;;
1329 1.1 lukem *)
1330 1.1 lukem echo "ldapsearch failed ($RC)!"
1331 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1332 1.1 lukem exit $RC
1333 1.1 lukem ;;
1334 1.1 lukem esac
1335 1.1 lukem
1336 1.1 lukem SIZELIMIT=max
1337 1.1 lukem echo "Testing max limit requested for pagedResults total count limited ID..."
1338 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \
1339 1.1 lukem -D 'cn=Paged Results Limited User,ou=Paged Results Users,dc=example,dc=com' \
1340 1.1 lukem -z $SIZELIMIT -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1341 1.1 lukem RC=$?
1342 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1343 1.1 lukem case $RC in
1344 1.1 lukem 0)
1345 1.1 lukem echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side unchecked limit (got $COUNT entries)"
1346 1.1 lukem ;;
1347 1.1 lukem 4)
1348 1.1 lukem if test "x$COUNT" != "x" ; then
1349 1.1 lukem if test "x$SIZELIMIT" = "x$COUNT" ; then
1350 1.1 lukem echo "...bumped into requested ($SIZELIMIT) size limit"
1351 1.1 lukem else
1352 1.1 lukem echo "...bumped into server-side size limit ($COUNT)"
1353 1.1 lukem fi
1354 1.1 lukem else
1355 1.1 lukem echo "...bumped into either requested ($SIZELIMIT) or server-side size limit"
1356 1.1 lukem fi
1357 1.1 lukem ;;
1358 1.1 lukem 11)
1359 1.1 lukem echo "...bumped into pagedResults total count administrative limit"
1360 1.1 lukem ;;
1361 1.1 lukem *)
1362 1.1 lukem echo "ldapsearch failed ($RC)!"
1363 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1364 1.1 lukem exit $RC
1365 1.1 lukem ;;
1366 1.1 lukem esac
1367 1.1 lukem
1368 1.1 lukem # ITS#4479
1369 1.1 lukem PAGESIZE=1
1370 1.1 lukem SIZELIMIT=2
1371 1.1 lukem echo "Testing size limit request ($SIZELIMIT) for unlimited ID and pagesize=$PAGESIZE..."
1372 1.1 lukem $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \
1373 1.1 lukem -D 'cn=Unlimited User,ou=People,dc=example,dc=com' \
1374 1.1 lukem -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1
1375 1.1 lukem RC=$?
1376 1.1 lukem COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT`
1377 1.1 lukem case $RC in
1378 1.1 lukem 0)
1379 1.1 lukem if test x"$COUNT" != x ; then
1380 1.1 lukem if test "$COUNT" -gt "$SIZELIMIT" ; then
1381 1.1 lukem echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
1382 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1383 1.1 lukem exit 1
1384 1.1 lukem fi
1385 1.1 lukem echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)"
1386 1.1 lukem else
1387 1.1 lukem echo "...error: did not expect ldapsearch success ($RC)!"
1388 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1389 1.1 lukem exit 1
1390 1.1 lukem fi
1391 1.1 lukem ;;
1392 1.1 lukem 4)
1393 1.1 lukem if test x"$COUNT" != x ; then
1394 1.1 lukem if test $COUNT = $SIZELIMIT ; then
1395 1.1 lukem echo "...bumped into requested size limit ($SIZELIMIT)"
1396 1.1 lukem else
1397 1.1 lukem echo "...error: got $COUNT entries while requesting $SIZELIMIT..."
1398 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1399 1.1 lukem exit $RC
1400 1.1 lukem fi
1401 1.1 lukem else
1402 1.1 lukem echo "...error: bumped into server-side size limit, but got no entries!"
1403 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1404 1.1 lukem exit $RC
1405 1.1 lukem fi
1406 1.1 lukem ;;
1407 1.1 lukem *)
1408 1.1 lukem echo "ldapsearch failed ($RC)!"
1409 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1410 1.1 lukem exit $RC
1411 1.1 lukem ;;
1412 1.1 lukem esac
1413 1.1 lukem
1414 1.1 lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
1415 1.1 lukem
1416 1.1 lukem echo ">>>>> Test succeeded"
1417 1.1 lukem
1418 1.1 lukem test $KILLSERVERS != no && wait
1419 1.1 lukem
1420 1.1 lukem exit 0
1421