3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2003 The OpenLDAP Foundation.
6 ## All rights reserved.
8 ## Redistribution and use in source and binary forms, with or without
9 ## modification, are permitted only as authorized by the OpenLDAP
12 ## A copy of this license is available in the file LICENSE in the
13 ## top-level directory of the distribution or, alternatively, at
14 ## <http://www.OpenLDAP.org/license.html>.
16 echo "running defines.sh"
17 . $SRCDIR/scripts/defines.sh
19 mkdir -p $TESTDIR $DBDIR1 $DBDIR4
25 # - populate over ldap
26 # - perform some modifies and deleted
27 # - retrieve database over ldap and compare against expected results
30 echo "Starting master slapd on TCP/IP port $PORT1..."
31 . $CONFFILTER $BACKEND $MONITORDB < $SRMASTERCONF > $CONF1
32 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
34 if test $WAIT != 0 ; then
40 echo "Using ldapsearch to check that master slapd is running..."
41 for i in 0 1 2 3 4 5; do
42 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
43 'objectclass=*' > /dev/null 2>&1
45 if test $RC = 0 ; then
48 echo "Waiting 5 seconds for slapd to start..."
52 if test $RC != 0 ; then
53 echo "ldapsearch failed ($RC)!"
54 test $KILLSERVERS != no && kill -HUP $KILLPIDS
58 echo "Using ldapadd to create the context prefix entry in the master..."
59 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
60 $LDIFORDEREDCP > /dev/null 2>&1
62 if test $RC != 0 ; then
63 echo "ldapadd failed ($RC)!"
64 test $KILLSERVERS != no && kill -HUP $KILLPIDS
68 echo "Starting slave slapd on TCP/IP port $PORT4..."
69 . $CONFFILTER $BACKEND $MONITORDB < $P1SRSLAVECONF > $CONF4
70 $SLAPD -f $CONF4 -h $URI4 -d $LVL $TIMING > $LOG4 2>&1 &
72 if test $WAIT != 0 ; then
73 echo SLAVEPID $SLAVEPID
76 KILLPIDS="$KILLPIDS $SLAVEPID"
78 echo "Using ldapsearch to check that slave slapd is running..."
79 for i in 0 1 2 3 4 5; do
80 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT4 \
81 'objectclass=*' > /dev/null 2>&1
83 if test $RC = 0 ; then
86 echo "Waiting 5 seconds for slapd to start..."
90 if test $RC != 0 ; then
91 echo "ldapsearch failed ($RC)!"
92 test $KILLSERVERS != no && kill -HUP $KILLPIDS
96 echo "Using ldapadd to populate the master directory..."
97 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
98 $LDIFORDEREDNOCP > /dev/null 2>&1
100 if test $RC != 0 ; then
101 echo "ldapadd failed ($RC)!"
102 test $KILLSERVERS != no && kill -HUP $KILLPIDS
106 echo "Waiting 15 seconds for syncrepl to receive changes..."
109 echo "Using ldapmodify to modify master directory..."
112 # Do some modifications
115 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD > \
116 $TESTOUT 2>&1 << EOMODS
117 dn: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
128 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
134 dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
137 uniquemember: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
138 uniquemember: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
141 uniquemember: cn=Dorothy Stevens, ou=Alumni Association, ou=People, o=University of Michigan, c=US
142 uniquemember: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
144 dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US
148 dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
150 objectclass: OpenLDAPperson
154 title: Chief Investigator, ITD
155 postaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
156 seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
158 homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
159 description: Very odd
160 facsimiletelephonenumber: +1 313 555 7557
161 telephonenumber: +1 313 555 8343
162 mail: gjensen@mailgw.example.com
163 homephone: +1 313 555 8844
165 dn: ou=Retired, ou=People, o=University of Michigan, c=US
167 objectclass: organizationalUnit
170 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
172 objectclass: OpenLDAPperson
173 cn: Rosco P. Coltrane
177 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
179 newrdn: cn=Rosco P. Coltrane
181 newsuperior: ou=Retired, ou=People, o=University of Michigan, c=US
183 dn: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
189 if test $RC != 0 ; then
190 echo "ldapmodify failed ($RC)!"
191 test $KILLSERVERS != no && kill -HUP $KILLPIDS
195 echo "Waiting 15 seconds for syncrepl to receive changes..."
198 echo "Using ldapsearch to read all the entries from the master..."
199 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
200 'objectclass=*' > $MASTEROUT 2>&1
203 if test $RC != 0 ; then
204 echo "ldapsearch failed at master ($RC)!"
205 test $KILLSERVERS != no && kill -HUP $KILLPIDS
209 echo "Using ldapsearch to read all the entries from the slave..."
210 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT4 \
211 'objectclass=*' > $SLAVEOUT 2>&1
214 if test $RC != 0 ; then
215 echo "ldapsearch failed at slave ($RC)!"
216 test $KILLSERVERS != no && kill -HUP $KILLPIDS
220 test $KILLSERVERS != no && kill -HUP $KILLPIDS
222 echo "Filtering master results..."
223 . $LDIFFILTER < $MASTEROUT > $MASTERFLT
224 echo "Filtering slave results..."
225 . $LDIFFILTER < $SLAVEOUT > $SLAVEFLT
227 echo "Comparing retrieved entries from master and slave..."
228 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
230 if test $? != 0 ; then
231 echo "test failed - master and slave databases differ"
235 echo ">>>>> Test succeeded"