5 if test $# -ge 1 ; then
9 . $SRCDIR/scripts/args.sh $*
11 echo "running defines.sh"
12 . $SRCDIR/scripts/defines.sh
18 # - populate over ldap
19 # - perform some modifies and deleted
20 # - retrieve database over ldap and compare against expected results
23 echo "Cleaning up in $DBDIR..."
25 echo "Resetting $R1REPLDIR..."
30 if test $BACKEND = ldbm; then
31 if test $SYNCREPL = no; then
32 echo "Sync replication requires back-bdb or back-hdb"
37 echo "Starting master slapd on TCP/IP port $PORT..."
38 . $CONFFILTER $BACKEND $MONITORDB < $SRMASTERCONF > $DBCONF
39 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
41 if test $WAIT != 0 ; then
47 echo "Waiting 5 seconds to wait for master to start..."
50 echo "Using ldapsearch to check that master slapd is running..."
51 for i in 0 1 2 3 4 5; do
52 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
53 'objectclass=*' > /dev/null 2>&1
55 if test $RC = 0 ; then
58 echo "Waiting 5 seconds for slapd to start..."
62 echo "Using ldapadd to create the context prefix entry in the master..."
63 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
64 $LDIFORDEREDCP > /dev/null 2>&1
66 if test $RC != 0 ; then
67 echo "ldapadd failed ($RC)!"
68 kill -HUP $PID $SLAVEPID
72 echo "Starting slave slapd on TCP/IP port $R1SLAVEPORT..."
73 . $CONFFILTER $BACKEND $MONITORDB < $R1SRSLAVECONF > $R1REPLCONF
74 $SLAPD -f $R1REPLCONF -h $R1SLAVEURI -d $LVL $TIMING > $R1SLAVELOG 2>&1 &
76 if test $WAIT != 0 ; then
77 echo SLAVEPID $R1SLAVEPID
81 echo "Using ldapsearch to check that slave slapd is running..."
82 for i in 0 1 2 3 4 5; do
83 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $R1SLAVEPORT \
84 'objectclass=*' > /dev/null 2>&1
86 if test $RC = 0 ; then
89 echo "Waiting 5 seconds for slapd to start..."
93 echo "Using ldapadd to populate the master directory..."
94 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
95 $LDIFORDEREDNOCP > /dev/null 2>&1
97 if test $RC != 0 ; then
98 echo "ldapadd failed ($RC)!"
99 kill -HUP $PID $SLAVEPID
103 echo "Waiting 90 seconds for syncrepl to receive changes..."
106 echo "Using ldapmodify to modify master directory..."
109 # Do some modifications
112 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD > \
113 $TESTOUT 2>&1 << EOMODS
114 dn: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
125 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
131 dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
134 member: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
135 member: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
138 member: cn=Dorothy Stevens, ou=Alumni Association, ou=People, o=University of Michigan, c=US
139 member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
141 dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US
145 dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
147 objectclass: OpenLDAPperson
151 title: Chief Investigator, ITD
152 postaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
153 seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
155 homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
156 description: Very odd
157 facsimiletelephonenumber: +1 313 555 7557
158 telephonenumber: +1 313 555 8343
159 mail: gjensen@mailgw.example.com
160 homephone: +1 313 555 8844
162 dn: ou=Retired, ou=People, o=University of Michigan, c=US
164 objectclass: organizationalUnit
167 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
169 objectclass: OpenLDAPperson
170 cn: Rosco P. Coltrane
174 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
176 newrdn: cn=Rosco P. Coltrane
178 newsuperior: ou=Retired, ou=People, o=University of Michigan, c=US
180 dn: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
185 echo "Waiting 90 seconds for syncrepl to receive changes..."
188 echo "Using ldapsearch to read all the entries from the master..."
189 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
190 'objectclass=*' > $MASTEROUT 2>&1
193 if test $RC != 0 ; then
194 echo "ldapsearch failed at master ($RC)!"
195 kill -HUP $PID $SLAVEPID
199 echo "Using ldapsearch to read all the entries from the slave..."
200 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $R1SLAVEPORT \
201 'objectclass=*' > $R1SLAVEOUT 2>&1
204 if test $RC != 0 ; then
205 echo "ldapsearch failed at slave ($RC)!"
206 kill -HUP $PID $R1SLAVEPID
210 kill -HUP $PID $R1SLAVEPID
215 echo "Filtering ldapsearch results..."
216 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
217 echo "Filtering original ldif used to create database..."
218 . $LDIFFILTER < $LDIF > $R1LDIFFLT
220 echo "Comparing retrieved entries from master and slave..."
221 $CMP $SEARCHFLT $R1LDIFFLT > $CMPOUT
223 if test $? != 0 ; then
224 echo "test failed - master and slave databases differ"
228 echo ">>>>> Test succeeded"