5 if test $# -ge 1 ; then
9 . $SRCDIR/scripts/args.sh
11 if test "$BACKEND" != "bdb" -a "$BACKEND" != "hdb"; then
12 echo "Test only valid for back-bdb"
16 echo "running defines.sh"
17 . $SRCDIR/scripts/defines.sh
23 # - populate over ldap
24 # - perform some modifies and deleted
25 # - retrieve database over ldap and compare against expected results
28 echo "Cleaning up in $DBDIR..."
30 echo "Cleaning up in $REPLDIR..."
33 echo "Starting master slapd on TCP/IP port $PORT..."
34 . $CONFFILTER $BACKEND $MONITORDB < $SRMASTERCONF > $DBCONF
35 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
37 if test $WAIT != 0 ; then
42 echo "Waiting 5 seconds to wait for master to start..."
45 echo "Using ldapsearch to check that master slapd is running..."
46 for i in 0 1 2 3 4 5; do
47 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
48 'objectclass=*' > /dev/null 2>&1
50 if test $RC = 0 ; then
53 echo "Waiting 5 seconds for slapd to start..."
57 echo "Using ldapadd to create the context prefix entry in the master..."
58 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
59 $LDIFORDEREDCP > /dev/null 2>&1
61 if test $RC != 0 ; then
62 echo "ldapadd failed ($RC)!"
63 kill -HUP $PID $SLAVEPID
67 echo "Starting slave slapd on TCP/IP port $SLAVEPORT..."
68 . $CONFFILTER $BACKEND $MONITORDB < $SRREFSLAVECONF > $REPLCONF
69 $SLAPD -f $REPLCONF -h $SLAVEURI -d $LVL $TIMING > $SLAVELOG 2>&1 &
71 if test $WAIT != 0 ; then
72 echo SLAVEPID $SLAVEPID
76 echo "Using ldapsearch to check that slave slapd is running..."
77 for i in 0 1 2 3 4 5; do
78 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $SLAVEPORT \
79 'objectclass=*' > /dev/null 2>&1
81 if test $RC = 0 ; then
84 echo "Waiting 5 seconds for slapd to start..."
88 echo "Using ldapadd to populate the master directory..."
89 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
90 $LDIFORDEREDNOCP > /dev/null 2>&1
92 if test $RC != 0 ; then
93 echo "ldapadd failed ($RC)!"
94 kill -HUP $PID $SLAVEPID
98 echo "Waiting 30 seconds for syncrepl to receive changes..."
101 echo "Using ldapmodify to modify master directory..."
104 # Do some modifications
107 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD > \
108 $TESTOUT 2>&1 << EOMODS
109 dn: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
120 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
126 dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
129 member: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
130 member: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
133 member: cn=Dorothy Stevens, ou=Alumni Association, ou=People, o=University of Michigan, c=US
134 member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
136 dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US
140 dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
142 objectclass: OpenLDAPperson
146 title: Chief Investigator, ITD
147 postaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
148 seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
150 homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
151 description: Very odd
152 facsimiletelephonenumber: +1 313 555 7557
153 telephonenumber: +1 313 555 8343
154 mail: gjensen@mailgw.example.com
155 homephone: +1 313 555 8844
157 dn: ou=Retired, ou=People, o=University of Michigan, c=US
159 objectclass: organizationalUnit
162 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
164 objectclass: OpenLDAPperson
165 cn: Rosco P. Coltrane
169 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
171 newrdn: cn=Rosco P. Coltrane
173 newsuperior: ou=Retired, ou=People, o=University of Michigan, c=US
175 dn: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
180 echo "Waiting 30 seconds for syncrepl to receive changes..."
183 echo "Using ldapsearch to read all the entries from the master..."
184 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
185 'objectclass=*' > $MASTEROUT 2>&1
188 if test $RC != 0 ; then
189 echo "ldapsearch failed at master ($RC)!"
190 kill -HUP $PID $SLAVEPID
194 echo "Using ldapsearch to read all the entries from the slave..."
195 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
196 'objectclass=*' > $SLAVEOUT 2>&1
199 if test $RC != 0 ; then
200 echo "ldapsearch failed at slave ($RC)!"
201 kill -HUP $PID $SLAVEPID
205 kill -HUP $PID $SLAVEPID
210 echo "Filtering ldapsearch results..."
211 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
212 echo "Filtering original ldif used to create database..."
213 . $LDIFFILTER < $LDIF > $LDIFFLT
215 echo "Comparing retrieved entries from master and slave..."
216 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
218 if test $? != 0 ; then
219 echo "test failed - master and slave databases differ"
223 echo ">>>>> Test succeeded"