| 1 |
#! /bin/sh |
| 2 |
# $OpenLDAP$ |
| 3 |
## This work is part of OpenLDAP Software <http://www.openldap.org/>. |
| 4 |
## |
| 5 |
## Copyright 1998-2024 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 |
echo "running defines.sh" |
| 17 |
. $SRCDIR/scripts/defines.sh |
| 18 |
|
| 19 |
if test $BACKSQL = "sqlno" ; then |
| 20 |
echo "SQL backend not available, test skipped" |
| 21 |
exit 0 |
| 22 |
fi |
| 23 |
|
| 24 |
if test $RDBMS = "rdbmsno" ; then |
| 25 |
echo "SQL test not requested, test skipped" |
| 26 |
exit 0 |
| 27 |
fi |
| 28 |
|
| 29 |
mkdir -p $TESTDIR |
| 30 |
|
| 31 |
echo "Starting slapd on TCP/IP port $PORT1..." |
| 32 |
. $CONFFILTER $BACKEND < $SQLCONF > $CONF1 |
| 33 |
$SLAPD -f $CONF1 -h $URI1 -d $LVL > $LOG1 2>&1 & |
| 34 |
PID=$! |
| 35 |
if test $WAIT != 0 ; then |
| 36 |
echo PID $PID |
| 37 |
read foo |
| 38 |
fi |
| 39 |
KILLPIDS="$PID" |
| 40 |
|
| 41 |
echo "Testing SQL backend read operations..." |
| 42 |
for i in 0 1 2 3 4 5; do |
| 43 |
$LDAPSEARCH -s base -b "$MONITOR" -H $URI1 \ |
| 44 |
'objectclass=*' > /dev/null 2>&1 |
| 45 |
RC=$? |
| 46 |
if test $RC = 0 ; then |
| 47 |
break |
| 48 |
fi |
| 49 |
echo "Waiting 5 seconds for slapd to start..." |
| 50 |
sleep 5 |
| 51 |
done |
| 52 |
|
| 53 |
if test $RC != 0 ; then |
| 54 |
echo "ldapsearch failed ($RC)!" |
| 55 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 56 |
exit $RC |
| 57 |
fi |
| 58 |
|
| 59 |
BASEDN="dc=example,dc=com" |
| 60 |
BINDDN="cn=Mitya Kovalev,${BASEDN}" |
| 61 |
BINDPW="mit" |
| 62 |
echo -n "Testing correct bind... " |
| 63 |
$LDAPWHOAMI -H $URI1 -D "$BINDDN" -w $BINDPW |
| 64 |
RC=$? |
| 65 |
if test $RC != 0 ; then |
| 66 |
echo "ldapwhoami failed ($RC)!" |
| 67 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 68 |
exit $RC |
| 69 |
fi |
| 70 |
|
| 71 |
echo -n "Testing incorrect bind (should fail)... " |
| 72 |
$LDAPWHOAMI -H $URI1 -D "$BINDDN" -w "XXX" |
| 73 |
RC=$? |
| 74 |
if test $RC = 0 ; then |
| 75 |
echo "ldapwhoami should have failed ($RC)!" |
| 76 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 77 |
exit 1 |
| 78 |
fi |
| 79 |
|
| 80 |
echo "Testing baseobject search..." |
| 81 |
echo "# Testing baseobject search..." >> $SEARCHOUT |
| 82 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -s base -S "" \ |
| 83 |
>> $SEARCHOUT 2>&1 |
| 84 |
|
| 85 |
RC=$? |
| 86 |
if test $RC != 0 ; then |
| 87 |
echo "ldapsearch failed ($RC)!" |
| 88 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 89 |
exit $RC |
| 90 |
fi |
| 91 |
|
| 92 |
echo "Testing onelevel search..." |
| 93 |
echo "# Testing onelevel search..." >> $SEARCHOUT |
| 94 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -s one -S "" \ |
| 95 |
>> $SEARCHOUT 2>&1 |
| 96 |
|
| 97 |
RC=$? |
| 98 |
if test $RC != 0 ; then |
| 99 |
echo "ldapsearch failed ($RC)!" |
| 100 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 101 |
exit $RC |
| 102 |
fi |
| 103 |
|
| 104 |
echo "Testing subtree search..." |
| 105 |
echo "# Testing subtree search..." >> $SEARCHOUT |
| 106 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -S "" \ |
| 107 |
>> $SEARCHOUT 2>&1 |
| 108 |
|
| 109 |
RC=$? |
| 110 |
if test $RC != 0 ; then |
| 111 |
echo "ldapsearch failed ($RC)!" |
| 112 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 113 |
exit $RC |
| 114 |
fi |
| 115 |
|
| 116 |
echo "Testing subtree search with manageDSAit..." |
| 117 |
echo "# Testing subtree search with manageDSAit..." >> $SEARCHOUT |
| 118 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -M -S "" '*' ref \ |
| 119 |
>> $SEARCHOUT 2>&1 |
| 120 |
|
| 121 |
RC=$? |
| 122 |
if test $RC != 0 ; then |
| 123 |
echo "ldapsearch failed ($RC)!" |
| 124 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 125 |
exit $RC |
| 126 |
fi |
| 127 |
|
| 128 |
echo "Testing invalid filter..." |
| 129 |
echo "# Testing invalid filter..." >> $SEARCHOUT |
| 130 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -S "" "(foo=)" \ |
| 131 |
>> $SEARCHOUT 2>&1 |
| 132 |
|
| 133 |
RC=$? |
| 134 |
if test $RC != 0 ; then |
| 135 |
echo "ldapsearch failed ($RC)!" |
| 136 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 137 |
exit $RC |
| 138 |
fi |
| 139 |
|
| 140 |
echo "Testing exact search..." |
| 141 |
echo "# Testing exact search..." >> $SEARCHOUT |
| 142 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -S "" "(sn=Kovalev)" \ |
| 143 |
>> $SEARCHOUT 2>&1 |
| 144 |
|
| 145 |
RC=$? |
| 146 |
if test $RC != 0 ; then |
| 147 |
echo "ldapsearch failed ($RC)!" |
| 148 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 149 |
exit $RC |
| 150 |
fi |
| 151 |
|
| 152 |
echo "Testing substrings initial search..." |
| 153 |
echo "# Testing substrings initial search..." >> $SEARCHOUT |
| 154 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -S "" "(cn=m*)" \ |
| 155 |
>> $SEARCHOUT 2>&1 |
| 156 |
|
| 157 |
RC=$? |
| 158 |
if test $RC != 0 ; then |
| 159 |
echo "ldapsearch failed ($RC)!" |
| 160 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 161 |
exit $RC |
| 162 |
fi |
| 163 |
|
| 164 |
echo "Testing substrings any search..." |
| 165 |
echo "# Testing substrings any search..." >> $SEARCHOUT |
| 166 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -S "" "(cn=*m*)" \ |
| 167 |
>> $SEARCHOUT 2>&1 |
| 168 |
|
| 169 |
RC=$? |
| 170 |
if test $RC != 0 ; then |
| 171 |
echo "ldapsearch failed ($RC)!" |
| 172 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 173 |
exit $RC |
| 174 |
fi |
| 175 |
|
| 176 |
echo "Testing substrings final search..." |
| 177 |
echo "# Testing substrings final search..." >> $SEARCHOUT |
| 178 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -S "" "(cn=*v)" \ |
| 179 |
>> $SEARCHOUT 2>&1 |
| 180 |
|
| 181 |
RC=$? |
| 182 |
if test $RC != 0 ; then |
| 183 |
echo "ldapsearch failed ($RC)!" |
| 184 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 185 |
exit $RC |
| 186 |
fi |
| 187 |
|
| 188 |
echo "Testing approx search..." |
| 189 |
echo "# Testing approx search..." >> $SEARCHOUT |
| 190 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -S "" "(sn~=kovalev)" \ |
| 191 |
>> $SEARCHOUT 2>&1 |
| 192 |
|
| 193 |
RC=$? |
| 194 |
if test $RC != 0 ; then |
| 195 |
echo "ldapsearch failed ($RC)!" |
| 196 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 197 |
exit $RC |
| 198 |
fi |
| 199 |
|
| 200 |
echo "Testing extensible filter search..." |
| 201 |
echo "# Testing extensible filter search..." >> $SEARCHOUT |
| 202 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -S "" \ |
| 203 |
"(sn:caseExactMatch:=Kovalev)" >> $SEARCHOUT 2>&1 |
| 204 |
|
| 205 |
RC=$? |
| 206 |
if test $RC != 0 ; then |
| 207 |
echo "ldapsearch failed ($RC)!" |
| 208 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 209 |
exit $RC |
| 210 |
fi |
| 211 |
|
| 212 |
echo "Testing search for telephoneNumber..." |
| 213 |
echo "# Testing search for telephoneNumber..." >> $SEARCHOUT |
| 214 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -S "" \ |
| 215 |
"(telephoneNumber=3322334)" >> $SEARCHOUT 2>&1 |
| 216 |
|
| 217 |
RC=$? |
| 218 |
if test $RC != 0 ; then |
| 219 |
echo "ldapsearch failed ($RC)!" |
| 220 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 221 |
exit $RC |
| 222 |
fi |
| 223 |
|
| 224 |
echo "Testing AND search..." |
| 225 |
echo "# Testing AND search..." >> $SEARCHOUT |
| 226 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -S "" \ |
| 227 |
"(&(sn=kovalev)(givenName=mitya))" >> $SEARCHOUT 2>&1 |
| 228 |
|
| 229 |
RC=$? |
| 230 |
if test $RC != 0 ; then |
| 231 |
echo "ldapsearch failed ($RC)!" |
| 232 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 233 |
exit $RC |
| 234 |
fi |
| 235 |
|
| 236 |
echo "Testing AND search on objectClass..." |
| 237 |
echo "# Testing AND search on objectClass..." >> $SEARCHOUT |
| 238 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -S "" \ |
| 239 |
"(&(objectClass=organization)(objectClass=dcObject))" >> $SEARCHOUT 2>&1 |
| 240 |
|
| 241 |
RC=$? |
| 242 |
if test $RC != 0 ; then |
| 243 |
echo "ldapsearch failed ($RC)!" |
| 244 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 245 |
exit $RC |
| 246 |
fi |
| 247 |
|
| 248 |
echo "Testing OR search..." |
| 249 |
echo "# Testing OR search..." >> $SEARCHOUT |
| 250 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -S "" \ |
| 251 |
"(|(sn=kovalev)(givenName=mitya))" >> $SEARCHOUT 2>&1 |
| 252 |
|
| 253 |
RC=$? |
| 254 |
if test $RC != 0 ; then |
| 255 |
echo "ldapsearch failed ($RC)!" |
| 256 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 257 |
exit $RC |
| 258 |
fi |
| 259 |
|
| 260 |
echo "Testing OR search on objectClass..." |
| 261 |
echo "# Testing OR search on objectClass..." >> $SEARCHOUT |
| 262 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -S "" \ |
| 263 |
"(|(objectClass=document)(objectClass=organization))" \ |
| 264 |
>> $SEARCHOUT 2>&1 |
| 265 |
|
| 266 |
RC=$? |
| 267 |
if test $RC != 0 ; then |
| 268 |
echo "ldapsearch failed ($RC)!" |
| 269 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 270 |
exit $RC |
| 271 |
fi |
| 272 |
|
| 273 |
echo "Testing NOT search..." |
| 274 |
echo "# Testing NOT search..." >> $SEARCHOUT |
| 275 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -S "" \ |
| 276 |
'(!(sn=kovalev))' >> $SEARCHOUT 2>&1 |
| 277 |
|
| 278 |
RC=$? |
| 279 |
if test $RC != 0 ; then |
| 280 |
echo "ldapsearch failed ($RC)!" |
| 281 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 282 |
exit $RC |
| 283 |
fi |
| 284 |
|
| 285 |
echo "Testing NOT search on objectClass..." |
| 286 |
echo "# Testing NOT search on objectClass..." >> $SEARCHOUT |
| 287 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -S "" \ |
| 288 |
'(!(objectClass=inetOrgPerson))' >> $SEARCHOUT 2>&1 |
| 289 |
|
| 290 |
RC=$? |
| 291 |
if test $RC != 0 ; then |
| 292 |
echo "ldapsearch failed ($RC)!" |
| 293 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 294 |
exit $RC |
| 295 |
fi |
| 296 |
|
| 297 |
echo "Testing NOT search on \"auxiliary\" objectClass..." |
| 298 |
echo "# Testing NOT search on \"auxiliary\" objectClass..." >> $SEARCHOUT |
| 299 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -S "" \ |
| 300 |
'(!(objectClass=dcObject))' >> $SEARCHOUT 2>&1 |
| 301 |
|
| 302 |
RC=$? |
| 303 |
if test $RC != 0 ; then |
| 304 |
echo "ldapsearch failed ($RC)!" |
| 305 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 306 |
exit $RC |
| 307 |
fi |
| 308 |
|
| 309 |
#### Needs work... |
| 310 |
echo "Testing NOT presence search... (disabled)" |
| 311 |
###echo "# Testing NOT presence search..." >> $SEARCHOUT |
| 312 |
###$LDAPSEARCH -H $URI1 -b "$BASEDN" -S "" \ |
| 313 |
### '(!(sn=*))' >> $SEARCHOUT 2>&1 |
| 314 |
### |
| 315 |
###RC=$? |
| 316 |
###if test $RC != 0 ; then |
| 317 |
### echo "ldapsearch failed ($RC)!" |
| 318 |
### test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 319 |
### exit $RC |
| 320 |
###fi |
| 321 |
|
| 322 |
echo "Testing attribute inheritance in filter..." |
| 323 |
echo "# Testing attribute inheritance in filter..." >> $SEARCHOUT |
| 324 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -S "" \ |
| 325 |
"(name=example)" >> $SEARCHOUT 2>&1 |
| 326 |
|
| 327 |
RC=$? |
| 328 |
if test $RC != 0 ; then |
| 329 |
echo "ldapsearch failed ($RC)!" |
| 330 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 331 |
exit $RC |
| 332 |
fi |
| 333 |
|
| 334 |
# ITS#4604 |
| 335 |
echo "Testing undefined attribute in filter..." |
| 336 |
echo "# Testing undefined attribute in filter..." >> $SEARCHOUT |
| 337 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -S "" \ |
| 338 |
"(|(o=example)(foobar=x))" >> $SEARCHOUT 2>&1 |
| 339 |
|
| 340 |
RC=$? |
| 341 |
if test $RC != 0 ; then |
| 342 |
echo "ldapsearch failed ($RC)!" |
| 343 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 344 |
exit $RC |
| 345 |
fi |
| 346 |
|
| 347 |
echo "Testing objectClass inheritance in filter..." |
| 348 |
echo "# Testing objectClass inheritance in filter..." >> $SEARCHOUT |
| 349 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -S "" \ |
| 350 |
"(objectClass=person)" >> $SEARCHOUT 2>&1 |
| 351 |
|
| 352 |
RC=$? |
| 353 |
if test $RC != 0 ; then |
| 354 |
echo "ldapsearch failed ($RC)!" |
| 355 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 356 |
exit $RC |
| 357 |
fi |
| 358 |
|
| 359 |
echo "Testing \"auxiliary\" objectClass in filter..." |
| 360 |
echo "# Testing \"auxiliary\" objectClass in filter..." >> $SEARCHOUT |
| 361 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -S "" \ |
| 362 |
"(objectClass=dcObject)" >> $SEARCHOUT 2>&1 |
| 363 |
|
| 364 |
RC=$? |
| 365 |
if test $RC != 0 ; then |
| 366 |
echo "ldapsearch failed ($RC)!" |
| 367 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 368 |
exit $RC |
| 369 |
fi |
| 370 |
|
| 371 |
echo "Testing hasSubordinates in filter..." |
| 372 |
echo "# Testing hasSubordinates in filter..." >> $SEARCHOUT |
| 373 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -S "" \ |
| 374 |
"(hasSubordinates=TRUE)" >> $SEARCHOUT 2>&1 |
| 375 |
|
| 376 |
RC=$? |
| 377 |
if test $RC != 0 ; then |
| 378 |
echo "ldapsearch failed ($RC)!" |
| 379 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 380 |
exit $RC |
| 381 |
fi |
| 382 |
|
| 383 |
echo "Testing entryUUID in filter..." |
| 384 |
echo "# Testing entryUUID in filter..." >> $SEARCHOUT |
| 385 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -S "" \ |
| 386 |
"(entryUUID=00000001-0000-0001-0000-000000000000)" >> $SEARCHOUT 2>&1 |
| 387 |
|
| 388 |
RC=$? |
| 389 |
if test $RC != 0 ; then |
| 390 |
echo "ldapsearch failed ($RC)!" |
| 391 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 392 |
exit $RC |
| 393 |
fi |
| 394 |
|
| 395 |
echo "Testing attribute inheritance in requested attributes..." |
| 396 |
echo "# Testing attribute inheritance in requested attributes..." >> $SEARCHOUT |
| 397 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -S "" \ |
| 398 |
"(sn=kovalev)" name >> $SEARCHOUT 2>&1 |
| 399 |
|
| 400 |
RC=$? |
| 401 |
if test $RC != 0 ; then |
| 402 |
echo "ldapsearch failed ($RC)!" |
| 403 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 404 |
exit $RC |
| 405 |
fi |
| 406 |
|
| 407 |
echo "Testing objectClass in requested attributes..." |
| 408 |
echo "# Testing objectClass in requested attributes..." >> $SEARCHOUT |
| 409 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -S "" \ |
| 410 |
objectClass >> $SEARCHOUT 2>&1 |
| 411 |
|
| 412 |
RC=$? |
| 413 |
if test $RC != 0 ; then |
| 414 |
echo "ldapsearch failed ($RC)!" |
| 415 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 416 |
exit $RC |
| 417 |
fi |
| 418 |
|
| 419 |
echo "Testing operational attributes in request..." |
| 420 |
echo "# Testing operational attributes in request..." >> $SEARCHOUT |
| 421 |
$LDAPSEARCH -H $URI1 -b "$BASEDN" -S "" \ |
| 422 |
'+' 2>&1 > $SEARCHFLT |
| 423 |
|
| 424 |
RC=$? |
| 425 |
if test $RC != 0 ; then |
| 426 |
echo "ldapsearch failed ($RC)!" |
| 427 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 428 |
exit $RC |
| 429 |
fi |
| 430 |
|
| 431 |
grep -v '^entryCSN:' $SEARCHFLT >> $SEARCHOUT |
| 432 |
|
| 433 |
SIZELIMIT=4 |
| 434 |
echo "Testing size limit..." |
| 435 |
$LDAPRSEARCH -H $URI1 -b "$BASEDN" \ |
| 436 |
-z $SIZELIMIT -S "" '(objectClass=*)' >$SEARCHFLT 2>&1 |
| 437 |
RC=$? |
| 438 |
COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHFLT` |
| 439 |
case $RC in |
| 440 |
0) |
| 441 |
if test x"$COUNT" != x ; then |
| 442 |
if test "$COUNT" -gt "$SIZELIMIT" ; then |
| 443 |
echo "...error: got $COUNT entries instead of the requested $SIZELIMIT" |
| 444 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 445 |
exit 1 |
| 446 |
fi |
| 447 |
echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)" |
| 448 |
else |
| 449 |
echo "...error: did not expect ldapsearch success ($RC)!" |
| 450 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 451 |
exit 1 |
| 452 |
fi |
| 453 |
;; |
| 454 |
4) |
| 455 |
if test x"$COUNT" != x ; then |
| 456 |
if test "$COUNT" = "$SIZELIMIT" ; then |
| 457 |
echo "...bumped into requested size limit ($SIZELIMIT)" |
| 458 |
else |
| 459 |
echo "...error: got $COUNT entries with a requested sizelimit of $SIZELIMIT" |
| 460 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 461 |
exit $RC |
| 462 |
fi |
| 463 |
else |
| 464 |
echo "...error: bumped into server-side size limit, but got no entries!" |
| 465 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 466 |
exit $RC |
| 467 |
fi |
| 468 |
;; |
| 469 |
*) |
| 470 |
echo "ldapsearch failed ($RC)!" |
| 471 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 472 |
exit $RC |
| 473 |
;; |
| 474 |
esac |
| 475 |
|
| 476 |
echo -n "Testing compare (should be TRUE)... " |
| 477 |
$LDAPCOMPARE -H $URI1 "$BINDDN" \ |
| 478 |
"sn:kovalev" >> $TESTOUT 2>&1 |
| 479 |
|
| 480 |
RC=$? |
| 481 |
case $RC in |
| 482 |
6) |
| 483 |
echo "TRUE" |
| 484 |
;; |
| 485 |
5) echo "FALSE!" |
| 486 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 487 |
exit $RC |
| 488 |
;; |
| 489 |
*) echo "failed ($RC)!" |
| 490 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 491 |
exit 1 |
| 492 |
;; |
| 493 |
esac |
| 494 |
|
| 495 |
echo -n "Testing compare (should be FALSE)... " |
| 496 |
$LDAPCOMPARE -H $URI1 "$BINDDN" \ |
| 497 |
"cn:foobar" >> $TESTOUT 2>&1 |
| 498 |
|
| 499 |
RC=$? |
| 500 |
case $RC in |
| 501 |
6) |
| 502 |
echo "TRUE!" |
| 503 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 504 |
exit $RC |
| 505 |
;; |
| 506 |
5) echo "FALSE" |
| 507 |
;; |
| 508 |
*) echo "failed ($RC)!" |
| 509 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 510 |
exit 1 |
| 511 |
;; |
| 512 |
esac |
| 513 |
|
| 514 |
echo -n "Testing compare (should be UNDEFINED)... " |
| 515 |
$LDAPCOMPARE -H $URI1 "$BINDDN" \ |
| 516 |
"o:example" >> $TESTOUT 2>&1 |
| 517 |
|
| 518 |
RC=$? |
| 519 |
case $RC in |
| 520 |
6) |
| 521 |
echo "TRUE!" |
| 522 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 523 |
exit $RC |
| 524 |
;; |
| 525 |
5) echo "FALSE!" |
| 526 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 527 |
exit $RC |
| 528 |
;; |
| 529 |
*) echo "failed ($RC)" |
| 530 |
;; |
| 531 |
esac |
| 532 |
|
| 533 |
echo -n "Testing compare on hasSubordinates (should be TRUE)... " |
| 534 |
$LDAPCOMPARE -H $URI1 "$BASEDN" \ |
| 535 |
"hasSubordinates:TRUE" >> $TESTOUT 2>&1 |
| 536 |
|
| 537 |
RC=$? |
| 538 |
case $RC in |
| 539 |
6) |
| 540 |
echo "TRUE" |
| 541 |
;; |
| 542 |
5) echo "FALSE!" |
| 543 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 544 |
exit $RC |
| 545 |
;; |
| 546 |
*) echo "failed ($RC)!" |
| 547 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 548 |
exit 1 |
| 549 |
;; |
| 550 |
esac |
| 551 |
|
| 552 |
echo "Filtering ldapsearch results..." |
| 553 |
$LDIFFILTER < $SEARCHOUT > $SEARCHFLT |
| 554 |
echo "Filtering original ldif..." |
| 555 |
$LDIFFILTER < $SQLREAD > $LDIFFLT |
| 556 |
echo "Comparing filter output..." |
| 557 |
$CMP $SEARCHFLT $LDIFFLT > $CMPOUT |
| 558 |
|
| 559 |
if test $? != 0 ; then |
| 560 |
echo "comparison failed - SQL search didn't succeed" |
| 561 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 562 |
exit 1 |
| 563 |
fi |
| 564 |
|
| 565 |
test $KILLSERVERS != no && kill -HUP $KILLPIDS |
| 566 |
|
| 567 |
echo ">>>>> Test succeeded" |
| 568 |
exit 0 |