~ttx/openldap/lucid-gssapi-495418

« back to all changes in this revision

Viewing changes to tests/scripts/test050-syncrepl-multimaster

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug, Steve Langasek, Mathias Gug
  • Date: 2009-07-30 16:42:58 UTC
  • mfrom: (0.2.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090730164258-r282hhchgzytxm00
Tags: 2.4.17-1ubuntu1

[ Steve Langasek ]
* Fix up the lintian warnings:
  - add missing misc-depends on all packages
  - slapd, libldap-2.4-2-dbg sections changed to 'debug' to match archive
    overrides
  - bump Standards-Version to 3.8.2, no changes required.

[ Mathias Gug ]
* Resynchronise with Debian. Remaining changes:
  - AppArmor support:
    - debian/apparmor-profile: add AppArmor profile
    - updated debian/slapd.README.Debian for note on AppArmor
    - debian/slapd.dirs: add etc/apparmor.d/force-complain
    - debian/slapd.postrm: remove symlink in force-complain/ on purge
    - debian/rules: install apparmor profile.
  - Don't use local statement in config script as it fails if /bin/sh
    points to bash.
  - debian/slapd.postinst, debian/slapd.script-common: set correct
    ownership and permissions on /var/lib/ldap, /etc/ldap/slapd.d (group
    readable) and /var/run/slapd (world readable).
  - Enable nssoverlay:
    - debian/patches/nssov-build, debian/rules: Build and package the nss
      overlay.
    - debian/schema/misc.ldif: add ldif file for the misc schema which
      defines rfc822MailMember (required by the nss overlay).
  - debian/{control,rules}: enable PIE hardening
  - Use cn=config as the default configuration backend instead of
    slapd.conf. Migrate slapd.conf file to /etc/ldap/slapd.d/ on upgrade
    asking the end user to enter a new password to control the access to
    the cn=config tree.
  - debian/slapd.postinst: create /var/run/slapd before updating its
    permissions.
  - debian/slapd.init: Correctly set slapd config backend option even if
    the pidfile is configured in slapd default file.
* Dropped:
  - Merged in Debian:
    - Update priority of libldap-2.4-2 to match the archive override.
    - Add the missing ldapexop and ldapurl tools to ldap-utils, as well as
      the ldapurl(1) manpage.
    - Bump build-dependency on debhelper to 6 instead of 5, since that's
      what we're using.
    - Set the default SLAPD_SERVICES to ldap:/// ldapi:///, instead of using
      the built-in default of ldap:/// only.
  - Fixed in upstream release:
    - debian/patches/fix-ldap_back_entry_get_rwa.patch: fix test-0034
      failure when built with PIE.
    - debian/patches/gnutls-enable-v1-ca-certs: Enable V1 CA certs to be
      trusted.
  - Update Apparmor profile support: don't support upgrade from pre-hardy
    systems:
    - debian/slapd.postinst: Reload AA profile on configuration
    - debian/control: Recommends apparmor >= 2.1+1075-0ubuntu6
    - debian/control: Conflicts with apparmor-profiles <<
      2.1+1075-0ubuntu4 to make sure that if earlier version of
      apparmor-profiles gets installed it won't overwrite our profile.
    - follow ApparmorProfileMigration and force apparmor complain mode on
      some upgrades
    - debian/slapd.preinst: create symlink for force-complain on
      pre-feisty upgrades, upgrades where apparmor-profiles profile is
      unchanged (ie non-enforcing) and upgrades where apparmor profile
      does not exist.
  - debian/patches/autogen.sh: no longer needed with karmic libtool.
    - Call libtoolize with the --install option to install
      config.{guess,sub} files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /bin/sh
2
 
# $OpenLDAP: pkg/ldap/tests/scripts/test050-syncrepl-multimaster,v 1.3.2.13 2009/02/02 22:42:42 quanah Exp $
 
2
# $OpenLDAP: pkg/ldap/tests/scripts/test050-syncrepl-multimaster,v 1.3.2.16 2009/03/09 23:09:06 quanah Exp $
3
3
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4
4
##
5
5
## Copyright 1998-2009 The OpenLDAP Foundation.
21
21
        exit 0
22
22
fi 
23
23
 
24
 
PRODIR=$TESTDIR/pro
25
 
CONDIR=$TESTDIR/con1
26
 
CONDIR2=$TESTDIR/con2
27
 
DBPRO=$PRODIR/db
28
 
DBCON=$CONDIR/db
29
 
DBCON2=$CONDIR2/db
30
 
CFPRO=$PRODIR/slapd.d
31
 
CFCON=$CONDIR/slapd.d
32
 
CFCON2=$CONDIR2/slapd.d
33
 
 
34
 
mkdir -p $TESTDIR $PRODIR $CONDIR $CONDIR2 $DBPRO $DBCON $DBCON2 $CFPRO $CFCON $CFCON2
 
24
MMR=${MMR-4}
 
25
 
 
26
if [ $MMR -gt 9 ]; then
 
27
MMR=9
 
28
fi
 
29
 
 
30
XDIR=$TESTDIR/srv
 
31
TMP=$TESTDIR/tmp
 
32
 
 
33
mkdir -p $TESTDIR
35
34
 
36
35
$SLAPPASSWD -g -n >$CONFIGPWF
37
36
 
40
39
fi
41
40
case "$SYNCMODE" in
42
41
        ro)
43
 
                SYNCTYPE="type=refreshOnly interval=00:00:00:10"
 
42
                SYNCTYPE="type=refreshOnly interval=00:00:00:03"
44
43
                ;;
45
44
        rp)
46
45
                SYNCTYPE="type=refreshAndPersist"
53
52
 
54
53
#
55
54
# Test replication of dynamic config:
56
 
# - start producer
57
 
# - start consumer1
58
 
# - start consumer2
 
55
# - start servers
59
56
# - configure over ldap
60
57
# - populate over ldap
61
58
# - configure syncrepl over ldap
63
60
#
64
61
 
65
62
echo "Initializing server configurations..."
66
 
$SLAPADD -F $CFCON2 -n 0 <<EOF
67
 
dn: cn=config
68
 
objectClass: olcGlobal
69
 
cn: config
70
 
olcServerID: 3
71
 
 
72
 
