1*e670fd5cSchristos#! /bin/sh 2*e670fd5cSchristos# $OpenLDAP$ 3*e670fd5cSchristos## This work is part of OpenLDAP Software <http://www.openldap.org/>. 4*e670fd5cSchristos## 5*e670fd5cSchristos## Copyright 1998-2021 The OpenLDAP Foundation. 6*e670fd5cSchristos## All rights reserved. 7*e670fd5cSchristos## 8*e670fd5cSchristos## Redistribution and use in source and binary forms, with or without 9*e670fd5cSchristos## modification, are permitted only as authorized by the OpenLDAP 10*e670fd5cSchristos## Public License. 11*e670fd5cSchristos## 12*e670fd5cSchristos## A copy of this license is available in the file LICENSE in the 13*e670fd5cSchristos## top-level directory of the distribution or, alternatively, at 14*e670fd5cSchristos## <http://www.OpenLDAP.org/license.html>. 15*e670fd5cSchristos 16*e670fd5cSchristosecho "running defines.sh" 17*e670fd5cSchristos. $SRCDIR/scripts/defines.sh 18*e670fd5cSchristos 19*e670fd5cSchristosecho "" 20*e670fd5cSchristos 21*e670fd5cSchristosif test $BACKASYNCMETA = asyncmetano ; then 22*e670fd5cSchristos echo "asyncmeta backend not available, test skipped" 23*e670fd5cSchristos exit 0 24*e670fd5cSchristosfi 25*e670fd5cSchristos 26*e670fd5cSchristosif test $BACKLDAP = ldapno ; then 27*e670fd5cSchristos echo "ldap backend not available, test skipped" 28*e670fd5cSchristos exit 0 29*e670fd5cSchristosfi 30*e670fd5cSchristos 31*e670fd5cSchristosrm -rf $TESTDIR 32*e670fd5cSchristos 33*e670fd5cSchristosmkdir -p $TESTDIR $DBDIR1 $DBDIR2 34*e670fd5cSchristos 35*e670fd5cSchristosecho "Starting slapd on TCP/IP port $PORT1..." 36*e670fd5cSchristos. $CONFFILTER $BACKEND < $METACONF1 > $CONF1 37*e670fd5cSchristos$SLAPD -f $CONF1 -h $URI1 -d $LVL > $LOG1 2>&1 & 38*e670fd5cSchristosPID=$! 39*e670fd5cSchristosif test $WAIT != 0 ; then 40*e670fd5cSchristos echo PID $PID 41*e670fd5cSchristos read foo 42*e670fd5cSchristosfi 43*e670fd5cSchristosKILLPIDS="$PID" 44*e670fd5cSchristos 45*e670fd5cSchristossleep 1 46*e670fd5cSchristos 47*e670fd5cSchristosecho "Using ldapsearch to check that slapd is running..." 48*e670fd5cSchristosfor i in 0 1 2 3 4 5; do 49*e670fd5cSchristos $LDAPSEARCH -s base -b "$MONITOR" -H $URI1 \ 50*e670fd5cSchristos 'objectclass=*' > /dev/null 2>&1 51*e670fd5cSchristos RC=$? 52*e670fd5cSchristos if test $RC = 0 ; then 53*e670fd5cSchristos break 54*e670fd5cSchristos fi 55*e670fd5cSchristos echo "Waiting 5 seconds for slapd to start..." 56*e670fd5cSchristos sleep 5 57*e670fd5cSchristosdone 58*e670fd5cSchristosif test $RC != 0 ; then 59*e670fd5cSchristos echo "ldapsearch failed ($RC)!" 60*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 61*e670fd5cSchristos exit $RC 62*e670fd5cSchristosfi 63*e670fd5cSchristos 64*e670fd5cSchristosecho "Using ldapadd to populate the database..." 65*e670fd5cSchristos$LDAPADD -D "$MANAGERDN" -H $URI1 -w $PASSWD < \ 66*e670fd5cSchristos $LDIFORDERED > $TESTOUT 2>&1 67*e670fd5cSchristosRC=$? 68*e670fd5cSchristosif test $RC != 0 ; then 69*e670fd5cSchristos echo "ldapadd failed ($RC)!" 70*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 71*e670fd5cSchristos exit $RC 72*e670fd5cSchristosfi 73*e670fd5cSchristos 74*e670fd5cSchristosecho "Starting slapd on TCP/IP port $PORT2..." 75*e670fd5cSchristos. $CONFFILTER $BACKEND < $METACONF2 > $CONF2 76*e670fd5cSchristos$SLAPD -f $CONF2 -h $URI2 -d $LVL > $LOG2 2>&1 & 77*e670fd5cSchristosPID=$! 78*e670fd5cSchristosif test $WAIT != 0 ; then 79*e670fd5cSchristos echo PID $PID 80*e670fd5cSchristos read foo 81*e670fd5cSchristosfi 82*e670fd5cSchristosKILLPIDS="$KILLPIDS $PID" 83*e670fd5cSchristos 84*e670fd5cSchristossleep 1 85*e670fd5cSchristos 86*e670fd5cSchristosecho "Using ldapsearch to check that slapd is running..." 87*e670fd5cSchristosfor i in 0 1 2 3 4 5; do 88*e670fd5cSchristos $LDAPSEARCH -s base -b "$MONITOR" -H $URI2 \ 89*e670fd5cSchristos 'objectclass=*' > /dev/null 2>&1 90*e670fd5cSchristos RC=$? 91*e670fd5cSchristos if test $RC = 0 ; then 92*e670fd5cSchristos break 93*e670fd5cSchristos fi 94*e670fd5cSchristos echo "Waiting 5 seconds for slapd to start..." 95*e670fd5cSchristos sleep 5 96*e670fd5cSchristosdone 97*e670fd5cSchristosif test $RC != 0 ; then 98*e670fd5cSchristos echo "ldapsearch failed ($RC)!" 99*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 100*e670fd5cSchristos exit $RC 101*e670fd5cSchristosfi 102*e670fd5cSchristos 103*e670fd5cSchristosecho "Using ldapadd to populate the database..." 104*e670fd5cSchristos$LDAPADD -D "$METAMANAGERDN" -H $URI2 -w $PASSWD < \ 105*e670fd5cSchristos $LDIFMETA >> $TESTOUT 2>&1 106*e670fd5cSchristosRC=$? 107*e670fd5cSchristosif test $RC != 0 ; then 108*e670fd5cSchristos echo "ldapadd failed ($RC)!" 109*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 110*e670fd5cSchristos exit $RC 111*e670fd5cSchristosfi 112*e670fd5cSchristos 113*e670fd5cSchristosecho "Starting slapd on TCP/IP port $PORT3..." 114*e670fd5cSchristos. $CONFFILTER $BACKEND < $ASYNCMETACONF > $CONF3 115*e670fd5cSchristos$SLAPD -f $CONF3 -h $URI3 -d $LVL > $LOG3 2>&1 & 116*e670fd5cSchristosPID=$! 117*e670fd5cSchristosif test $WAIT != 0 ; then 118*e670fd5cSchristos echo PID $PID 119*e670fd5cSchristos read foo 120*e670fd5cSchristosfi 121*e670fd5cSchristosKILLPIDS="$KILLPIDS $PID" 122*e670fd5cSchristos 123*e670fd5cSchristossleep 1 124*e670fd5cSchristos 125*e670fd5cSchristosecho "Using ldapsearch to check that slapd is running..." 126*e670fd5cSchristosfor i in 0 1 2 3 4 5; do 127*e670fd5cSchristos $LDAPSEARCH -s base -b "$MONITOR" -H $URI3 \ 128*e670fd5cSchristos 'objectclass=*' > /dev/null 2>&1 129*e670fd5cSchristos RC=$? 130*e670fd5cSchristos if test $RC = 0 ; then 131*e670fd5cSchristos break 132*e670fd5cSchristos fi 133*e670fd5cSchristos echo "Waiting 5 seconds for slapd to start..." 134*e670fd5cSchristos sleep 5 135*e670fd5cSchristosdone 136*e670fd5cSchristosif test $RC != 0 ; then 137*e670fd5cSchristos echo "ldapsearch failed ($RC)!" 138*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 139*e670fd5cSchristos exit $RC 140*e670fd5cSchristosfi 141*e670fd5cSchristos 142*e670fd5cSchristoscat /dev/null > $SEARCHOUT 143*e670fd5cSchristos 144*e670fd5cSchristosBASEDN="o=Example,c=US" 145*e670fd5cSchristosecho "Searching base=\"$BASEDN\"..." 146*e670fd5cSchristosecho "# searching base=\"$BASEDN\"..." >> $SEARCHOUT 147*e670fd5cSchristos$LDAPSEARCH -S "" -H $URI3 -b "$BASEDN" >> $SEARCHOUT 2>&1 148*e670fd5cSchristosRC=$? 149*e670fd5cSchristos#if test $RC != 0 ; then 150*e670fd5cSchristos# echo "Search failed ($RC)!" 151*e670fd5cSchristos# test $KILLSERVERS != no && kill -HUP $KILLPIDS 152*e670fd5cSchristos# exit $RC 153*e670fd5cSchristos#fi 154*e670fd5cSchristoscase $RC in 155*e670fd5cSchristos 0) 156*e670fd5cSchristos ;; 157*e670fd5cSchristos 51) 158*e670fd5cSchristos echo "### Hit LDAP_BUSY problem; you may want to re-run the test" 159*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 160*e670fd5cSchristos exit 0 161*e670fd5cSchristos ;; 162*e670fd5cSchristos *) 163*e670fd5cSchristos echo "Search failed ($RC)!" 164*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 165*e670fd5cSchristos exit $RC 166*e670fd5cSchristos ;; 167*e670fd5cSchristosesac 168*e670fd5cSchristos 169*e670fd5cSchristos# ITS#4195: spurious matchedDN when the search scopes the main target, 170*e670fd5cSchristos# and the searchBase is not present, so that target returns noSuchObject 171*e670fd5cSchristosBASEDN="ou=Meta,o=Example,c=US" 172*e670fd5cSchristosecho "Searching base=\"$BASEDN\"..." 173*e670fd5cSchristosecho "# searching base=\"$BASEDN\"..." >> $SEARCHOUT 174*e670fd5cSchristos$LDAPSEARCH -S "" -H $URI3 -b "$BASEDN" >> $SEARCHOUT 2>&1 175*e670fd5cSchristosRC=$? 176*e670fd5cSchristos#if test $RC != 0 ; then 177*e670fd5cSchristos# echo "Search failed ($RC)!" 178*e670fd5cSchristos# test $KILLSERVERS != no && kill -HUP $KILLPIDS 179*e670fd5cSchristos# exit $RC 180*e670fd5cSchristos#fi 181*e670fd5cSchristoscase $RC in 182*e670fd5cSchristos 0) 183*e670fd5cSchristos ;; 184*e670fd5cSchristos 51) 185*e670fd5cSchristos echo "### Hit LDAP_BUSY problem; you may want to re-run the test" 186*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 187*e670fd5cSchristos exit 0 188*e670fd5cSchristos ;; 189*e670fd5cSchristos *) 190*e670fd5cSchristos echo "Search failed ($RC)!" 191*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 192*e670fd5cSchristos exit $RC 193*e670fd5cSchristos ;; 194*e670fd5cSchristosesac 195*e670fd5cSchristos 196*e670fd5cSchristos# 197*e670fd5cSchristos# Do some modifications 198*e670fd5cSchristos# 199*e670fd5cSchristos 200*e670fd5cSchristosBASEDN="o=Example,c=US" 201*e670fd5cSchristosecho "Modifying database \"$BASEDN\"..." 202*e670fd5cSchristos$LDAPMODIFY -v -D "cn=Manager,$BASEDN" -H $URI3 -w $PASSWD \ 203*e670fd5cSchristos -M >> $TESTOUT 2>&1 << EOMODS 204*e670fd5cSchristos# These operations (updates with objectClass mapping) triggered ITS#3499 205*e670fd5cSchristosdn: cn=Added Group,ou=Groups,$BASEDN 206*e670fd5cSchristoschangetype: add 207*e670fd5cSchristosobjectClass: groupOfNames 208*e670fd5cSchristosobjectClass: uidObject 209*e670fd5cSchristoscn: Added Group 210*e670fd5cSchristosmember: cn=Added Group,ou=Groups,$BASEDN 211*e670fd5cSchristosuid: added 212*e670fd5cSchristos 213*e670fd5cSchristosdn: cn=Another Added Group,ou=Groups,$BASEDN 214*e670fd5cSchristoschangetype: add 215*e670fd5cSchristosobjectClass: groupOfNames 216*e670fd5cSchristoscn: Another Added Group 217*e670fd5cSchristosmember: cn=Added Group,ou=Groups,$BASEDN 218*e670fd5cSchristosmember: cn=Another Added Group,ou=Groups,$BASEDN 219*e670fd5cSchristos 220*e670fd5cSchristosdn: cn=Another Added Group,ou=Groups,$BASEDN 221*e670fd5cSchristoschangetype: modify 222*e670fd5cSchristosadd: objectClass 223*e670fd5cSchristosobjectClass: uidObject 224*e670fd5cSchristos- 225*e670fd5cSchristosadd: uid 226*e670fd5cSchristosuid: added 227*e670fd5cSchristos- 228*e670fd5cSchristos 229*e670fd5cSchristosdn: cn=Added Group,ou=Groups,$BASEDN 230*e670fd5cSchristoschangetype: modify 231*e670fd5cSchristosdelete: objectClass 232*e670fd5cSchristosobjectClass: uidObject 233*e670fd5cSchristos- 234*e670fd5cSchristosdelete: uid 235*e670fd5cSchristos- 236*e670fd5cSchristos 237*e670fd5cSchristosdn: ou=Meta,$BASEDN 238*e670fd5cSchristoschangetype: modify 239*e670fd5cSchristosadd: description 240*e670fd5cSchristosdescription: added to "ou=Meta,$BASEDN" 241*e670fd5cSchristos- 242*e670fd5cSchristos 243*e670fd5cSchristosdn: ou=Who's going to handle this?,$BASEDN 244*e670fd5cSchristoschangetype: add 245*e670fd5cSchristosobjectClass: organizationalUnit 246*e670fd5cSchristosou: Who's going to handle this? 247*e670fd5cSchristosdescription: added 248*e670fd5cSchristosdescription: will be deleted 249*e670fd5cSchristos 250*e670fd5cSchristosdn: ou=Same as above,$BASEDN 251*e670fd5cSchristoschangetype: add 252*e670fd5cSchristosobjectClass: organizationalUnit 253*e670fd5cSchristosou: Same as above 254*e670fd5cSchristosdescription: added right after "Who's going to handle this?" 255*e670fd5cSchristosdescription: will be preserved 256*e670fd5cSchristos 257*e670fd5cSchristosdn: ou=Who's going to handle this?,$BASEDN 258*e670fd5cSchristoschangetype: delete 259*e670fd5cSchristos 260*e670fd5cSchristosdn: ou=Who's going to handle this?,ou=Meta,$BASEDN 261*e670fd5cSchristoschangetype: add 262*e670fd5cSchristosobjectClass: organizationalUnit 263*e670fd5cSchristosou: Who's going to handle this? 264*e670fd5cSchristosdescription: added 265*e670fd5cSchristosdescription: will be deleted 266*e670fd5cSchristos 267*e670fd5cSchristosdn: ou=Same as above,ou=Meta,$BASEDN 268*e670fd5cSchristoschangetype: add 269*e670fd5cSchristosobjectClass: organizationalUnit 270*e670fd5cSchristosou: Same as above 271*e670fd5cSchristosdescription: added right after "Who's going to handle this?" 272*e670fd5cSchristosdescription: will be preserved 273*e670fd5cSchristos 274*e670fd5cSchristosdn: cn=Added User,ou=Same as above,ou=Meta,$BASEDN 275*e670fd5cSchristoschangetype: add 276*e670fd5cSchristosobjectClass: inetOrgPerson 277*e670fd5cSchristoscn: Added User 278*e670fd5cSchristossn: User 279*e670fd5cSchristosuserPassword: secret 280*e670fd5cSchristos 281*e670fd5cSchristosdn: ou=Who's going to handle this?,ou=Meta,$BASEDN 282*e670fd5cSchristoschangetype: delete 283*e670fd5cSchristosEOMODS 284*e670fd5cSchristos 285*e670fd5cSchristosRC=$? 286*e670fd5cSchristos#if test $RC != 0 ; then 287*e670fd5cSchristos# echo "Modify failed ($RC)!" 288*e670fd5cSchristos# test $KILLSERVERS != no && kill -HUP $KILLPIDS 289*e670fd5cSchristos# exit $RC 290*e670fd5cSchristos#fi 291*e670fd5cSchristoscase $RC in 292*e670fd5cSchristos 0) 293*e670fd5cSchristos ;; 294*e670fd5cSchristos 51) 295*e670fd5cSchristos echo "### Hit LDAP_BUSY problem; you may want to re-run the test" 296*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 297*e670fd5cSchristos exit 0 298*e670fd5cSchristos ;; 299*e670fd5cSchristos *) 300*e670fd5cSchristos echo "Modify failed ($RC)!" 301*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 302*e670fd5cSchristos exit $RC 303*e670fd5cSchristos ;; 304*e670fd5cSchristosesac 305*e670fd5cSchristos 306*e670fd5cSchristosecho "Searching base=\"$BASEDN\"..." 307*e670fd5cSchristosecho "# searching base=\"$BASEDN\"..." >> $SEARCHOUT 308*e670fd5cSchristos$LDAPSEARCH -S "" -H $URI3 -b "$BASEDN" >> $SEARCHOUT 2>&1 309*e670fd5cSchristosRC=$? 310*e670fd5cSchristos#if test $RC != 0 ; then 311*e670fd5cSchristos# echo "Search failed ($RC)!" 312*e670fd5cSchristos# test $KILLSERVERS != no && kill -HUP $KILLPIDS 313*e670fd5cSchristos# exit $RC 314*e670fd5cSchristos#fi 315*e670fd5cSchristoscase $RC in 316*e670fd5cSchristos 0) 317*e670fd5cSchristos ;; 318*e670fd5cSchristos 51) 319*e670fd5cSchristos echo "### Hit LDAP_BUSY problem; you may want to re-run the test" 320*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 321*e670fd5cSchristos exit 0 322*e670fd5cSchristos ;; 323*e670fd5cSchristos *) 324*e670fd5cSchristos echo "Search failed ($RC)!" 325*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 326*e670fd5cSchristos exit $RC 327*e670fd5cSchristos ;; 328*e670fd5cSchristosesac 329*e670fd5cSchristos 330*e670fd5cSchristosBASEDN="o=Example,c=US" 331*e670fd5cSchristosecho " base=\"$BASEDN\"..." 332*e670fd5cSchristosecho "# base=\"$BASEDN\"..." >> $SEARCHOUT 333*e670fd5cSchristos$LDAPSEARCH -S "" -H $URI3 -b "$BASEDN" -M "$FILTER" '*' ref \ 334*e670fd5cSchristos >> $SEARCHOUT 2>&1 335*e670fd5cSchristosRC=$? 336*e670fd5cSchristos#if test $RC != 0 ; then 337*e670fd5cSchristos# echo "Search failed ($RC)!" 338*e670fd5cSchristos# test $KILLSERVERS != no && kill -HUP $KILLPIDS 339*e670fd5cSchristos# exit $RC 340*e670fd5cSchristos#fi 341*e670fd5cSchristoscase $RC in 342*e670fd5cSchristos 0) 343*e670fd5cSchristos ;; 344*e670fd5cSchristos 51) 345*e670fd5cSchristos echo "### Hit LDAP_BUSY problem; you may want to re-run the test" 346*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 347*e670fd5cSchristos exit 0 348*e670fd5cSchristos ;; 349*e670fd5cSchristos *) 350*e670fd5cSchristos echo "Search failed ($RC)!" 351*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 352*e670fd5cSchristos exit $RC 353*e670fd5cSchristos ;; 354*e670fd5cSchristosesac 355*e670fd5cSchristos 356*e670fd5cSchristosBASEDN="o=Example,c=US" 357*e670fd5cSchristosFILTER="(seeAlso=cn=all staff,ou=Groups,$BASEDN)" 358*e670fd5cSchristosecho "Searching filter=\"$FILTER\"" 359*e670fd5cSchristosecho " attrs=\"seeAlso\"" 360*e670fd5cSchristosecho " base=\"$BASEDN\"..." 361*e670fd5cSchristosecho "# searching filter=\"$FILTER\"" >> $SEARCHOUT 362*e670fd5cSchristosecho "# attrs=\"seeAlso\"" >> $SEARCHOUT 363*e670fd5cSchristosecho "# base=\"$BASEDN\"..." >> $SEARCHOUT 364*e670fd5cSchristos$LDAPSEARCH -S "" -H $URI3 -b "$BASEDN" "$FILTER" seeAlso \ 365*e670fd5cSchristos >> $SEARCHOUT 2>&1 366*e670fd5cSchristosRC=$? 367*e670fd5cSchristos#if test $RC != 0 ; then 368*e670fd5cSchristos# echo "Search failed ($RC)!" 369*e670fd5cSchristos# test $KILLSERVERS != no && kill -HUP $KILLPIDS 370*e670fd5cSchristos# exit $RC 371*e670fd5cSchristos#fi 372*e670fd5cSchristoscase $RC in 373*e670fd5cSchristos 0) 374*e670fd5cSchristos ;; 375*e670fd5cSchristos 51) 376*e670fd5cSchristos echo "### Hit LDAP_BUSY problem; you may want to re-run the test" 377*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 378*e670fd5cSchristos exit 0 379*e670fd5cSchristos ;; 380*e670fd5cSchristos *) 381*e670fd5cSchristos echo "Search failed ($RC)!" 382*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 383*e670fd5cSchristos exit $RC 384*e670fd5cSchristos ;; 385*e670fd5cSchristosesac 386*e670fd5cSchristos 387*e670fd5cSchristosFILTER="(uid=example)" 388*e670fd5cSchristosecho "Searching filter=\"$FILTER\"" 389*e670fd5cSchristosecho " attrs=\"uid\"" 390*e670fd5cSchristosecho " base=\"$BASEDN\"..." 391*e670fd5cSchristosecho "# searching filter=\"$FILTER\"" >> $SEARCHOUT 392*e670fd5cSchristosecho "# attrs=\"uid\"" >> $SEARCHOUT 393*e670fd5cSchristosecho "# base=\"$BASEDN\"..." >> $SEARCHOUT 394*e670fd5cSchristos$LDAPSEARCH -S "" -H $URI3 -b "$BASEDN" "$FILTER" uid \ 395*e670fd5cSchristos >> $SEARCHOUT 2>&1 396*e670fd5cSchristosRC=$? 397*e670fd5cSchristos#if test $RC != 0 ; then 398*e670fd5cSchristos# echo "Search failed ($RC)!" 399*e670fd5cSchristos# test $KILLSERVERS != no && kill -HUP $KILLPIDS 400*e670fd5cSchristos# exit $RC 401*e670fd5cSchristos#fi 402*e670fd5cSchristoscase $RC in 403*e670fd5cSchristos 0) 404*e670fd5cSchristos ;; 405*e670fd5cSchristos 51) 406*e670fd5cSchristos echo "### Hit LDAP_BUSY problem; you may want to re-run the test" 407*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 408*e670fd5cSchristos exit 0 409*e670fd5cSchristos ;; 410*e670fd5cSchristos *) 411*e670fd5cSchristos echo "Search failed ($RC)!" 412*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 413*e670fd5cSchristos exit $RC 414*e670fd5cSchristos ;; 415*e670fd5cSchristosesac 416*e670fd5cSchristos 417*e670fd5cSchristosFILTER="(member=cn=Another Added Group,ou=Groups,$BASEDN)" 418*e670fd5cSchristosecho "Searching filter=\"$FILTER\"" 419*e670fd5cSchristosecho " attrs=\"member\"" 420*e670fd5cSchristosecho " base=\"$BASEDN\"..." 421*e670fd5cSchristosecho "# searching filter=\"$FILTER\"" >> $SEARCHOUT 422*e670fd5cSchristosecho "# attrs=\"member\"" >> $SEARCHOUT 423*e670fd5cSchristosecho "# base=\"$BASEDN\"..." >> $SEARCHOUT 424*e670fd5cSchristos$LDAPSEARCH -S "" -H $URI3 -b "$BASEDN" "$FILTER" member \ 425*e670fd5cSchristos >> $SEARCHOUT 2>&1 426*e670fd5cSchristosRC=$? 427*e670fd5cSchristos#if test $RC != 0 ; then 428*e670fd5cSchristos# echo "Search failed ($RC)!" 429*e670fd5cSchristos# test $KILLSERVERS != no && kill -HUP $KILLPIDS 430*e670fd5cSchristos# exit $RC 431*e670fd5cSchristos#fi 432*e670fd5cSchristoscase $RC in 433*e670fd5cSchristos 0) 434*e670fd5cSchristos ;; 435*e670fd5cSchristos 51) 436*e670fd5cSchristos echo "### Hit LDAP_BUSY problem; you may want to re-run the test" 437*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 438*e670fd5cSchristos exit 0 439*e670fd5cSchristos ;; 440*e670fd5cSchristos *) 441*e670fd5cSchristos echo "Search failed ($RC)!" 442*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 443*e670fd5cSchristos exit $RC 444*e670fd5cSchristos ;; 445*e670fd5cSchristosesac 446*e670fd5cSchristos 447*e670fd5cSchristosecho "Waiting 10 seconds for cached connections to timeout..." 448*e670fd5cSchristossleep 10 449*e670fd5cSchristos 450*e670fd5cSchristosecho "Searching with a timed out connection..." 451*e670fd5cSchristosecho "# searching filter=\"$FILTER\"" >> $SEARCHOUT 452*e670fd5cSchristosecho "# attrs=\"member\"" >> $SEARCHOUT 453*e670fd5cSchristosecho "# base=\"$BASEDN\"" >> $SEARCHOUT 454*e670fd5cSchristosecho "# with a timed out connection..." >> $SEARCHOUT 455*e670fd5cSchristos$LDAPSEARCH -S "" -H $URI3 -D "cn=Manager,$BASEDN" -w $PASSWD \ 456*e670fd5cSchristos -b "$BASEDN" "$FILTER" member \ 457*e670fd5cSchristos >> $SEARCHOUT 2>&1 458*e670fd5cSchristosRC=$? 459*e670fd5cSchristos#if test $RC != 0 ; then 460*e670fd5cSchristos# echo "Search failed ($RC)!" 461*e670fd5cSchristos# test $KILLSERVERS != no && kill -HUP $KILLPIDS 462*e670fd5cSchristos# exit $RC 463*e670fd5cSchristos#fi 464*e670fd5cSchristoscase $RC in 465*e670fd5cSchristos 0) 466*e670fd5cSchristos ;; 467*e670fd5cSchristos 51) 468*e670fd5cSchristos echo "### Hit LDAP_BUSY problem; you may want to re-run the test" 469*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 470*e670fd5cSchristos exit 0 471*e670fd5cSchristos ;; 472*e670fd5cSchristos *) 473*e670fd5cSchristos echo "Search failed ($RC)!" 474*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 475*e670fd5cSchristos exit $RC 476*e670fd5cSchristos ;; 477*e670fd5cSchristosesac 478*e670fd5cSchristos 479*e670fd5cSchristos# NOTE: cannot send to $SEARCHOUT because the returned entries 480*e670fd5cSchristos# are not predictable... 481*e670fd5cSchristosecho "Checking server-enforced size limit..." 482*e670fd5cSchristosecho "# Checking server-enforced size limit..." >> $SEARCHOUT 483*e670fd5cSchristos$LDAPSEARCH -S "" -H $URI3 \ 484*e670fd5cSchristos -D "cn=Bjorn Jensen,ou=Information Technology Division,ou=People,$BASEDN" -w bjorn \ 485*e670fd5cSchristos -b "$BASEDN" "(objectClass=*)" 1.1 \ 486*e670fd5cSchristos >> $TESTOUT 2>&1 487*e670fd5cSchristosRC=$? 488*e670fd5cSchristoscase $RC,$BACKEND in 489*e670fd5cSchristos 4,* | 0,null) 490*e670fd5cSchristos ;; 491*e670fd5cSchristos 0,*) 492*e670fd5cSchristos echo "Search should have failed ($RC)!" 493*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 494*e670fd5cSchristos exit -1 495*e670fd5cSchristos ;; 496*e670fd5cSchristos *) 497*e670fd5cSchristos echo "Search failed ($RC)!" 498*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 499*e670fd5cSchristos exit $RC 500*e670fd5cSchristos ;; 501*e670fd5cSchristosesac 502*e670fd5cSchristos 503*e670fd5cSchristos# NOTE: cannot send to $SEARCHOUT because the returned entries 504*e670fd5cSchristos# are not predictable... 505*e670fd5cSchristosecho "Checking client-requested size limit..." 506*e670fd5cSchristosecho "# Checking client-requested size limit..." >> $SEARCHOUT 507*e670fd5cSchristos$LDAPSEARCH -S "" -H $URI3 \ 508*e670fd5cSchristos -D "cn=Bjorn Jensen,ou=Information Technology Division,ou=People,$BASEDN" -w bjorn \ 509*e670fd5cSchristos -b "$BASEDN" -z 2 "(objectClass=*)" 1.1 \ 510*e670fd5cSchristos >> $TESTOUT 2>&1 511*e670fd5cSchristosRC=$? 512*e670fd5cSchristoscase $RC,$BACKEND in 513*e670fd5cSchristos 4,* | 0,null) 514*e670fd5cSchristos ;; 515*e670fd5cSchristos 0,*) 516*e670fd5cSchristos echo "Search should have failed ($RC)!" 517*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 518*e670fd5cSchristos exit -1 519*e670fd5cSchristos ;; 520*e670fd5cSchristos *) 521*e670fd5cSchristos echo "Search failed ($RC)!" 522*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 523*e670fd5cSchristos exit $RC 524*e670fd5cSchristos ;; 525*e670fd5cSchristosesac 526*e670fd5cSchristos 527*e670fd5cSchristosecho "Filtering ldapsearch results..." 528*e670fd5cSchristos$LDIFFILTER < $SEARCHOUT > $SEARCHFLT 529*e670fd5cSchristosecho "Filtering original ldif used to create database..." 530*e670fd5cSchristos$LDIFFILTER < $METAOUT > $LDIFFLT 531*e670fd5cSchristosecho "Comparing filter output..." 532*e670fd5cSchristos$CMP $SEARCHFLT $LDIFFLT > $CMPOUT 533*e670fd5cSchristos 534*e670fd5cSchristosif test $? != 0 ; then 535*e670fd5cSchristos echo "comparison failed - meta search/modification didn't succeed" 536*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 537*e670fd5cSchristos exit 1 538*e670fd5cSchristosfi 539*e670fd5cSchristos 540*e670fd5cSchristosecho "Binding as newly added user to database \"$BASEDN\"..." 541*e670fd5cSchristos$LDAPWHOAMI -H $URI3 \ 542*e670fd5cSchristos -D "cn=Added User,ou=Same as above,ou=Meta,$BASEDN" \ 543*e670fd5cSchristos -w $PASSWD >> $TESTOUT 2>&1 544*e670fd5cSchristosRC=$? 545*e670fd5cSchristos#if test $RC != 0 ; then 546*e670fd5cSchristos# echo "WhoAmI failed ($RC)!" 547*e670fd5cSchristos# test $KILLSERVERS != no && kill -HUP $KILLPIDS 548*e670fd5cSchristos# exit $RC 549*e670fd5cSchristos#fi 550*e670fd5cSchristoscase $RC in 551*e670fd5cSchristos 0) 552*e670fd5cSchristos ;; 553*e670fd5cSchristos 51) 554*e670fd5cSchristos echo "### Hit LDAP_BUSY problem; you may want to re-run the test" 555*e670fd5cSchristos ;; 556*e670fd5cSchristos *) 557*e670fd5cSchristos echo "WhoAmI failed ($RC)!" 558*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 559*e670fd5cSchristos exit $RC 560*e670fd5cSchristos ;; 561*e670fd5cSchristosesac 562*e670fd5cSchristos 563*e670fd5cSchristos 564*e670fd5cSchristosecho "Binding with incorrect password to database \"$BASEDN\"..." 565*e670fd5cSchristos$LDAPWHOAMI -H $URI3 \ 566*e670fd5cSchristos -D "cn=Added User,ou=Same as above,ou=Meta,$BASEDN" \ 567*e670fd5cSchristos -w bogus >> $TESTOUT 2>&1 568*e670fd5cSchristosRC=$? 569*e670fd5cSchristos#if test $RC != 0 ; then 570*e670fd5cSchristos# echo "WhoAmI failed ($RC)!" 571*e670fd5cSchristos# test $KILLSERVERS != no && kill -HUP $KILLPIDS 572*e670fd5cSchristos# exit $RC 573*e670fd5cSchristos#fi 574*e670fd5cSchristoscase $RC,$BACKEND in 575*e670fd5cSchristos 0,null) 576*e670fd5cSchristos ;; 577*e670fd5cSchristos 0,*) 578*e670fd5cSchristos echo "WhoAmI should have failed ($RC)!" 579*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 580*e670fd5cSchristos exit -1 581*e670fd5cSchristos ;; 582*e670fd5cSchristos 51,*) 583*e670fd5cSchristos echo "### Hit LDAP_BUSY problem; you may want to re-run the test" 584*e670fd5cSchristos ;; 585*e670fd5cSchristos *) 586*e670fd5cSchristos ;; 587*e670fd5cSchristosesac 588*e670fd5cSchristos 589*e670fd5cSchristosecho "Binding with non-existing user to database \"$BASEDN\"..." 590*e670fd5cSchristos$LDAPWHOAMI -H $URI3 \ 591*e670fd5cSchristos -D "cn=Non-existing User,ou=Same as above,ou=Meta,$BASEDN" \ 592*e670fd5cSchristos -w bogus >> $TESTOUT 2>&1 593*e670fd5cSchristosRC=$? 594*e670fd5cSchristos#if test $RC != 0 ; then 595*e670fd5cSchristos# echo "WhoAmI failed ($RC)!" 596*e670fd5cSchristos# test $KILLSERVERS != no && kill -HUP $KILLPIDS 597*e670fd5cSchristos# exit $RC 598*e670fd5cSchristos#fi 599*e670fd5cSchristoscase $RC,$BACKEND in 600*e670fd5cSchristos 0,null) 601*e670fd5cSchristos ;; 602*e670fd5cSchristos 0,*) 603*e670fd5cSchristos echo "WhoAmI should have failed ($RC)!" 604*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 605*e670fd5cSchristos exit -1 606*e670fd5cSchristos ;; 607*e670fd5cSchristos 51,*) 608*e670fd5cSchristos echo "### Hit LDAP_BUSY problem; you may want to re-run the test" 609*e670fd5cSchristos ;; 610*e670fd5cSchristos *) 611*e670fd5cSchristos ;; 612*e670fd5cSchristosesac 613*e670fd5cSchristos 614*e670fd5cSchristostest $KILLSERVERS != no && kill -HUP $KILLPIDS 615*e670fd5cSchristos 616*e670fd5cSchristosecho ">>>>> Test succeeded" 617*e670fd5cSchristos 618*e670fd5cSchristostest $KILLSERVERS != no && wait 619*e670fd5cSchristos 620*e670fd5cSchristosexit 0 621