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*e670fd5cSchristosif test $SYNCPROV = syncprovno; then 20*e670fd5cSchristos echo "Syncrepl provider overlay not available, test skipped" 21*e670fd5cSchristos exit 0 22*e670fd5cSchristosfi 23*e670fd5cSchristos 24*e670fd5cSchristosCFPRO=$TESTDIR/cfpro.d 25*e670fd5cSchristosCFCON=$TESTDIR/cfcon.d 26*e670fd5cSchristos 27*e670fd5cSchristosmkdir -p $TESTDIR $DBDIR1A $DBDIR1B $DBDIR2A $CFPRO $CFCON 28*e670fd5cSchristos 29*e670fd5cSchristos$SLAPPASSWD -g -n >$CONFIGPWF 30*e670fd5cSchristos 31*e670fd5cSchristosif test x"$SYNCMODE" = x ; then 32*e670fd5cSchristos SYNCMODE=rp 33*e670fd5cSchristosfi 34*e670fd5cSchristoscase "$SYNCMODE" in 35*e670fd5cSchristos ro) 36*e670fd5cSchristos SYNCTYPE="type=refreshOnly interval=00:00:00:03" 37*e670fd5cSchristos ;; 38*e670fd5cSchristos rp) 39*e670fd5cSchristos SYNCTYPE="type=refreshAndPersist" 40*e670fd5cSchristos ;; 41*e670fd5cSchristos *) 42*e670fd5cSchristos echo "unknown sync mode $SYNCMODE" 43*e670fd5cSchristos exit 1; 44*e670fd5cSchristos ;; 45*e670fd5cSchristosesac 46*e670fd5cSchristos 47*e670fd5cSchristos# 48*e670fd5cSchristos# Test replication of dynamic config with alternate consumer config: 49*e670fd5cSchristos# - start provider 50*e670fd5cSchristos# - start consumer 51*e670fd5cSchristos# - configure over ldap 52*e670fd5cSchristos# - populate over ldap 53*e670fd5cSchristos# - configure syncrepl over ldap 54*e670fd5cSchristos# - retrieve database over ldap and compare against expected results 55*e670fd5cSchristos# 56*e670fd5cSchristos 57*e670fd5cSchristosecho "Starting provider slapd on TCP/IP port $PORT1..." 58*e670fd5cSchristos. $CONFFILTER $BACKEND < $DYNAMICCONF > $CONFLDIF 59*e670fd5cSchristos$SLAPADD -F $CFPRO -n 0 -l $CONFLDIF 60*e670fd5cSchristos$SLAPD -F $CFPRO -h $URI1 -d $LVL > $LOG1 2>&1 & 61*e670fd5cSchristosPID=$! 62*e670fd5cSchristosif test $WAIT != 0 ; then 63*e670fd5cSchristos echo PID $PID 64*e670fd5cSchristos read foo 65*e670fd5cSchristosfi 66*e670fd5cSchristosKILLPIDS="$PID" 67*e670fd5cSchristos 68*e670fd5cSchristossleep 1 69*e670fd5cSchristos 70*e670fd5cSchristosecho "Using ldapsearch to check that provider slapd is running..." 71*e670fd5cSchristosfor i in 0 1 2 3 4 5; do 72*e670fd5cSchristos $LDAPSEARCH -s base -b "" -H $URI1 \ 73*e670fd5cSchristos 'objectclass=*' > /dev/null 2>&1 74*e670fd5cSchristos RC=$? 75*e670fd5cSchristos if test $RC = 0 ; then 76*e670fd5cSchristos break 77*e670fd5cSchristos fi 78*e670fd5cSchristos echo "Waiting 5 seconds for slapd to start..." 79*e670fd5cSchristos sleep 5 80*e670fd5cSchristosdone 81*e670fd5cSchristos 82*e670fd5cSchristosif test $RC != 0 ; then 83*e670fd5cSchristos echo "ldapsearch failed ($RC)!" 84*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 85*e670fd5cSchristos exit $RC 86*e670fd5cSchristosfi 87*e670fd5cSchristos 88*e670fd5cSchristosecho "Inserting syncprov overlay on provider..." 89*e670fd5cSchristosif [ "$SYNCPROV" = syncprovmod ]; then 90*e670fd5cSchristos $LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <<EOF > $TESTOUT 2>&1 91*e670fd5cSchristosdn: cn=module,cn=config 92*e670fd5cSchristosobjectClass: olcModuleList 93*e670fd5cSchristoscn: module 94*e670fd5cSchristosolcModulePath: ../servers/slapd/overlays 95*e670fd5cSchristosolcModuleLoad: syncprov.la 96*e670fd5cSchristosEOF 97*e670fd5cSchristos RC=$? 98*e670fd5cSchristos if test $RC != 0 ; then 99*e670fd5cSchristos echo "ldapadd failed for moduleLoad ($RC)!" 100*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 101*e670fd5cSchristos exit $RC 102*e670fd5cSchristos fi 103*e670fd5cSchristosfi 104*e670fd5cSchristosread CONFIGPW < $CONFIGPWF 105*e670fd5cSchristos$LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1 106*e670fd5cSchristosdn: olcOverlay=syncprov,olcDatabase={0}config,cn=config 107*e670fd5cSchristoschangetype: add 108*e670fd5cSchristosobjectClass: olcOverlayConfig 109*e670fd5cSchristosobjectClass: olcSyncProvConfig 110*e670fd5cSchristosolcOverlay: syncprov 111*e670fd5cSchristosEOF 112*e670fd5cSchristosRC=$? 113*e670fd5cSchristosif test $RC != 0 ; then 114*e670fd5cSchristos echo "ldapmodify failed for syncprov config ($RC)!" 115*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 116*e670fd5cSchristos exit $RC 117*e670fd5cSchristosfi 118*e670fd5cSchristos 119*e670fd5cSchristos# Consumers will not replicate the provider's actual cn=config. 120*e670fd5cSchristos# Instead, they will use an alternate DB so that they may be 121*e670fd5cSchristos# configured differently from the provider. This alternate DB 122*e670fd5cSchristos# will also be a consumer for the real cn=schema,cn=config tree. 123*e670fd5cSchristos# It has multi-provider enabled so that it can be written directly 124*e670fd5cSchristos# while being a consumer of the main schema. 125*e670fd5cSchristosecho "Configuring consumer config DB on provider..." 126*e670fd5cSchristos$LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1 127*e670fd5cSchristosdn: cn=config 128*e670fd5cSchristoschangetype: modify 129*e670fd5cSchristosadd: olcServerID 130*e670fd5cSchristosolcServerID: 1 131*e670fd5cSchristos 132*e670fd5cSchristosdn: olcDatabase={1}ldif,cn=config 133*e670fd5cSchristoschangetype: add 134*e670fd5cSchristosobjectClass: olcDatabaseConfig 135*e670fd5cSchristosobjectClass: olcLdifConfig 136*e670fd5cSchristosolcDatabase: {1}ldif 137*e670fd5cSchristosolcDbDirectory: $DBDIR1A 138*e670fd5cSchristosolcSuffix: cn=config,cn=consumer 139*e670fd5cSchristosolcRootDN: cn=config,cn=consumer 140*e670fd5cSchristosolcRootPW: repsecret 141*e670fd5cSchristosolcAccess: to * by dn.base="cn=config" write 142*e670fd5cSchristos 143*e670fd5cSchristosdn: olcOverlay=syncprov,olcDatabase={1}ldif,cn=config 144*e670fd5cSchristoschangetype: add 145*e670fd5cSchristosobjectClass: olcOverlayConfig 146*e670fd5cSchristosobjectClass: olcSyncProvConfig 147*e670fd5cSchristosolcOverlay: syncprov 148*e670fd5cSchristos 149*e670fd5cSchristosdn: cn=config,cn=consumer 150*e670fd5cSchristoschangetype: add 151*e670fd5cSchristosobjectClass: olcGlobal 152*e670fd5cSchristoscn: consumerconfig 153*e670fd5cSchristos 154*e670fd5cSchristosdn: olcDatabase={0}config,cn=config,cn=consumer 155*e670fd5cSchristoschangetype: add 156*e670fd5cSchristosobjectClass: olcDatabaseConfig 157*e670fd5cSchristosolcDatabase: {0}config 158*e670fd5cSchristosolcRootPW: topsecret 159*e670fd5cSchristosolcSyncrepl: {0}rid=001 provider=$URI1 binddn="cn=config,cn=consumer" 160*e670fd5cSchristos bindmethod=simple credentials=repsecret searchbase="cn=config,cn=consumer" 161*e670fd5cSchristos $SYNCTYPE retry="3 5 300 5" timeout=3 suffixmassage="cn=config" 162*e670fd5cSchristosolcUpdateRef: $URI1 163*e670fd5cSchristos 164*e670fd5cSchristosdn: olcDatabase={1}ldif,cn=config 165*e670fd5cSchristoschangetype: modify 166*e670fd5cSchristosadd: olcSyncrepl 167*e670fd5cSchristosolcSyncrepl: {0}rid=001 provider=$URI1 binddn="cn=config" 168*e670fd5cSchristos bindmethod=simple credentials=$CONFIGPW searchbase="cn=schema,cn=config" 169*e670fd5cSchristos $SYNCTYPE retry="3 5 300 5" timeout=3 170*e670fd5cSchristos suffixmassage="cn=schema,cn=config,cn=consumer" 171*e670fd5cSchristos- 172*e670fd5cSchristosadd: olcMultiProvider 173*e670fd5cSchristosolcMultiProvider: TRUE 174*e670fd5cSchristos 175*e670fd5cSchristosEOF 176*e670fd5cSchristosRC=$? 177*e670fd5cSchristosif test $RC != 0 ; then 178*e670fd5cSchristos echo "ldapmodify failed for consumer DB config ($RC)!" 179*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 180*e670fd5cSchristos exit $RC 181*e670fd5cSchristosfi 182*e670fd5cSchristos 183*e670fd5cSchristosecho "Starting consumer slapd on TCP/IP port $PORT2..." 184*e670fd5cSchristos$SLAPADD -F $CFCON -n 0 -l $CONFLDIF 185*e670fd5cSchristos$SLAPD -F $CFCON -h $URI2 -d $LVL > $LOG2 2>&1 & 186*e670fd5cSchristosCONSUMERPID=$! 187*e670fd5cSchristosif test $WAIT != 0 ; then 188*e670fd5cSchristos echo CONSUMERPID $CONSUMERPID 189*e670fd5cSchristos read foo 190*e670fd5cSchristosfi 191*e670fd5cSchristosKILLPIDS="$KILLPIDS $CONSUMERPID" 192*e670fd5cSchristos 193*e670fd5cSchristossleep 1 194*e670fd5cSchristos 195*e670fd5cSchristosecho "Using ldapsearch to check that consumer slapd is running..." 196*e670fd5cSchristosfor i in 0 1 2 3 4 5; do 197*e670fd5cSchristos $LDAPSEARCH -s base -b "" -H $URI2 \ 198*e670fd5cSchristos 'objectclass=*' > /dev/null 2>&1 199*e670fd5cSchristos RC=$? 200*e670fd5cSchristos if test $RC = 0 ; then 201*e670fd5cSchristos break 202*e670fd5cSchristos fi 203*e670fd5cSchristos echo "Waiting 5 seconds for slapd to start..." 204*e670fd5cSchristos sleep 5 205*e670fd5cSchristosdone 206*e670fd5cSchristos 207*e670fd5cSchristosif test $RC != 0 ; then 208*e670fd5cSchristos echo "ldapsearch failed ($RC)!" 209*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 210*e670fd5cSchristos exit $RC 211*e670fd5cSchristosfi 212*e670fd5cSchristos 213*e670fd5cSchristosecho "Configuring syncrepl on consumer..." 214*e670fd5cSchristos$LDAPMODIFY -D cn=config -H $URI2 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1 215*e670fd5cSchristosdn: olcDatabase={0}config,cn=config 216*e670fd5cSchristoschangetype: modify 217*e670fd5cSchristosadd: olcSyncRepl 218*e670fd5cSchristosolcSyncRepl: rid=001 provider=$URI1 binddn="cn=config,cn=consumer" 219*e670fd5cSchristos bindmethod=simple credentials=repsecret searchbase="cn=config,cn=consumer" 220*e670fd5cSchristos $SYNCTYPE retry="3 5 300 5" timeout=3 221*e670fd5cSchristos suffixmassage="cn=config" 222*e670fd5cSchristos- 223*e670fd5cSchristosadd: olcUpdateRef 224*e670fd5cSchristosolcUpdateRef: $URI1 225*e670fd5cSchristosEOF 226*e670fd5cSchristos 227*e670fd5cSchristossleep 1 228*e670fd5cSchristos 229*e670fd5cSchristosecho "Using ldapsearch to check that syncrepl received config changes..." 230*e670fd5cSchristosRC=32 231*e670fd5cSchristosfor i in 0 1 2 3 4 5; do 232*e670fd5cSchristos RESULT=`$LDAPSEARCH -H $URI2 -D cn=config -y $CONFIGPWF \ 233*e670fd5cSchristos -s base -b "olcDatabase={0}config,cn=config" \ 234*e670fd5cSchristos '(olcUpdateRef=*)' 2>&1 | awk '/^dn:/ {print "OK"}'` 235*e670fd5cSchristos if test "x$RESULT" = "xOK" ; then 236*e670fd5cSchristos RC=0 237*e670fd5cSchristos break 238*e670fd5cSchristos fi 239*e670fd5cSchristos echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..." 240*e670fd5cSchristos sleep $SLEEP1 241*e670fd5cSchristosdone 242*e670fd5cSchristos 243*e670fd5cSchristosif test $RC != 0 ; then 244*e670fd5cSchristos echo "ldapsearch failed ($RC)!" 245*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 246*e670fd5cSchristos exit $RC 247*e670fd5cSchristosfi 248*e670fd5cSchristos 249*e670fd5cSchristosecho "Adding schema and databases on provider..." 250*e670fd5cSchristos$LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1 251*e670fd5cSchristosinclude: file://$ABS_SCHEMADIR/core.ldif 252*e670fd5cSchristos 253*e670fd5cSchristosinclude: file://$ABS_SCHEMADIR/cosine.ldif 254*e670fd5cSchristos 255*e670fd5cSchristosinclude: file://$ABS_SCHEMADIR/inetorgperson.ldif 256*e670fd5cSchristos 257*e670fd5cSchristosinclude: file://$ABS_SCHEMADIR/openldap.ldif 258*e670fd5cSchristos 259*e670fd5cSchristosinclude: file://$ABS_SCHEMADIR/nis.ldif 260*e670fd5cSchristosEOF 261*e670fd5cSchristosRC=$? 262*e670fd5cSchristosif test $RC != 0 ; then 263*e670fd5cSchristos echo "ldapadd failed for schema config ($RC)!" 264*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 265*e670fd5cSchristos exit $RC 266*e670fd5cSchristosfi 267*e670fd5cSchristos 268*e670fd5cSchristosecho "Using ldapsearch to check that syncrepl received the schema changes..." 269*e670fd5cSchristosRC=32 270*e670fd5cSchristosfor i in 0 1 2 3 4 5; do 271*e670fd5cSchristos RESULT=`$LDAPSEARCH -H $URI2 -D cn=config -y $CONFIGPWF \ 272*e670fd5cSchristos -s sub -b "cn=schema,cn=config" \ 273*e670fd5cSchristos '(cn=*openldap)' 2>&1 | awk '/^dn:/ {print "OK"}'` 274*e670fd5cSchristos if test "x$RESULT" = "xOK" ; then 275*e670fd5cSchristos RC=0 276*e670fd5cSchristos break 277*e670fd5cSchristos fi 278*e670fd5cSchristos echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..." 279*e670fd5cSchristos sleep $SLEEP1 280*e670fd5cSchristosdone 281*e670fd5cSchristos 282*e670fd5cSchristosnullExclude="" nullOK="" 283*e670fd5cSchristostest $BACKEND = null && nullExclude="# " nullOK="OK" 284*e670fd5cSchristos 285*e670fd5cSchristosif [ "$BACKENDTYPE" = mod ]; then 286*e670fd5cSchristos $LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1 287*e670fd5cSchristosdn: cn=module,cn=config 288*e670fd5cSchristosobjectClass: olcModuleList 289*e670fd5cSchristoscn: module 290*e670fd5cSchristosolcModulePath: ../servers/slapd/back-$BACKEND 291*e670fd5cSchristosolcModuleLoad: back_$BACKEND.la 292*e670fd5cSchristos 293*e670fd5cSchristosdn: cn=module,cn=config,cn=consumer 294*e670fd5cSchristosobjectClass: olcModuleList 295*e670fd5cSchristoscn: module 296*e670fd5cSchristosolcModulePath: ../servers/slapd/back-$BACKEND 297*e670fd5cSchristosolcModuleLoad: back_$BACKEND.la 298*e670fd5cSchristosEOF 299*e670fd5cSchristos RC=$? 300*e670fd5cSchristos if test $RC != 0 ; then 301*e670fd5cSchristos echo "ldapadd failed for backend config ($RC)!" 302*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 303*e670fd5cSchristos exit $RC 304*e670fd5cSchristos fi 305*e670fd5cSchristosfi 306*e670fd5cSchristos 307*e670fd5cSchristos$LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1 308*e670fd5cSchristosdn: olcDatabase={2}$BACKEND,cn=config 309*e670fd5cSchristosobjectClass: olcDatabaseConfig 310*e670fd5cSchristos${nullExclude}objectClass: olc${BACKEND}Config 311*e670fd5cSchristosolcDatabase: {2}$BACKEND 312*e670fd5cSchristosolcSuffix: $BASEDN 313*e670fd5cSchristos${nullExclude}olcDbDirectory: $DBDIR1B 314*e670fd5cSchristosolcRootDN: $MANAGERDN 315*e670fd5cSchristosolcRootPW: $PASSWD 316*e670fd5cSchristosolcSyncRepl: rid=002 provider=$URI1 binddn="$MANAGERDN" bindmethod=simple 317*e670fd5cSchristos credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE 318*e670fd5cSchristos retry="3 5 300 5" timeout=3 319*e670fd5cSchristosolcUpdateRef: $URI1 320*e670fd5cSchristos 321*e670fd5cSchristosdn: olcOverlay=syncprov,olcDatabase={2}${BACKEND},cn=config 322*e670fd5cSchristoschangetype: add 323*e670fd5cSchristosobjectClass: olcOverlayConfig 324*e670fd5cSchristosobjectClass: olcSyncProvConfig 325*e670fd5cSchristosolcOverlay: syncprov 326*e670fd5cSchristos 327*e670fd5cSchristosdn: olcDatabase={1}$BACKEND,cn=config,cn=consumer 328*e670fd5cSchristosobjectClass: olcDatabaseConfig 329*e670fd5cSchristos${nullExclude}objectClass: olc${BACKEND}Config 330*e670fd5cSchristosolcDatabase: {1}$BACKEND 331*e670fd5cSchristosolcSuffix: $BASEDN 332*e670fd5cSchristos${nullExclude}olcDbDirectory: $DBDIR2A 333*e670fd5cSchristosolcRootDN: $MANAGERDN 334*e670fd5cSchristosolcRootPW: $PASSWD 335*e670fd5cSchristosolcSyncRepl: rid=002 provider=$URI1 binddn="$MANAGERDN" bindmethod=simple 336*e670fd5cSchristos credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE 337*e670fd5cSchristos retry="3 5 300 5" timeout=3 338*e670fd5cSchristosolcUpdateRef: $URI1 339*e670fd5cSchristos 340*e670fd5cSchristosEOF 341*e670fd5cSchristosRC=$? 342*e670fd5cSchristosif test $RC != 0 ; then 343*e670fd5cSchristos echo "ldapadd failed for database config ($RC)!" 344*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 345*e670fd5cSchristos exit $RC 346*e670fd5cSchristosfi 347*e670fd5cSchristos 348*e670fd5cSchristosif test $INDEXDB = indexdb ; then 349*e670fd5cSchristos $LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1 350*e670fd5cSchristosdn: olcDatabase={2}$BACKEND,cn=config 351*e670fd5cSchristoschangetype: modify 352*e670fd5cSchristosadd: olcDbIndex 353*e670fd5cSchristosolcDbIndex: objectClass,entryUUID,entryCSN eq 354*e670fd5cSchristosolcDbIndex: cn,uid pres,eq,sub 355*e670fd5cSchristosEOF 356*e670fd5cSchristos RC=$? 357*e670fd5cSchristos if test $RC != 0 ; then 358*e670fd5cSchristos echo "ldapadd modify for database config ($RC)!" 359*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 360*e670fd5cSchristos exit $RC 361*e670fd5cSchristos fi 362*e670fd5cSchristosfi 363*e670fd5cSchristos 364*e670fd5cSchristosecho "Using ldapadd to populate provider..." 365*e670fd5cSchristos$LDAPADD -D "$MANAGERDN" -H $URI1 -w $PASSWD -f $LDIFORDERED \ 366*e670fd5cSchristos >> $TESTOUT 2>&1 367*e670fd5cSchristosRC=$? 368*e670fd5cSchristosif test $RC != 0 ; then 369*e670fd5cSchristos echo "ldapadd failed for database config ($RC)!" 370*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 371*e670fd5cSchristos exit $RC 372*e670fd5cSchristosfi 373*e670fd5cSchristos 374*e670fd5cSchristosecho "Waiting $SLEEP1 seconds for syncrepl to receive changes..." 375*e670fd5cSchristossleep $SLEEP1 376*e670fd5cSchristos 377*e670fd5cSchristosecho "Using ldapsearch to check that syncrepl received database changes..." 378*e670fd5cSchristosRC=32 379*e670fd5cSchristosfor i in 0 1 2 3 4 5; do 380*e670fd5cSchristos RESULT=`$LDAPSEARCH -H $URI2 \ 381*e670fd5cSchristos -s base -b "cn=Ursula Hampster,ou=Alumni Association,ou=People,dc=example,dc=com" \ 382*e670fd5cSchristos '(objectClass=*)' 2>&1 | awk '/^dn:/ {print "OK"}'` 383*e670fd5cSchristos if test "x$RESULT$nullOK" = "xOK" ; then 384*e670fd5cSchristos RC=0 385*e670fd5cSchristos break 386*e670fd5cSchristos fi 387*e670fd5cSchristos echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..." 388*e670fd5cSchristos sleep $SLEEP1 389*e670fd5cSchristosdone 390*e670fd5cSchristos 391*e670fd5cSchristosif test $RC != 0 ; then 392*e670fd5cSchristos echo "ldapsearch failed ($RC)!" 393*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 394*e670fd5cSchristos exit $RC 395*e670fd5cSchristosfi 396*e670fd5cSchristos 397*e670fd5cSchristosecho "Using ldapsearch to read all the entries from the provider..." 398*e670fd5cSchristos$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI1 -w $PASSWD \ 399*e670fd5cSchristos 'objectclass=*' > $PROVIDEROUT 2>&1 400*e670fd5cSchristosRC=$? 401*e670fd5cSchristos 402*e670fd5cSchristosif test $RC != 0 ; then 403*e670fd5cSchristos echo "ldapsearch failed at provider ($RC)!" 404*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 405*e670fd5cSchristos exit $RC 406*e670fd5cSchristosfi 407*e670fd5cSchristos 408*e670fd5cSchristosecho "Using ldapsearch to read all the entries from the consumer..." 409*e670fd5cSchristos$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI2 -w $PASSWD \ 410*e670fd5cSchristos 'objectclass=*' > $CONSUMEROUT 2>&1 411*e670fd5cSchristosRC=$? 412*e670fd5cSchristos 413*e670fd5cSchristosif test $RC != 0 ; then 414*e670fd5cSchristos echo "ldapsearch failed at consumer ($RC)!" 415*e670fd5cSchristos test $KILLSERVERS != no && kill -HUP $KILLPIDS 416*e670fd5cSchristos exit $RC 417*e670fd5cSchristosfi 418*e670fd5cSchristos 419*e670fd5cSchristostest $KILLSERVERS != no && kill -HUP $KILLPIDS 420*e670fd5cSchristos 421*e670fd5cSchristosecho "Filtering provider results..." 422*e670fd5cSchristos$LDIFFILTER < $PROVIDEROUT > $PROVIDERFLT 423*e670fd5cSchristosecho "Filtering consumer results..." 424*e670fd5cSchristos$LDIFFILTER < $CONSUMEROUT > $CONSUMERFLT 425*e670fd5cSchristos 426*e670fd5cSchristosecho "Comparing retrieved entries from provider and consumer..." 427*e670fd5cSchristos$CMP $PROVIDERFLT $CONSUMERFLT > $CMPOUT 428*e670fd5cSchristos 429*e670fd5cSchristosif test $? != 0 ; then 430*e670fd5cSchristos echo "test failed - provider and consumer databases differ" 431*e670fd5cSchristos exit 1 432*e670fd5cSchristosfi 433*e670fd5cSchristos 434*e670fd5cSchristosecho ">>>>> Test succeeded" 435*e670fd5cSchristos 436*e670fd5cSchristostest $KILLSERVERS != no && wait 437*e670fd5cSchristos 438*e670fd5cSchristosexit 0 439