dn: olcDatabase={0}config,cn=config
73
 
objectClass: olcDatabaseConfig
74
 
olcDatabase: {0}config
75
 
olcRootPW:< file://$CONFIGPWF
76
 
EOF
77
 
 
78
 
$SLAPADD -F $CFCON -n 0 <<EOF
79
 
dn: cn=config
80
 
objectClass: olcGlobal
81
 
cn: config
82
 
olcServerID: 2
83
 
 
84
 
dn: olcDatabase={0}config,cn=config
85
 
objectClass: olcDatabaseConfig
86
 
olcDatabase: {0}config
87
 
olcRootPW:< file://$CONFIGPWF
88
 
EOF
89
 
 
90
 
$SLAPADD -F $CFPRO -n 0 <<EOF
91
 
dn: cn=config
92
 
objectClass: olcGlobal
93
 
cn: config
94
 
olcServerID: 1
95
 
 
96
 
dn: olcDatabase={0}config,cn=config
97
 
objectClass: olcDatabaseConfig
98
 
olcDatabase: {0}config
99
 
olcRootPW:< file://$CONFIGPWF
100
 
EOF
101
 
 
102
 
echo "Starting producer slapd on TCP/IP port $PORT1..."
103
 
cd $PRODIR
 
63
n=1
 
64
while [ $n -le $MMR ]; do
 
65
 
 
66
DBDIR=${XDIR}$n/db
 
67
CFDIR=${XDIR}$n/slapd.d
 
68
 
 
69
mkdir -p ${XDIR}$n $DBDIR $CFDIR
 
70
 
 
71
$SLAPADD -F $CFDIR -n 0 <<EOF
 
72
dn: cn=config
 
73
objectClass: olcGlobal
 
74
cn: config
 
75
olcServerID: $n
 
76
 
 
77
dn: olcDatabase={0}config,cn=config
 
78
objectClass: olcDatabaseConfig
 
79
olcDatabase: {0}config
 
80
olcRootPW:< file://$CONFIGPWF
 
81
EOF
 
82
 
 
83
n=`expr $n + 1`
 
84
done
 
85
 
 
86
echo "Starting server 1 on TCP/IP port $PORT1..."
 
87
cd ${XDIR}1
104
88
$SLAPD -F slapd.d -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
105
89
PID=$!
106
90
if test $WAIT != 0 ; then
112
96
 
113
97
sleep 1
114
98
 
115
 
echo "Using ldapsearch to check that producer slapd is running..."
 
99
echo "Using ldapsearch to check that server 1 is running..."
116
100
for i in 0 1 2 3 4 5; do
117
101
        $LDAPSEARCH -s base -b "" -H $URI1 \
118
102
                'objectclass=*' > /dev/null 2>&1
130
114
        exit $RC
131
115
fi
132
116
 
133
 
echo "Inserting syncprov overlay on producer..."
 
117
echo "Inserting syncprov overlay on server 1..."
 
118
echo "" > $TMP
134
119
if [ "$SYNCPROV" = syncprovmod ]; then
135
 
        $LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <<EOF > $TESTOUT 2>&1
 
120
cat <<EOF >> $TMP
136
121
dn: cn=module,cn=config
 
122
changetype: add
137
123
objectClass: olcModuleList
138
124
cn: module
139
125
olcModulePath: ../../../servers/slapd/overlays
140
126
olcModuleLoad: syncprov.la
 
127
 
141
128
EOF
142
 
        RC=$?
143
 
        if test $RC != 0 ; then
144
 
                echo "ldapadd failed for moduleLoad ($RC)!"
145
 
                test $KILLSERVERS != no && kill -HUP $KILLPIDS
146
 
                exit $RC
147
 
        fi
148
129
fi
149
130
#
150
131
# Note that we configure a timeout here; it's possible for both
154
135
# attempt and allow the modifies to complete.
155
136
#
156
137
read CONFIGPW < $CONFIGPWF
157
 
$LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1
158
 
dn: cn=config
159
 
changetype: modify
160
 
replace: olcServerID
161
 
olcServerID: 1 $URI1
162
 
olcServerID: 2 $URI2
163
 
olcServerID: 3 $URI3
 
138
echo "dn: cn=config" >> $TMP
 
139
echo "changetype: modify" >> $TMP
 
140
echo "replace: olcServerID" >> $TMP
 
141
n=1
 
142
while [ $n -le $MMR ]; do
 
143
PORT=`expr $BASEPORT + $n`
 
144
URI="ldap://${LOCALHOST}:$PORT/"
 
145
echo "olcServerID: $n $URI" >> $TMP
 
146
n=`expr $n + 1`
 
147
done
 
148
 
 
149
cat <<EOF >> $TMP
164
150
 
165
151
dn: olcOverlay=syncprov,olcDatabase={0}config,cn=config
166
152
changetype: add
171
157
dn: olcDatabase={0}config,cn=config
172
158
changetype: modify
173
159
add: olcSyncRepl
174
 
olcSyncRepl: rid=001 provider=$URI1 binddn="cn=config" bindmethod=simple
175
 
  credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
176
 
  retry="5 5 300 5" timeout=3
177
 
olcSyncRepl: rid=002 provider=$URI2 binddn="cn=config" bindmethod=simple
178
 
  credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
179
 
  retry="5 5 300 5" timeout=3
180
 
olcSyncRepl: rid=003 provider=$URI3 binddn="cn=config" bindmethod=simple
181
 
  credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
182
 
  retry="5 5 300 5" timeout=3
183
 
-
184
 
add: olcMirrorMode
185
 
olcMirrorMode: TRUE
186
160
EOF
 
161
 
 
162
n=1
 
163
while [ $n -le $MMR ]; do
 
164
PORT=`expr $BASEPORT + $n`
 
165
URI="ldap://${LOCALHOST}:$PORT/"
 
166
echo "olcSyncRepl: rid=00$n provider=$URI binddn=\"cn=config\" bindmethod=simple" >> $TMP
 
167
echo "  credentials=$CONFIGPW searchbase=\"cn=config\" type=refreshAndPersist" >> $TMP
 
168
echo "  retry=\"3 10 300 5\" timeout=3" >> $TMP
 
169
n=`expr $n + 1`
 
170
done
 
