5 if test $# -ge 1 ; then
9 if test $# -ge 1 ; then
13 if test $# -ge 1 ; then
17 if test $# -ge 1 ; then
21 echo "running defines.sh"
22 . $SRCDIR/scripts/defines.sh
24 echo "Cleaning up in $DBDIR..."
28 echo "Running slapadd to build slapd database..."
29 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $DBCONF
30 $SLAPADD -f $DBCONF -l $LDIFORDERED
32 if test $RC != 0 ; then
33 echo "slapadd failed ($RC)!"
37 echo "Starting slapd on TCP/IP port $PORT..."
38 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
40 if test $WAIT != 0 ; then
44 echo "Testing slapd modrdn operations..."
46 # Make sure we can search the database
47 for i in 0 1 2 3 4 5; do
48 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
49 'objectClass=*' > $INITOUT 2>&1
51 if test $RC = 0 ; then
54 echo "Waiting 5 seconds for slapd to start..."
58 if test $RC != 0 ; then
59 echo "ldapsearch failed ($RC)!"
64 # -r used to do remove of old rdn
66 echo "Testing modrdn(deleteoldrdn=0)..."
67 $LDAPMODRDN -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD > \
68 $TESTOUT 2>&1 'cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US' 'cn=James A Jones III'
71 if test $RC != 0 ; then
72 echo "ldapmodrdn failed ($RC)!"
77 echo "Testing modrdn(deleteoldrdn=1)..."
78 $LDAPMODRDN -D "$MANAGERDN" -r -h $LOCALHOST -p $PORT -w $PASSWD >> \
79 $TESTOUT 2>&1 'cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US' 'cn=James A Jones II'
82 if test $RC != 0 ; then
83 echo "ldapmodrdn failed ($RC)!"
88 # Ensure the new rdn's can be found
90 echo "Using ldapsearch to retrieve entries using new rdn (cn=James A Jones III)..."
91 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
92 'cn=James A Jones III' > $SEARCHOUT 2>&1
94 if test $RC != 0 ; then
95 echo "ldapsearch failed ($RC)!"
101 LDIF=$MODRDNOUTMASTER1
103 echo "Filtering ldapsearch results..."
104 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
105 echo "Filtering original ldif used to create database..."
106 . $LDIFFILTER < $LDIF > $LDIFFLT
107 echo "Comparing filter output..."
108 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
110 if test $? != 0 ; then
111 echo "comparison failed - modrdn operations did not complete correctly"
117 echo "Using ldapsearch to retrieve entries using new rdn (cn=James A Jones II)..."
118 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
119 'cn=James A Jones II' > $SEARCHOUT 2>&1
121 if test $RC != 0 ; then
122 echo "ldapsearch failed ($RC)!"
128 LDIF=$MODRDNOUTMASTER2
130 echo "Filtering ldapsearch results..."
131 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
132 echo "Filtering original ldif used to create database..."
133 . $LDIFFILTER < $LDIF > $LDIFFLT
134 echo "Comparing filter output..."
135 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
137 if test $? != 0 ; then
138 echo "comparison failed - modrdn operations did not complete correctly"
143 # Ensure that you cannot find the entry for which the rdn was deleted as
146 echo "Using ldapsearch to retrieve entries using removed rdn (cn=James A Jones 2)..."
147 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
148 'cn=James A Jones 2' > $SEARCHOUT 2>&1
150 if test $RC != 0 ; then
152 echo "ldapsearch failed ($RC)!"
155 $CMP $SEARCHOUT - < /dev/null > $CMPOUT
156 if test $? != 0 ; then
157 echo "failure: ldapsearch found attribute that was to be removed!"
162 echo "Using ldapsearch to retrieve all the entries..."
163 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
164 'objectClass=*' > $SEARCHOUT 2>&1
166 if test $RC != 0 ; then
168 echo "ldapsearch failed ($RC)!"
172 LDIF=$MODRDNOUTMASTER0
174 echo "Filtering ldapsearch results..."
175 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
176 echo "Filtering original ldif used to create database..."
177 . $LDIFFILTER < $LDIF > $LDIFFLT
178 echo "Comparing filter output..."
179 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
181 if test $? != 0 ; then
182 echo "comparison failed - modrdn operations did not complete correctly"
188 echo "Testing modrdn(deleteoldrdn=1), modrdn with new rdn already an att val..."
189 $LDAPMODRDN -D "$MANAGERDN" -r -h $LOCALHOST -p $PORT -w $PASSWD > \
190 /dev/null 2>&1 'cn=James A Jones III, ou=Alumni Association, ou=People, o=University of Michigan, c=US' 'cn=James A Jones 1'
193 if test $RC != 0 ; then
194 echo "ldapmodrdn failed ($RC)!"
199 # Test that you can use modrdn with an attribute value which was previously
202 echo "Using ldapsearch to retrieve entries using new rdn (cn=James A Jones 1)..."
203 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
204 'cn=James A Jones 1' > $SEARCHOUT 2>&1
209 if test $RC != 0 ; then
210 echo "ldapsearch failed ($RC)!"
214 LDIF=$MODRDNOUTMASTER3
216 echo "Filtering ldapsearch results..."
217 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
218 echo "Filtering original ldif used to create database..."
219 . $LDIFFILTER < $LDIF > $LDIFFLT
220 echo "Comparing filter output..."
221 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
223 if test $? != 0 ; then
224 echo "comparison failed - modrdn operations did not complete correctly"
228 echo ">>>>> Test succeeded"