5 if test $# -ge 1 ; then
9 if test $# -ge 1 ; then
13 echo "running defines.sh"
14 . $SRCDIR/scripts/defines.sh
16 echo "Cleaning up in $DBDIR..."
20 echo "Running slapadd to build slapd database..."
21 . $CONFFILTER $BACKEND < $CONF > $DBCONF
22 $SLAPADD -f $DBCONF -l $LDIFORDERED
24 if test $RC != 0 ; then
25 echo "slapadd failed ($RC)!"
29 echo "Starting slapd on TCP/IP port $PORT..."
30 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
32 echo "Testing slapd modrdn operations..."
34 # Make sure we can search the database
35 for i in 0 1 2 3 4 5; do
36 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
37 'objectClass=*' > $INITOUT 2>&1
39 if test $RC = 1 ; then
40 echo "Waiting 5 seconds for slapd to start..."
45 if test $RC != 0 ; then
46 echo "ldapsearch failed ($RC)!"
51 # -r used to do remove of old rdn
53 echo "Testing modrdn(deleteoldrdn=0)..."
54 $LDAPMODRDN -D "$MANAGERDN" -h localhost -p $PORT -w $PASSWD > \
55 $TESTOUT 2>&1 'cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US' 'cn=James A Jones III'
58 if test $RC != 0 ; then
59 echo "ldapmodrdn failed ($RC)!"
64 echo "Testing modrdn(deleteoldrdn=1)..."
65 $LDAPMODRDN -D "$MANAGERDN" -r -h localhost -p $PORT -w $PASSWD >> \
66 $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'
69 if test $RC != 0 ; then
70 echo "ldapmodrdn failed ($RC)!"
75 # Ensure the new rdn's can be found
77 echo "Using ldapsearch to retrieve entries using new rdn (cn=James A Jones III)..."
78 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
79 'cn=James A Jones III' > $SEARCHOUT 2>&1
81 if test $RC != 0 ; then
82 echo "ldapsearch failed ($RC)!"
88 LDIF=$MODRDNOUTMASTER1
90 echo "Filtering ldapsearch results..."
91 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
92 echo "Filtering original ldif used to create database..."
93 . $LDIFFILTER < $LDIF > $LDIFFLT
94 echo "Comparing filter output..."
95 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
97 if test $? != 0 ; then
98 echo "comparison failed - modrdn operations did not complete correctly"
104 echo "Using ldapsearch to retrieve entries using new rdn (cn=James A Jones II)..."
105 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
106 'cn=James A Jones II' > $SEARCHOUT 2>&1
108 if test $RC != 0 ; then
109 echo "ldapsearch failed ($RC)!"
115 LDIF=$MODRDNOUTMASTER2
117 echo "Filtering ldapsearch results..."
118 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
119 echo "Filtering original ldif used to create database..."
120 . $LDIFFILTER < $LDIF > $LDIFFLT
121 echo "Comparing filter output..."
122 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
124 if test $? != 0 ; then
125 echo "comparison failed - modrdn operations did not complete correctly"
130 # Ensure that you cannot find the entry for which the rdn was deleted as
133 echo "Using ldapsearch to retrieve entries using removed rdn (cn=James A Jones 2)..."
134 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
135 'cn=James A Jones 2' > $SEARCHOUT 2>&1
137 if test $RC != 0 ; then
139 echo "ldapsearch failed ($RC)!"
142 $CMP $SEARCHOUT /dev/null > $CMPOUT
143 if test $? != 0 ; then
144 echo "failure: ldapsearch found attribute that was to be removed!"
149 echo "Using ldapsearch to retrieve all the entries..."
150 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
151 'objectClass=*' > $SEARCHOUT 2>&1
153 if test $RC != 0 ; then
155 echo "ldapsearch failed ($RC)!"
159 LDIF=$MODRDNOUTMASTER0
161 echo "Filtering ldapsearch results..."
162 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
163 echo "Filtering original ldif used to create database..."
164 . $LDIFFILTER < $LDIF > $LDIFFLT
165 echo "Comparing filter output..."
166 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
168 if test $? != 0 ; then
169 echo "comparison failed - modrdn operations did not complete correctly"
175 echo "Testing modrdn(deleteoldrdn=1), modrdn with new rdn already an att val..."
176 $LDAPMODRDN -D "$MANAGERDN" -r -h localhost -p $PORT -w $PASSWD > \
177 /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'
180 if test $RC != 0 ; then
181 echo "ldapmodrdn failed ($RC)!"
186 # Test that you can use modrdn with an attribute value which was previously
189 echo "Using ldapsearch to retrieve entries using new rdn (cn=James A Jones 1)..."
190 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
191 'cn=James A Jones 1' > $SEARCHOUT 2>&1
193 if test $RC != 0 ; then
194 echo "ldapsearch failed ($RC)!"
200 LDIF=$MODRDNOUTMASTER3
202 echo "Filtering ldapsearch results..."
203 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
204 echo "Filtering original ldif used to create database..."
205 . $LDIFFILTER < $LDIF > $LDIFFLT
206 echo "Comparing filter output..."
207 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
210 if test $? != 0 ; then
211 echo "comparison failed - modrdn operations did not complete correctly"
215 echo ">>>>> Test succeeded"
219 # echo "modrdn test not yet written"