171
echo "-" >> $TMP
 
172
echo "add: olcMirrorMode" >> $TMP
 
173
echo "olcMirrorMode: TRUE" >> $TMP
 
174
$LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF < $TMP >> $TESTOUT 2>&1
187
175
RC=$?
188
176
if test $RC != 0 ; then
189
177
        echo "ldapmodify failed for syncrepl config ($RC)!"
191
179
        exit $RC
192
180
fi
193
181
 
194
 
echo "Starting consumer1 slapd on TCP/IP port $PORT2..."
195
 
cd $CONDIR
196
 
$SLAPD -F ./slapd.d -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
 
182
n=2
 
183
while [ $n -le $MMR ]; do
 
184
PORT=`expr $BASEPORT + $n`
 
185
URI="ldap://${LOCALHOST}:$PORT/"
 
186
LOG=$TESTDIR/slapd.$n.log
 
187
echo "Starting server $n on TCP/IP port $PORT..."
 
188
cd ${XDIR}$n
 
189
$SLAPD -F ./slapd.d -h $URI -d $LVL $TIMING > $LOG 2>&1 &
197
190
SLAVEPID=$!
198
191
if test $WAIT != 0 ; then
199
192
    echo SLAVEPID $SLAVEPID
204
197
 
205
198
sleep 1
206
199
 
207
 
echo "Using ldapsearch to check that consumer1 slapd is running..."
208
 
for i in 0 1 2 3 4 5; do
209
 
        $LDAPSEARCH -s base -b "" -H $URI2 \
210
 
                'objectclass=*' > /dev/null 2>&1
211
 
        RC=$?
212
 
        if test $RC = 0 ; then
213
 
                break
214
 
        fi
215
 
        echo "Waiting 5 seconds for slapd to start..."
216
 
        sleep 5
217
 
done
218
 
 
219
 
if test $RC != 0 ; then
220
 
        echo "ldapsearch failed ($RC)!"
221
 
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
222
 
        exit $RC
223
 
fi
224
 
 
225
 
echo "Configuring syncrepl on consumer1..."
226
 
$LDAPMODIFY -D cn=config -H $URI2 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
227
 
dn: olcDatabase={0}config,cn=config
228
 
changetype: modify
229
 
add: olcSyncRepl
230
 
olcSyncRepl: rid=001 provider=$URI1 binddn="cn=config" bindmethod=simple
231
 
  credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
232
 
  retry="5 5 300 5" timeout=3
233
 
olcSyncRepl: rid=002 provider=$URI2 binddn="cn=config" bindmethod=simple
234
 
  credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
235
 
  retry="5 5 300 5" timeout=3
236
 
olcSyncRepl: rid=003 provider=$URI3 binddn="cn=config" bindmethod=simple
237
 
  credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
238
 
  retry="5 5 300 5" timeout=3
239
 
-
240
 
add: olcMirrorMode
241
 
olcMirrorMode: TRUE
242
 
EOF
243
 
 
244
 
echo "Starting consumer2 slapd on TCP/IP port $PORT3..."
245
 
cd $CONDIR2
246
 
$SLAPD -F ./slapd.d -h $URI3 -d $LVL $TIMING > $LOG3 2>&1 &
247
 
SLAVE2PID=$!
248
 
if test $WAIT != 0 ; then
249
 
    echo SLAVE2PID $SLAVE2PID
250
 
    read foo
251
 
fi
252
 
KILLPIDS="$KILLPIDS $SLAVE2PID"
253
 
cd $TESTWD
254
 
 
255
 
sleep 1
256
 
 
257
 
echo "Using ldapsearch to check that consumer2 slapd is running..."
258
 
for i in 0 1 2 3 4 5; do
259
 
        $LDAPSEARCH -s base -b "" -H $URI3 \
260
 
                'objectclass=*' > /dev/null 2>&1
261
 
        RC=$?
262
 
        if test $RC = 0 ; then
263
 
                break
264
 
        fi
265
 
        echo "Waiting 5 seconds for slapd to start..."
266
 
        sleep 5
267
 
done
268
 
 
269
 
if test $RC != 0 ; then
270
 
        echo "ldapsearch failed ($RC)!"
271
 
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
272
 
        exit $RC
273
 
fi
274
 
 
275
 
echo "Configuring syncrepl on consumer2..."
276
 
$LDAPMODIFY -D cn=config -H $URI3 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
277
 
dn: olcDatabase={0}config,cn=config
278
 
changetype: modify
279
 
add: olcSyncRepl
280
 
olcSyncRepl: rid=001 provider=$URI1 binddn="cn=config" bindmethod=simple
281
 
  credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
282
 
  retry="5 5 300 5" timeout=3
283
 
olcSyncRepl: rid=002 provider=$URI2 binddn="cn=config" bindmethod=simple
284
 
  credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
285
 
  retry="5 5 300 5" timeout=3
286
 
olcSyncRepl: rid=003 provider=$URI3 binddn="cn=config" bindmethod=simple
287
 
  credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
288
 
  retry="5 5 300 5" timeout=3
289
 
-
290
 
add: olcMirrorMode
291
 
olcMirrorMode: TRUE
292
 
EOF
293
 
 
294
 
echo "Adding schema and databases on producer..."
 
200
echo "Using ldapsearch to check that server $n is running..."
 
201
for i in 0 1 2 3 4 5; do
 
202
        $LDAPSEARCH -s base -b "" -H $URI \
 
203
                'objectclass=*' > /dev/null 2>&1
 
204
        RC=$?
 
205
        if test $RC = 0 ; then
 
206
                break
 
207
        fi
 
208
        echo "Waiting 5 seconds for slapd to start..."
 
209
        sleep 5
 
210
done
 
211
 
 
212
if test $RC != 0 ; then
 
213
        echo "ldapsearch failed ($RC)!"
 
214
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
215
        exit $RC
 
216
fi
 
217
 
 
218
echo "Configuring syncrepl on server $n..."
 
219
cat <<EOF > $TMP
 
220
dn: olcDatabase={0}config,cn=config
 
221
changetype: modify
 
222
add: olcSyncRepl
 
223
EOF
 
224
j=1
 
225
while [ $j -le $MMR ]; do
 
226
P2=`expr $BASEPORT + $j`
 
