~ubuntu-branches/ubuntu/maverick/openldap/maverick-proposed

« 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-02-18 18:44:00 UTC
  • mfrom: (1.1.2 upstream) (0.1.2 lenny)
  • Revision ID: james.westby@ubuntu.com-20090218184400-zw4mjse9eywt5566
Tags: 2.4.14-0ubuntu1
[ Steve Langasek ]
* New upstream version
  - Fixes a bug with the pcache overlay not returning cached entries
    (closes: #497697)
  - Update evolution-ntlm patch to apply to current Makefiles.
  - (tentatively) drop gnutls-ciphers, since this bug was reported to be
    fixed upstream in 2.4.8.  The fix applied in 2.4.8 didn't match the
    patch from the bug report, so this should be watched for regressions.
* Build against db4.7 instead of db4.2 at last!  Closes: #421946.
* Build with --disable-ndb, to avoid a misbuild when libmysqlclient is
  installed in the build environment.
* New patch, no-crlcheck-for-gnutls, to fix a build failure when using
  --with-tls=gnutls.

[ Mathias Gug ]
* Merge from debian unstable, remaining changes:
  - debian/apparmor-profile: add AppArmor profile
  - debian/slapd.postinst: Reload AA profile on configuration
  - updated debian/slapd.README.Debian for note on AppArmor
  - 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 apparmour-profiles gets
    installed it won't overwrite our profile.
  - Modify Maintainer value to match the DebianMaintainerField
    speficication.
  - follow ApparmorProfileMigration and force apparmor compalin mode on 
    some upgrades (LP: #203529)
  - debian/slapd.dirs: add etc/apparmor.d/force-complain
  - 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/slapd.postrm: remove symlink in force-complain/ on purge
  - debian/patches/fix-ucred-libc due to changes how newer glibc handle
    the ucred struct now.
  - debian/control:
    - Build-depend on libltdl7-dev rather then libltdl3-dev.
  - debian/patches/autogen.sh:
    - Call libtoolize with the --install option to install config.{guess,sub}
      files.
  - Don't use local statement in config script as it fails if /bin/sh
    points to bash (LP: #286063).
  - Disable the testsuite on hppa. Allows building of packages on this
    architecture again, once this package is in the archive.
    LP: #288908.
  - 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). (LP: #257667).
  - 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/patches/corrupt-contextCSN: The contextCSN can get corrupted at
  times. (ITS: #5947)

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.8 2008/05/05 21:42:54 quanah Exp $
 
2
# $OpenLDAP: pkg/ldap/tests/scripts/test050-syncrepl-multimaster,v 1.3.2.13 2009/02/02 22:42:42 quanah Exp $
3
3
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4
4
##
5
 
## Copyright 1998-2008 The OpenLDAP Foundation.
 
5
## Copyright 1998-2009 The OpenLDAP Foundation.
6
6
## All rights reserved.
7
7
##
8
8
## Redistribution and use in source and binary forms, with or without
22
22
fi 
23
23
 
24
24
PRODIR=$TESTDIR/pro
25
 
CONDIR=$TESTDIR/con
 
25
CONDIR=$TESTDIR/con1
26
26
CONDIR2=$TESTDIR/con2
27
27
DBPRO=$PRODIR/db
28
28
DBCON=$CONDIR/db
35
35
 
36
36
$SLAPPASSWD -g -n >$CONFIGPWF
37
37
 
 
38
if test x"$SYNCMODE" = x ; then
 
39
        SYNCMODE=rp
 
40
fi
 
41
case "$SYNCMODE" in
 
42
        ro)
 
43
                SYNCTYPE="type=refreshOnly interval=00:00:00:10"
 
44
                ;;
 
45
        rp)
 
46
                SYNCTYPE="type=refreshAndPersist"
 
47
                ;;
 
48
        *)
 
49
                echo "unknown sync mode $SYNCMODE"
 
50
                exit 1;
 
51
                ;;
 
52
esac
 
53
 
38
54
#
39
55
# Test replication of dynamic config:
40
56
# - start producer
41
 
# - start consumer
 
57
# - start consumer1
42
58
# - start consumer2
43
59
# - configure over ldap
44
60
# - populate over ldap
175
191
        exit $RC
176
192
fi
177
193
 
178
 
echo "Starting consumer slapd on TCP/IP port $PORT2..."
 
194
echo "Starting consumer1 slapd on TCP/IP port $PORT2..."
179
195
cd $CONDIR
180
196
$SLAPD -F ./slapd.d -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
181
197
SLAVEPID=$!
188
204
 
189
205
sleep 1
190
206
 
191
 
echo "Using ldapsearch to check that consumer slapd is running..."
 
207
echo "Using ldapsearch to check that consumer1 slapd is running..."
192
208
for i in 0 1 2 3 4 5; do
193
209
        $LDAPSEARCH -s base -b "" -H $URI2 \
194
210
                'objectclass=*' > /dev/null 2>&1
206
222
        exit $RC
207
223
fi
208
224
 
209
 
echo "Configuring syncrepl on consumer..."
 
225
echo "Configuring syncrepl on consumer1..."
210
226
$LDAPMODIFY -D cn=config -H $URI2 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
211
227
dn: olcDatabase={0}config,cn=config
212
228
changetype: modify
320
336
olcRootDN: $MANAGERDN
321
337
olcRootPW: $PASSWD
322
338
olcSyncRepl: rid=004 provider=$URI1 binddn="$MANAGERDN" bindmethod=simple
323
 
  credentials=$PASSWD searchbase="$BASEDN" type=refreshOnly
324
 
  interval=00:00:00:10 retry="5 5 300 5" timeout=3
 
339
  credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE
 
340
  retry="5 5 300 5" timeout=3
325
341
olcSyncRepl: rid=005 provider=$URI2 binddn="$MANAGERDN" bindmethod=simple
326
 
  credentials=$PASSWD searchbase="$BASEDN" type=refreshOnly
327
 
  interval=00:00:00:10 retry="5 5 300 5" timeout=3
 
342
  credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE
 
343
  retry="5 5 300 5" timeout=3
328
344
olcSyncRepl: rid=006 provider=$URI3 binddn="$MANAGERDN" bindmethod=simple
329
 
  credentials=$PASSWD searchbase="$BASEDN" type=refreshOnly
330
 
  interval=00:00:00:10 retry="5 5 300 5" timeout=3
 
345
  credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE
 
346
  retry="5 5 300 5" timeout=3
331
347
olcMirrorMode: TRUE
332
348
 
333
349
dn: olcOverlay=syncprov,olcDatabase={1}${BACKEND},cn=config
343
359
        exit $RC
344
360
fi
345
361
 
 
362
case $BACKEND in
 
363
bdb | hdb)
 
