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