227
U2="ldap://${LOCALHOST}:$P2/"
 
228
echo "olcSyncRepl: rid=00$j provider=$U2 binddn=\"cn=config\" bindmethod=simple" >> $TMP
 
229
echo "  credentials=$CONFIGPW searchbase=\"cn=config\" type=refreshAndPersist" >> $TMP
 
230
echo "  retry=\"3 10 300 5\" timeout=3" >> $TMP
 
231
j=`expr $j + 1`
 
232
done
 
233
cat <<EOF >> $TMP
 
234
-
 
235
add: olcMirrorMode
 
236
olcMirrorMode: TRUE
 
237
EOF
 
238
$LDAPMODIFY -D cn=config -H $URI -y $CONFIGPWF < $TMP >>$TESTOUT 2>&1
 
239
n=`expr $n + 1`
 
240
done
 
241
 
 
242
echo "Adding schema and databases on server 1..."
295
243
$LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
296
244
include: file://$ABS_SCHEMADIR/core.ldif
297
245
 
310
258
        exit $RC
311
259
fi
312
260
 
 
261
echo "" > $TMP
313
262
if [ "$BACKENDTYPE" = mod ]; then
314
 
        $LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
 
263
cat <<EOF >> $TMP
315
264
dn: cn=module,cn=config
316
265
objectClass: olcModuleList
317
266
cn: module
318
267
olcModulePath: ../../../servers/slapd/back-$BACKEND
319
268
olcModuleLoad: back_$BACKEND.la
 
269
 
320
270
EOF
321
 
        RC=$?
322
 
        if test $RC != 0 ; then
323
 
                echo "ldapadd failed for backend config ($RC)!"
324
 
                test $KILLSERVERS != no && kill -HUP $KILLPIDS
325
 
                exit $RC
326
 
        fi
327
271
fi
328
272
 
329
 
$LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
 
273
cat <<EOF >> $TMP
330
274
dn: olcDatabase={1}$BACKEND,cn=config
331
275
objectClass: olcDatabaseConfig
332
276
objectClass: olc${BACKEND}Config
335
279
olcDbDirectory: ./db
336
280
olcRootDN: $MANAGERDN
337
281
olcRootPW: $PASSWD
338
 
olcSyncRepl: rid=004 provider=$URI1 binddn="$MANAGERDN" bindmethod=simple
339
 
  credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE
340
 
  retry="5 5 300 5" timeout=3
341
 
olcSyncRepl: rid=005 provider=$URI2 binddn="$MANAGERDN" bindmethod=simple
342
 
  credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE
343
 
  retry="5 5 300 5" timeout=3
344
 
olcSyncRepl: rid=006 provider=$URI3 binddn="$MANAGERDN" bindmethod=simple
345
 
  credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE
346
 
  retry="5 5 300 5" timeout=3
 
282
EOF
 
283
 
 
284
n=1
 
285
while [ $n -le $MMR ]; do
 
286
PORT=`expr $BASEPORT + $n`
 
287
URI="ldap://${LOCALHOST}:$PORT/"
 
288
 
 
289
echo "olcSyncRepl: rid=01$n provider=$URI binddn=\"$MANAGERDN\" bindmethod=simple" >> $TMP
 
290
echo "  credentials=$PASSWD searchbase=\"$BASEDN\" $SYNCTYPE" >> $TMP
 
291
echo "  retry=\"3 10 300 5\" timeout=3" >> $TMP
 
292
n=`expr $n + 1`
 
293
done
 
294
 
 
295
cat <<EOF >> $TMP
347
296
olcMirrorMode: TRUE
348
297
 
349
298
dn: olcOverlay=syncprov,olcDatabase={1}${BACKEND},cn=config
350
 
changetype: add
351
299
objectClass: olcOverlayConfig
352
300
objectClass: olcSyncProvConfig
353
301
olcOverlay: syncprov
354
302
EOF
 
303
$LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF < $TMP >>$TESTOUT 2>&1
355
304
RC=$?
356
305
if test $RC != 0 ; then
357
306
        echo "ldapadd failed for database config ($RC)!"
377
326
        ;;
378
327
esac
379
328
 
380
 
echo "Using ldapadd to populate producer..."
 
329
echo "Using ldapadd to populate server 1..."
381
330
$LDAPADD -D "$MANAGERDN" -H $URI1 -w $PASSWD -f $LDIFORDERED \
382
331
        >> $TESTOUT 2>&1
383
332
RC=$?
384
333
if test $RC != 0 ; then
385
 
        echo "ldapadd failed for producer database ($RC)!"
386
 
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
387
 
        exit $RC
388
 
fi
389
 
 
390
 
SLEEP=20
391
 
echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
392
 
sleep $SLEEP
393
 
 
394
 
echo "Using ldapadd to populate consumer1..."
 
334
        echo "ldapadd failed for server 1 database ($RC)!"
 
335
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
336
        exit $RC
 
337
fi
 
338
 
 
339
echo "Waiting $SLEEP2 seconds for syncrepl to receive changes..."
 
340
sleep $SLEEP2
 
341
 
 
342
n=1
 
343
while [ $n -le $MMR ]; do
 
344
PORT=`expr $BASEPORT + $n`
 
345
URI="ldap://${LOCALHOST}:$PORT/"
 
346
 
 
347
echo "Using ldapsearch to read config from server $n..."
 
348
$LDAPSEARCH -b cn=config -D cn=config -H $URI -y $CONFIGPWF  \
 
349
        'objectclass=*' > $TESTDIR/server$n.out 2>&1
 
350
RC=$?
 
351
 
 
352
if test $RC != 0 ; then
 
353
        echo "ldapsearch failed at server $n ($RC)!"
 
354
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
355
        exit $RC
 
356
fi
 
357
 
 
358
. $LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
 
359
 
 
360
n=`expr $n + 1`
 
361
done
 
362
 
 
363
n=2
 
364
while [ $n -le $MMR ]; do
 
365
echo "Comparing retrieved configs from server 1 and server $n..."
 
366
$CMP $MASTERFLT $TESTDIR/server$n.flt > $CMPOUT
 
367
 
 
368
if test $? != 0 ; then
 
369
        echo "test failed - server 1 and server $n configs differ"
 