364
        $LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
 
365
dn: olcDatabase={1}$BACKEND,cn=config
 
366
changetype: modify
 
367
add: olcDbIndex
 
368
olcDbIndex: objectClass,entryUUID,entryCSN eq
 
369
olcDbIndex: cn,uid pres,eq,sub
 
370
EOF
 
371
        RC=$?
 
372
        if test $RC != 0 ; then
 
373
                echo "ldapadd modify for database config ($RC)!"
 
374
                test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
375
                exit $RC
 
376
        fi
 
377
        ;;
 
378
esac
 
379
 
346
380
echo "Using ldapadd to populate producer..."
347
381
$LDAPADD -D "$MANAGERDN" -H $URI1 -w $PASSWD -f $LDIFORDERED \
348
382
        >> $TESTOUT 2>&1
357
391
echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
358
392
sleep $SLEEP
359
393
 
360
 
echo "Using ldapadd to populate consumer..."
 
394
echo "Using ldapadd to populate consumer1..."
361
395
$LDAPADD -D "$MANAGERDN" -H $URI2 -w $PASSWD -f $LDIFADD1 \
362
396
        >> $TESTOUT 2>&1
363
397
RC=$?
364
398
if test $RC != 0 ; then
365
 
        echo "ldapadd failed for consumer database ($RC)!"
 
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..."
 
409
$LDAPADD -D "$MANAGERDN" -H $URI3 -w $PASSWD \
 
410
        << EOMODS >> $TESTOUT 2>&1
 
411
dn: cn=Consumer 2 Test,dc=example,dc=com
 
412
changetype: add
 
413
objectClass: device
 
414
cn: Consumer 2 Test
 
415
EOMODS
 
416
RC=$?
 
417
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..."
 
428
$LDAPMODIFY -D "$MANAGERDN" -H $URI1 -w $PASSWD \
 
429
        >> $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
 
446
changetype: delete
 
447
EOADDS
 
448
RC=$?
 
449
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..."
 
460
$LDAPMODIFY -D "$MANAGERDN" -H $URI2 -w $PASSWD \
 
461
        >> $TESTOUT 2>&1 << EOADDS
 
462
dn: cn=To be deleted by consumer1,dc=example,dc=com
 
463
changetype: delete
 
464
EOADDS
 
465
RC=$?
 
466
if test $RC != 0 ; then
 
467
        echo "ldapmodify failed for consumer1 database ($RC)!"
 
468
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
469
        exit $RC
 
470
fi
 
471
 
 
472
SLEEP=20
 
473
echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
 
474
sleep $SLEEP
 
475
 
 
476
echo "Using ldapmodify to delete entries from consumer2..."
 
477
$LDAPMODIFY -D "$MANAGERDN" -H $URI3 -w $PASSWD \
 
478
        >> $TESTOUT 2>&1 << EOADDS
 
479
dn: cn=To be deleted by consumer2,dc=example,dc=com
 
480
changetype: delete
 
481
EOADDS
 
482
RC=$?
 
483
if test $RC != 0 ; then
 
484
        echo "ldapmodify failed for consumer2 database ($RC)!"
