3 if test $# -eq 0 ; then
8 if test $# -eq 1 ; then
12 echo "running defines.sh $SRCDIR $BACKEND"
13 . $SRCDIR/scripts/defines.sh
15 echo "Cleaning up in $DBDIR..."
19 echo "Running ldif2ldbm to build slapd database..."
20 $LDIF2LDBM -f $CONF -i $LDIF -e ../servers/slapd/tools
22 if test $RC != 0 ; then
23 echo "ldif2ldbm failed!"
27 echo "Starting slapd on TCP/IP port $PORT..."
28 $SLAPD -f $CONF -p $PORT -d $LVL $TIMING > $MASTERLOG 2>&1 &
30 echo "Testing slapd modrdn operations..."
32 # Make sure we can search the database
33 for i in 0 1 2 3 4 5; do
34 $LDAPSEARCH -L -s base -b "$MONITOR" -h localhost -p $PORT \
35 'objectclass=*' > /dev/null 2>&1
37 if test $RC = 1 ; then
38 echo "Waiting 5 seconds for slapd to start..."
43 if test $RC != 0 ; then
44 echo "ldapsearch failed!"
49 # -r used to do remove of old rdn
51 echo "Testing modrdn(deleteoldrdn=0)..."
52 $LDAPMODRDN -v -D "$MANAGERDN" -h localhost -p $PORT -w $PASSWD > \
53 $TESTOUT 2>&1 'cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US' 'cn=James A Jones III'
56 if test $RC != 0 ; then
57 echo "ldapmodrdn failed!"
62 echo "Testing modrdn(deleteoldrdn=1)..."
63 $LDAPMODRDN -v -D "$MANAGERDN" -r -h localhost -p $PORT -w $PASSWD >> \
64 $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'
67 if test $RC != 0 ; then
68 echo "ldapmodrdn failed!"
73 # Ensure the new rdn's can be found
75 echo "Using ldapsearch to retrieve entries using new rdn (cn=James A Jones III)..."
76 $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \
77 'cn=James A Jones III' | egrep -iv '^createtimestamp:|^modifytimestamp:' \
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 -L -S "" -b "$BASEDN" -h localhost -p $PORT \
105 'cn=James A Jones II' | egrep -iv '^createtimestamp:|^modifytimestamp:' \
108 if test $RC != 0 ; then
109 echo "ldapsearch failed!"
115 LDIF=$MODRDNOUTMASTER2
117 echo "Filtering ldapsearch results..."
118 . $SRCDIR/scripts/acfilter.sh < $SEARCHOUT > $SEARCHFLT
119 echo "Filtering original ldif used to create database..."
120 . $SRCDIR/scripts/acfilter.sh < $LDIF > $LDIFFLT
121 echo "Comparing filter output..."
122 cmp $SEARCHFLT $LDIFFLT
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 -L -S "" -b "$BASEDN" -h localhost -p $PORT \
135 'cn=James A Jones 2' | egrep -iv '^createtimestamp:|^modifytimestamp:' \
138 if test $RC = 0 ; then
139 echo "failure: ldapsearch found attribute that was to be removed!"
144 echo "Using ldapsearch to retrieve all the entries..."
145 $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \
146 'objectClass=*' > $SEARCHOUT 2>&1
148 if test $RC != 0 ; then
150 echo "ldapsearch failed!"
154 LDIF=$MODRDNOUTMASTER0
156 echo "Filtering ldapsearch results..."
157 . $SRCDIR/scripts/acfilter.sh < $SEARCHOUT > $SEARCHFLT
158 echo "Filtering original ldif used to create database..."
159 . $SRCDIR/scripts/acfilter.sh < $LDIF > $LDIFFLT
160 echo "Comparing filter output..."
161 cmp $SEARCHFLT $LDIFFLT
163 if test $? != 0 ; then
164 echo "comparison failed - modrdn operations did not complete correctly"
170 echo "Testing modrdn(deleteoldrdn=1), modrdn with new rdn already an att val..."
171 $LDAPMODRDN -v -D "$MANAGERDN" -r -h localhost -p $PORT -w $PASSWD > \
172 /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'
175 if test $RC != 0 ; then
176 echo "ldapmodrdn failed!"
181 # Test that you can use modrdn with an attribute value which was previously
184 echo "Using ldapsearch to retrieve entries using new rdn (cn=James A Jones 1)..."
185 $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \
186 'cn=James A Jones 1' | egrep -iv '^createtimestamp:|^modifytimestamp:' \
189 if test $RC != 0 ; then
190 echo "ldapsearch failed!"
196 LDIF=$MODRDNOUTMASTER3
198 echo "Filtering ldapsearch results..."
199 . $SRCDIR/scripts/acfilter.sh < $SEARCHOUT > $SEARCHFLT
200 echo "Filtering original ldif used to create database..."
201 . $SRCDIR/scripts/acfilter.sh < $LDIF > $LDIFFLT
202 echo "Comparing filter output..."
203 cmp $SEARCHFLT $LDIFFLT
206 if test $? != 0 ; then
207 echo "comparison failed - modrdn operations did not complete correctly"
211 echo ">>>>> Test succeeded"
215 # echo "modrdn test not yet written"