370
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
371
        exit 1
 
372
fi
 
373
n=`expr $n + 1`
 
374
done
 
375
 
 
376
n=1
 
377
while [ $n -le $MMR ]; do
 
378
PORT=`expr $BASEPORT + $n`
 
379
URI="ldap://${LOCALHOST}:$PORT/"
 
380
 
 
381
echo "Using ldapsearch to read all the entries from server $n..."
 
382
$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI -w $PASSWD  \
 
383
        'objectclass=*' > $TESTDIR/server$n.out 2>&1
 
384
RC=$?
 
385
 
 
386
if test $RC != 0 ; then
 
387
        echo "ldapsearch failed at server $n ($RC)!"
 
388
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
389
        exit $RC
 
390
fi
 
391
. $LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
 
392
n=`expr $n + 1`
 
393
done
 
394
 
 
395
n=2
 
396
while [ $n -le $MMR ]; do
 
397
echo "Comparing retrieved entries from server 1 and server $n..."
 
398
$CMP $MASTERFLT $TESTDIR/server$n.flt > $CMPOUT
 
399
 
 
400
if test $? != 0 ; then
 
401
        echo "test failed - server 1 and server $n databases differ"
 
402
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
403
        exit 1
 
404
fi
 
405
n=`expr $n + 1`
 
406
done
 
407
 
 
408
echo "Using ldapadd to populate server 2..."
395
409
$LDAPADD -D "$MANAGERDN" -H $URI2 -w $PASSWD -f $LDIFADD1 \
396
410
        >> $TESTOUT 2>&1
397
411
RC=$?
398
412
if test $RC != 0 ; then
399
 
        echo "ldapadd failed for consumer1 database ($RC)!"
400
 
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
401
 
        exit $RC
402
 
fi
403
 
 
404
 
SLEEP=20
405
 
echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
406
 
sleep $SLEEP
407
 
 
408
 
echo "Using ldapadd to populate consumer2..."
 
413
        echo "ldapadd failed for server 2 database ($RC)!"
 
414
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
415
        exit $RC
 
416
fi
 
417
 
 
418
echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
 
419
sleep $SLEEP1
 
420
 
 
421
n=1
 
422
while [ $n -le $MMR ]; do
 
423
PORT=`expr $BASEPORT + $n`
 
424
URI="ldap://${LOCALHOST}:$PORT/"
 
425
 
 
426
echo "Using ldapsearch to read all the entries from server $n..."
 
427
$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI -w $PASSWD  \
 
428
        'objectclass=*' > $TESTDIR/server$n.out 2>&1
 
429
RC=$?
 
430
 
 
431
if test $RC != 0 ; then
 
432
        echo "ldapsearch failed at server $n ($RC)!"
 
433
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
434
        exit $RC
 
435
fi
 
436
. $LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
 
437
n=`expr $n + 1`
 
438
done
 
439
 
 
440
n=2
 
441
while [ $n -le $MMR ]; do
 
442
echo "Comparing retrieved entries from server 1 and server $n..."
 
443
$CMP $MASTERFLT $TESTDIR/server$n.flt > $CMPOUT
 
444
 
 
445
if test $? != 0 ; then
 
446
        echo "test failed - server 1 and server $n databases differ"
 
447
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
448
        exit 1
 
449
fi
 
450
n=`expr $n + 1`
 
451
done
 
452
 
 
453
echo "Using ldapadd to populate server 3..."
409
454
$LDAPADD -D "$MANAGERDN" -H $URI3 -w $PASSWD \
410
455
        << EOMODS >> $TESTOUT 2>&1
411
 
dn: cn=Consumer 2 Test,dc=example,dc=com
 
456
dn: cn=Server 3 Test,dc=example,dc=com
412
457
changetype: add
413
458
objectClass: device
414
 
cn: Consumer 2 Test
 
459
cn: Server 3 Test
415
460
EOMODS
416
461
RC=$?
417
462
if test $RC != 0 ; then
418
 
        echo "ldapadd failed for consumer2 database ($RC)!"
419
 
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
420
 
        exit $RC
421
 
fi
422
 
 
423
 
SLEEP=20
424
 
echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
425
 
sleep $SLEEP
426
 
 
427
 
echo "Using ldapmodify to add to the producer entries that will be deleted..."
 
463
        echo "ldapadd failed for server 3 database ($RC)!"
 
464
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
465
        exit $RC
 
466
fi
 
467
 
 
468
echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
 
469
sleep $SLEEP1
 
470
 
 
471
n=1
 
472
while [ $n -le $MMR ]; do
 
473
PORT=`expr $BASEPORT + $n`
 
474
URI="ldap://${LOCALHOST}:$PORT/"
 
475
 
 
476
echo "Using ldapsearch to read all the entries from server $n..."
 
477
$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI -w $PASSWD  \
 
478
        'objectclass=*' > $TESTDIR/server$n.out 2>&1
 
479
RC=$?
 
480
 
 
481
if test $RC != 0 ; then
 
482
        echo "ldapsearch failed at server $n ($RC)!"
 
483
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
484
        exit $RC
 
485
fi
 
486
. $LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
 
487
n=`expr $n + 1`
 
488
done
 
489
 
 
490
n=2
 
491
while [ $n -le $MMR ]; do
 
492
echo "Comparing retrieved entries from server 1 and server $n..."
 
493
$CMP $MASTERFLT $TESTDIR/server$n.flt > $CMPOUT
 
494
 
 
495
if test $? != 0 ; then
 
496
        echo "test failed - server 1 and server $n databases differ"
 
497
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
498
        exit 1
 
499
fi
 
500
n=`expr $n + 1`
 
501
done
 
502
 
 
503
echo "Using ldapmodify to add to server 1 entries that will be deleted..."
428
504
$LDAPMODIFY -D "$MANAGERDN" -H $URI1 -w $PASSWD \
429
505
        >> $TESTOUT 2>&1 << EOADDS
430
 
dn: cn=To be deleted by producer,dc=example,dc=com
431
 
changetype: add
432
 
objectClass: device
433
 
# no distinguished values, will be added by DSA
434
 
 
435
 
dn: cn=To be deleted by consumer1,dc=example,dc=com
436
 
changetype: add
437
 
