4 if test $# -eq 0 ; then
9 if test $# -eq 1 ; then
13 echo "running defines.sh $SRCDIR $BACKEND"
14 . $SRCDIR/scripts/defines.sh
16 echo "Cleaning up in $DBDIR..."
20 echo "Running slapadd to build slapd database..."
21 $LDIF2LDBM -f $CONF -l $LDIF
23 if test $RC != 0 ; then
24 echo "slapadd failed!"
28 echo "Starting slapd on TCP/IP port $PORT..."
29 $SLAPD -f $CONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
31 echo "Testing slapd modrdn operations..."
33 # Make sure we can search the database
34 for i in 0 1 2 3 4 5; do
35 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
36 'objectClass=*' > $INITOUT 2>&1
38 if test $RC = 1 ; then
39 echo "Waiting 5 seconds for slapd to start..."
44 if test $RC != 0 ; then
45 echo "ldapsearch failed!"
50 # -r used to do remove of old rdn
52 echo "Testing modrdn(deleteoldrdn=0)..."
53 $LDAPMODRDN -v -D "$MANAGERDN" -h localhost -p $PORT -w $PASSWD > \
54 $TESTOUT 2>&1 'cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US' 'cn=James A Jones III'
57 if test $RC != 0 ; then
58 echo "ldapmodrdn failed!"
63 echo "Testing modrdn(deleteoldrdn=1)..."
64 $LDAPMODRDN -v -D "$MANAGERDN" -r -h localhost -p $PORT -w $PASSWD >> \
65 $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'
68 if test $RC != 0 ; then
69 echo "ldapmodrdn failed!"
74 # Ensure the new rdn's can be found
76 echo "Using ldapsearch to retrieve entries using new rdn (cn=James A Jones III)..."
77 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
78 'cn=James A Jones III' > $SEARCHOUT 2>&1
80 if test $RC != 0 ; then
81 echo "ldapsearch failed!"
87 LDIF=$MODRDNOUTMASTER1
89 echo "Filtering ldapsearch results..."
90 . $SRCDIR/scripts/acfilter.sh < $SEARCHOUT > $SEARCHFLT
91 echo "Filtering original ldif used to create database..."
92 . $SRCDIR/scripts/acfilter.sh < $LDIF > $LDIFFLT
93 echo "Comparing filter output..."
94 $CMP $SEARCHFLT $LDIFFLT
96 if test $? != 0 ; then
97 echo "comparison failed - modrdn operations did not complete correctly"
103 echo "Using ldapsearch to retrieve entries using new rdn (cn=James A Jones II)..."
104 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
105 'cn=James A Jones II' > $SEARCHOUT 2>&1
107 if test $RC != 0 ; then
108 echo "ldapsearch failed!"
114 LDIF=$MODRDNOUTMASTER2
116 echo "Filtering ldapsearch results..."
117 . $SRCDIR/scripts/acfilter.sh < $SEARCHOUT > $SEARCHFLT
118 echo "Filtering original ldif used to create database..."
119 . $SRCDIR/scripts/acfilter.sh < $LDIF > $LDIFFLT
120 echo "Comparing filter output..."
121 $CMP $SEARCHFLT $LDIFFLT
123 if test $? != 0 ; then
124 echo "comparison failed - modrdn operations did not complete correctly"
129 # Ensure that you cannot find the entry for which the rdn was deleted as
132 echo "Using ldapsearch to retrieve entries using removed rdn (cn=James A Jones 2)..."
133 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
134 'cn=James A Jones 2' > $SEARCHOUT 2>&1
136 if test $RC != 0 ; then
138 echo "ldapsearch failed!"
141 $CMP $SEARCHOUT /dev/null
142 if test $? != 0 ; then
143 echo "failure: ldapsearch found attribute that was to be removed!"
148 echo "Using ldapsearch to retrieve all the entries..."
149 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
150 'objectClass=*' > $SEARCHOUT 2>&1
152 if test $RC != 0 ; then
154 echo "ldapsearch failed!"
158 LDIF=$MODRDNOUTMASTER0
160 echo "Filtering ldapsearch results..."
161 . $SRCDIR/scripts/acfilter.sh < $SEARCHOUT > $SEARCHFLT
162 echo "Filtering original ldif used to create database..."
163 . $SRCDIR/scripts/acfilter.sh < $LDIF > $LDIFFLT
164 echo "Comparing filter output..."
165 $CMP $SEARCHFLT $LDIFFLT
167 if test $? != 0 ; then
168 echo "comparison failed - modrdn operations did not complete correctly"
174 echo "Testing modrdn(deleteoldrdn=1), modrdn with new rdn already an att val..."
175 $LDAPMODRDN -v -D "$MANAGERDN" -r -h localhost -p $PORT -w $PASSWD > \
176 /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'
179 if test $RC != 0 ; then
180 echo "ldapmodrdn failed!"
185 # Test that you can use modrdn with an attribute value which was previously
188 echo "Using ldapsearch to retrieve entries using new rdn (cn=James A Jones 1)..."
189 $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \
190 'cn=James A Jones 1' > $SEARCHOUT 2>&1
192 if test $RC != 0 ; then
193 echo "ldapsearch failed!"
199 LDIF=$MODRDNOUTMASTER3
201 echo "Filtering ldapsearch results..."
202 . $SRCDIR/scripts/acfilter.sh < $SEARCHOUT > $SEARCHFLT
203 echo "Filtering original ldif used to create database..."
204 . $SRCDIR/scripts/acfilter.sh < $LDIF > $LDIFFLT
205 echo "Comparing filter output..."
206 $CMP $SEARCHFLT $LDIFFLT
209 if test $? != 0 ; then
210 echo "comparison failed - modrdn operations did not complete correctly"
214 echo ">>>>> Test succeeded"
218 # echo "modrdn test not yet written"