366
485
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
367
486
        exit $RC
368
487
fi
422
541
        exit $RC
423
542
fi
424
543
 
425
 
echo "Using ldapsearch to read config from the consumer..."
 
544
echo "Using ldapsearch to read config from consumer1..."
426
545
$LDAPSEARCH -b cn=config -D cn=config -H $URI2 -y $CONFIGPWF \
427
546
        'objectclass=*' > $SLAVEOUT 2>&1
428
547
RC=$?
429
548
 
430
549
if test $RC != 0 ; then
431
 
        echo "ldapsearch failed at consumer ($RC)!"
 
550
        echo "ldapsearch failed at consumer1 ($RC)!"
432
551
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
433
552
        exit $RC
434
553
fi
446
565
 
447
566
echo "Filtering producer results..."
448
567
. $LDIFFILTER < $MASTEROUT > $MASTERFLT
449
 
echo "Filtering consumer results..."
 
568
echo "Filtering consumer1 results..."
450
569
. $LDIFFILTER < $SLAVEOUT > $SLAVEFLT
451
570
echo "Filtering consumer2 results..."
452
571
. $LDIFFILTER < $SLAVE2OUT > $SLAVE2FLT
453
572
 
454
 
echo "Comparing retrieved configs from producer and consumer..."
 
573
echo "Comparing retrieved configs from producer and consumer1..."
455
574
$CMP $MASTERFLT $SLAVEFLT > $CMPOUT
456
575
 
457
576
if test $? != 0 ; then
458
 
        echo "test failed - producer and consumer configs differ"
 
577
        echo "test failed - producer and consumer1 configs differ"
459
578
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
460
579
        exit 1
461
580
fi
480
599
        exit $RC
481
600
fi
482
601
 
483
 
echo "Using ldapsearch to read all the entries from the consumer..."
 
602
echo "Using ldapsearch to read all the entries from consumer1..."
484
603
$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI2 -w $PASSWD  \
485
604
        'objectclass=*' > $SLAVEOUT 2>&1
486
605
RC=$?
487
606
 
488
607
if test $RC != 0 ; then
489
 
        echo "ldapsearch failed at consumer ($RC)!"
 
608
        echo "ldapsearch failed at consumer1 ($RC)!"
490
609
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
491
610
        exit $RC
492
611
fi
493
612
 
494
 
echo "Using ldapsearch to read all the entries from the consumer2..."
 
613
echo "Using ldapsearch to read all the entries from consumer2..."
495
614
$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI3 -w $PASSWD  \
496
615
        'objectclass=*' > $SLAVE2OUT 2>&1
497
616
RC=$?
502
621
        exit $RC
503
622
fi
504
623
 
505
 
 
506
 
test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
624
# kill!
 
625
# test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
626
kill -HUP $KILLPIDS
507
627
 
508
628
echo "Filtering producer results..."
509
629
. $LDIFFILTER < $MASTEROUT > $MASTERFLT
510
 
echo "Filtering consumer results..."
 
630
echo "Filtering consumer1 results..."
511
631
. $LDIFFILTER < $SLAVEOUT > $SLAVEFLT
512
632
echo "Filtering consumer2 results..."
513
633
. $LDIFFILTER < $SLAVE2OUT > $SLAVE2FLT
514
634
 
515
 
echo "Comparing retrieved entries from producer and consumer..."
 
635
echo "Comparing retrieved entries from producer and consumer1..."
516
636
$CMP $MASTERFLT $SLAVEFLT > $CMPOUT
517
637
 
518
638
if test $? != 0 ; then
519
 
        echo "test failed - producer and consumer databases differ"
 
639
        echo "test failed - producer and consumer1 databases differ"
520
640
        exit 1
521
641
fi
522
642
 
528
648
        exit 1
529
649
fi
530
650
 
531
 
test $KILLSERVERS != no && wait
 
651
# kill!
 
652
# test $KILLSERVERS != no && wait
 
653
wait
532
654
 
533
655
echo "Restarting servers..."
534
656
echo "Starting producer slapd on TCP/IP port $PORT1..."
560
682
        exit $RC
561
683
fi
562
684
#exit 0
563
 
echo "Starting consumer slapd on TCP/IP port $PORT2..."
 
685
echo "Starting consumer1 slapd on TCP/IP port $PORT2..."
564
686
cd $CONDIR
565
687
echo "======================= RESTART =======================" >> $LOG2
566
688
$SLAPD -F ./slapd.d -h $URI2 -d $LVL $TIMING >> $LOG2 2>&1 &
574
696
 
575
697
sleep 1
576
698
 
577
 
echo "Using ldapsearch to check that consumer slapd is running..."
 
699
echo "Using ldapsearch to check that consumer1 slapd is running..."
578
700
for i in 0 1 2 3 4 5; do
579
701
        $LDAPSEARCH -s base -b "" -H $URI2 \
580
702
                'objectclass=*' > /dev/null 2>&1