objectClass: device
438
 
# no distinguished values, will be added by DSA
439
 
 
440
 
dn: cn=To be deleted by consumer2,dc=example,dc=com
441
 
changetype: add
442
 
objectClass: device
443
 
# no distinguished values, will be added by DSA
444
 
 
445
 
dn: cn=To be deleted by producer,dc=example,dc=com
 
506
dn: cn=To be deleted by server 1,dc=example,dc=com
 
507
changetype: add
 
508
objectClass: device
 
509
# no distinguished values, will be added by DSA
 
510
 
 
511
dn: cn=To be deleted by server 2,dc=example,dc=com
 
512
changetype: add
 
513
objectClass: device
 
514
# no distinguished values, will be added by DSA
 
515
 
 
516
dn: cn=To be deleted by server 3,dc=example,dc=com
 
517
changetype: add
 
518
objectClass: device
 
519
# no distinguished values, will be added by DSA
 
520
 
 
521
dn: cn=To be deleted by server 1,dc=example,dc=com
446
522
changetype: delete
447
523
EOADDS
448
524
RC=$?
449
525
if test $RC != 0 ; then
450
 
        echo "ldapmodify failed for producer database ($RC)!"
451
 
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
452
 
        exit $RC
453
 
fi
454
 
 
455
 
SLEEP=20
456
 
echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
457
 
sleep $SLEEP
458
 
 
459
 
echo "Using ldapmodify to delete entries from consumer1..."
 
526
        echo "ldapmodify failed for server 1 database ($RC)!"
 
527
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
528
        exit $RC
 
529
fi
 
530
 
 
531
echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
 
532
sleep $SLEEP1
 
533
 
 
534
n=1
 
535
while [ $n -le $MMR ]; do
 
536
PORT=`expr $BASEPORT + $n`
 
537
URI="ldap://${LOCALHOST}:$PORT/"
 
538
 
 
539
echo "Using ldapsearch to read all the entries from server $n..."
 
540
$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI -w $PASSWD  \
 
541
        'objectclass=*' > $TESTDIR/server$n.out 2>&1
 
542
RC=$?
 
543
 
 
544
if test $RC != 0 ; then
 
545
        echo "ldapsearch failed at server $n ($RC)!"
 
546
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
547
        exit $RC
 
548
fi
 
549
. $LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
 
550
n=`expr $n + 1`
 
551
done
 
552
 
 
553
n=2
 
554
while [ $n -le $MMR ]; do
 
555
echo "Comparing retrieved entries from server 1 and server $n..."
 
556
$CMP $MASTERFLT $TESTDIR/server$n.flt > $CMPOUT
 
557
 
 
558
if test $? != 0 ; then
 
559
        echo "test failed - server 1 and server $n databases differ"
 
560
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
561
        exit 1
 
562
fi
 
563
n=`expr $n + 1`
 
564
done
 
565
 
 
566
echo "Using ldapmodify to delete entries from server 2..."
460
567
$LDAPMODIFY -D "$MANAGERDN" -H $URI2 -w $PASSWD \
461
568
        >> $TESTOUT 2>&1 << EOADDS
462
 
dn: cn=To be deleted by consumer1,dc=example,dc=com
 
569
dn: cn=To be deleted by server 2,dc=example,dc=com
463
570
changetype: delete
464
571
EOADDS
465
572
RC=$?
466
573
if test $RC != 0 ; then
467
 
        echo "ldapmodify failed for consumer1 database ($RC)!"
 
574
        echo "ldapmodify failed for server 2 database ($RC)!"
468
575
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
469
576
        exit $RC
470
577
fi
471
578
 
472
 
SLEEP=20
473
 
echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
474
 
sleep $SLEEP
 
579
echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
 
580
sleep $SLEEP1
475
581
 
476
 
echo "Using ldapmodify to delete entries from consumer2..."
 
582
echo "Using ldapmodify to delete entries from server 3..."
477
583
$LDAPMODIFY -D "$MANAGERDN" -H $URI3 -w $PASSWD \
478
584
        >> $TESTOUT 2>&1 << EOADDS
479
 
dn: cn=To be deleted by consumer2,dc=example,dc=com
 
585
dn: cn=To be deleted by server 3,dc=example,dc=com
480
586
changetype: delete
481
587
EOADDS
482
588
RC=$?
483
589
if test $RC != 0 ; then
484
 
        echo "ldapmodify failed for consumer2 database ($RC)!"
485
 
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
486
 
        exit $RC
487
 
fi
488
 
 
489
 
SLEEP=20
490
 
echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
491
 
sleep $SLEEP
492
 
 
493
 
echo "Using ldapsearch to check that syncrepl received database changes..."
494
 
RC=32
495
 
for i in 0 1 2 3 4 5; do
496
 
        RESULT=`$LDAPSEARCH -H $URI2 \
497
 
                -s base -b "cn=Ursula Hampster,ou=Alumni Association,ou=People,dc=example,dc=com" \
498
 
                '(objectClass=*)' 2>&1 | awk '/^dn:/ {print "OK"}'`
499
 
        if test "x$RESULT" = "xOK" ; then
500
 
                RC=0
501
 
                break
502
 
        fi
503
 
        echo "Waiting 5 seconds for syncrepl to receive changes..."
504
 
        sleep 5
505
 
done
506
 
 
507
 
if test $RC != 0 ; then
508
 
        echo "ldapsearch failed ($RC)!"
509
 
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
510
 
        exit $RC
511
 
fi
512
 
 
513
 
echo "Using ldapsearch to check that syncrepl received database changes on consumer2..."
514
 
RC=32
515
 
for i in 0 1 2 3 4 5; do
516
 
        RESULT=`$LDAPSEARCH -H $URI3 \
517
 
                -s base -b "cn=Ursula Hampster,ou=Alumni Association,ou=People,dc=example,dc=com" \
518
 
                '(objectClass=*)' 2>&1 | awk '/^dn:/ {print "OK"}'`
519
 
        if test "x$RESULT" = "xOK" ; then
520
 
                RC=0
521
 
                break
522
 
        fi
523
 
        echo "Waiting 5 seconds for syncrepl to receive changes..."
524
 
        sleep 5
525
 
done
526
 
 
527
 
if test $RC != 0 ; then
528
 
        echo "ldapsearch failed ($RC)!"
529
 
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
530
 
        exit $RC
531
 
fi
532
 
 
533
 
echo "Using ldapsearch to read config from the producer..."
534
 
$LDAPSEARCH -b cn=config -D cn=config -H $URI1 -y $CONFIGPWF  \
535
 
        'objectclass=*' > $MASTEROUT 2>&1
536
 
RC=$?
537
 
 
538
 
if test $RC != 0 ; then
539
 
        echo "ldapsearch failed at producer ($RC)!"
540
 
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
541
 
        exit $RC
542
 
fi
543
 
 
544
 
echo "Using ldapsearch to read config from consumer1..."
545
 
$LDAPSEARCH -b cn=config -D cn=config -H $URI2 -y $CONFIGPWF \
546
 
        'objectclass=*' > $SLAVEOUT 2>&1
547
 
RC=$?
548
 
 
549
 
if test $RC != 0 ; then
550
 
        echo "ldapsearch failed at consumer1 ($RC)!"
551
 
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
552
 
        exit $RC
553
 
fi
554
 
 
555
 
echo "Using ldapsearch to read config from consumer2..."
556
 
$LDAPSEARCH -b cn=config -D cn=config -H $URI3 -y $CONFIGPWF \
557
 
        'objectclass=*' > $SLAVE2OUT 2>&1
558
 
RC=$?
559
 
 
560
 
if test $RC != 0 ; then
561
 
        echo "ldapsearch failed at consumer2 ($RC)!"
562
 
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
563
 
        exit $RC
564
 
fi
565
 
 
566
 
echo "Filtering producer results..."
567
 
. $LDIFFILTER < $MASTEROUT > $MASTERFLT
568
 
echo "Filtering consumer1 results..."
569
 
. $LDIFFILTER < $SLAVEOUT > $SLAVEFLT
570
 
echo "Filtering consumer2 results..."
571
 
. $LDIFFILTER < $SLAVE2OUT > $SLAVE2FLT
572
 
 
573
 
echo "Comparing retrieved configs from producer and consumer1..."
574
 
$CMP $MASTERFLT $SLAVEFLT > $CMPOUT
575
 
 
576
 
if test $? != 0 ; then
577
 
        echo "test failed - producer and consumer1 configs differ"
578
 
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
579
 
        exit 1
580
 
fi
581
 
 
582
 
echo "Comparing retrieved configs from producer and consumer2..."
583
 
$CMP $MASTERFLT $SLAVE2FLT > $CMPOUT
584
 
 
585
 
if test $? != 0 ; then
586
 
        echo "test failed - producer and consumer2 configs differ"
587
 
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
588
 
        exit 1
589
 
fi
590
 
 
591
 
echo "Using ldapsearch to read all the entries from the producer..."
592
 
$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI1 -w $PASSWD  \
593
 
        'objectclass=*' > $MASTEROUT 2>&1
594
 
RC=$?
595
 
 
596
 
if test $RC != 0 ; then
597
 
        echo "ldapsearch failed at producer ($RC)!"
598
 
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
599
 
        exit $RC
600
 
fi
601
 
 
602
 
echo "Using ldapsearch to read all the entries from consumer1..."
603
 
$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI2 -w $PASSWD  \
604
 
        'objectclass=*' > $SLAVEOUT 2>&1
605
 
RC=$?
606
 
 
607
 
if test $RC != 0 ; then
608
 
        echo "ldapsearch failed at consumer1 ($RC)!"
609
 
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
610
 
        exit $RC
611
 
fi
612
 
 
613
 
echo "Using ldapsearch to read all the entries from consumer2..."
614
 
$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI3 -w $PASSWD  \
615
 
        'objectclass=*' > $SLAVE2OUT 2>&1
616
 
RC=$?
617
 
 
618
 
if test $RC != 0 ; then
619
 
        echo "ldapsearch failed at consumer2 ($RC)!"
620
 
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
621
 
        exit $RC
622
 
fi
 
590
        echo "ldapmodify failed for server 3 database ($RC)!"
 
591
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
592
        exit $RC
 
593
fi
 
594
 
 
595
echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
 
596
sleep $SLEEP1
 
597
 
 
598
n=1
 
599
while [ $n -le $MMR ]; do
 
600
PORT=`expr $BASEPORT + $n`
 
601
URI="ldap://${LOCALHOST}:$PORT/"
 
602
 
 
603
echo "Using ldapsearch to read all the entries from server $n..."
 
604
$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI -w $PASSWD  \
 
605
        'objectclass=*' > $TESTDIR/server$n.out 2>&1
 
606
RC=$?
 
607
 
 
608
if test $RC != 0 ; then
 
609
        echo "ldapsearch failed at server $n ($RC)!"
 
610
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
611
        exit $RC
 
612
fi
 
613
. $LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
 
614
n=`expr $n + 1`
 
615
done
 
616
 
 
617
n=2
 
618
while [ $n -le $MMR ]; do
 
619
echo "Comparing retrieved entries from server 1 and server $n..."
 
620
$CMP $MASTERFLT $TESTDIR/server$n.flt > $CMPOUT
 
621
 
 
622
if test $? != 0 ; then
 
623
        echo "test failed - server 1 and server $n databases differ"
 
624
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
625
        exit 1
 
626
fi
 
627
n=`expr $n + 1`
 
628
done
623
629
 
624
630
# kill!
625
631
# test $KILLSERVERS != no && kill -HUP $KILLPIDS
626
632
kill -HUP $KILLPIDS
627
633
 
628
 
echo "Filtering producer results..."
629
 
. $LDIFFILTER < $MASTEROUT > $MASTERFLT
630
 
echo "Filtering consumer1 results..."
631
 
. $LDIFFILTER < $SLAVEOUT > $SLAVEFLT
632
 
echo "Filtering consumer2 results..."
633
 
. $LDIFFILTER < $SLAVE2OUT > $SLAVE2FLT
634
 
 
635
 
echo "Comparing retrieved entries from producer and consumer1..."
636
 
$CMP $MASTERFLT $SLAVEFLT > $CMPOUT
637
 
 
638
 
if test $? != 0 ; then
639
 
        echo "test failed - producer and consumer1 databases differ"
640
 
        exit 1
641
 
fi
642
 
 
643
 
echo "Comparing retrieved entries from producer and consumer2..."
644
 
$CMP $MASTERFLT $SLAVE2FLT > $CMPOUT
645
 
 
646
 
if test $? != 0 ; then
647
 
        echo "test failed - producer and consumer2 databases differ"
648
 
        exit 1
649
 
fi
650
 
 
651
634
# kill!
652
635
# test $KILLSERVERS != no && wait
653
636
wait
654
637
 
655
638
echo "Restarting servers..."
656
 
echo "Starting producer slapd on TCP/IP port $PORT1..."
657
 
cd $PRODIR
658
 
echo "======================= RESTART =======================" >> $LOG1
659
 
$SLAPD -F ./slapd.d -h $URI1 -d $LVL $TIMING >> $LOG1 2>&1 &
 
639
KILLPIDS=""
 
640
n=1
 
641
while [ $n -le $MMR ]; do
 
642
PORT=`expr $BASEPORT + $n`
 
643
URI="ldap://${LOCALHOST}:$PORT/"
 
644
LOG=$TESTDIR/slapd.$n.log
 
645
echo "Starting server $n on TCP/IP port $PORT..."
 
646
cd ${XDIR}$n
 
647
echo "======================= RESTART =======================" >> $LOG
 
648
$SLAPD -F ./slapd.d -h $URI -d $LVL $TIMING >> $LOG 2>&1 &
660
649
PID=$!
661
650
if test $WAIT != 0 ; then
662
651
    echo PID $PID
663
652
    read foo
664
653
fi
665
 
KILLPIDS="$PID"
666
 
cd $TESTWD
667
 
echo "Using ldapsearch to check that producer slapd is running..."
668
 
for i in 0 1 2 3 4 5; do
669
 
        $LDAPSEARCH -s base -b "" -H $URI1 \
670
 
                'objectclass=*' > /dev/null 2>&1
671
 
        RC=$?
672
 
        if test $RC = 0 ; then
673
 
                break
674
 
        fi
675
 
        echo "Waiting 5 seconds for slapd to start..."
676
 
        sleep 5
677
 
done
678
 
 
679
 
if test $RC != 0 ; then
680
 
        echo "ldapsearch failed ($RC)!"
681
 
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
682
 
        exit $RC
683
 
fi
684
 
#exit 0
685
 
echo "Starting consumer1 slapd on TCP/IP port $PORT2..."
686
 
cd $CONDIR
687
 
echo "======================= RESTART =======================" >> $LOG2
688
 
$SLAPD -F ./slapd.d -h $URI2 -d $LVL $TIMING >> $LOG2 2>&1 &
689
 
SLAVEPID=$!
690
 
if test $WAIT != 0 ; then
691
 
    echo SLAVEPID $SLAVEPID
692
 
    read foo
693
 
fi
694
 
KILLPIDS="$KILLPIDS $SLAVEPID"
695
 
cd $TESTWD
696
 
 
697
 
sleep 1
698
 
 
699
 
echo "Using ldapsearch to check that consumer1 slapd is running..."
700
 
for i in 0 1 2 3 4 5; do
701
 
        $LDAPSEARCH -s base -b "" -H $URI2 \
702
 
                'objectclass=*' > /dev/null 2>&1
703
 
        RC=$?
704
 
        if test $RC = 0 ; then
705
 
                break
706
 
        fi
707
 
        echo "Waiting 5 seconds for slapd to start..."
708
 
        sleep 5
709
 
done
710
 
 
711
 
if test $RC != 0 ; then
712
 
        echo "ldapsearch failed ($RC)!"
713
 
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
714
 
        exit $RC
715
 
fi
716
 
 
717
 
echo "Starting consumer2 slapd on TCP/IP port $PORT3..."
718
 
cd $CONDIR2
719
 
echo "======================= RESTART =======================" >> $LOG3
720
 
$SLAPD -F ./slapd.d -h $URI3 -d $LVL $TIMING >> $LOG3 2>&1 &
721
 
SLAVE2PID=$!
722
 
if test $WAIT != 0 ; then
723
 
    echo SLAVE2PID $SLAVE2PID
724
 
    read foo
725
 
fi
726
 
KILLPIDS="$KILLPIDS $SLAVE2PID"
727
 
cd $TESTWD
728
 
 
729
 
sleep 1
730
 
 
731
 
echo "Using ldapsearch to check that consumer2 slapd is running..."
732
 
for i in 0 1 2 3 4 5; do
733
 
        $LDAPSEARCH -s base -b "" -H $URI3 \
734
 
                'objectclass=*' > /dev/null 2>&1
735
 
        RC=$?
736
 
        if test $RC = 0 ; then
737
 
                break
738
 
        fi
739
 
        echo "Waiting 5 seconds for slapd to start..."
740
 
        sleep 5
741
 
done
742
 
 
743
 
if test $RC != 0 ; then
744
 
        echo "ldapsearch failed ($RC)!"
745
 
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
746
 
        exit $RC
747
 
fi
 
654
KILLPIDS="$KILLPIDS $PID"
 
655
cd $TESTWD
 
656
echo "Using ldapsearch to check that server $n is running..."
 
657
for i in 0 1 2 3 4 5; do
 
658
        $LDAPSEARCH -s base -b "" -H $URI \
 
659
                'objectclass=*' > /dev/null 2>&1
 
660
        RC=$?
 
661
        if test $RC = 0 ; then
 
662
                break
 
663
        fi
 
664
        echo "Waiting 5 seconds for slapd to start..."
 
665
        sleep 5
 
666
done
 
667
 
 
668
if test $RC != 0 ; then
 
669
        echo "ldapsearch failed ($RC)!"
 
670
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
671
        exit $RC
 
672
fi
 
673
n=`expr $n + 1`
 
674
done
748
675
 
749
676
# Insert modifications and more tests here.
750
 
SLEEP=10
751
 
echo "Waiting $SLEEP seconds for servers to resync..."
752
 
sleep $SLEEP
 
677
echo "Waiting $SLEEP1 seconds for servers to resync..."
 
678
sleep $SLEEP1
753
679
 
754
680
test $KILLSERVERS != no && kill -HUP $KILLPIDS
755
681