3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2006 The OpenLDAP Foundation.
6 ## All rights reserved.
8 ## Redistribution and use in source and binary forms, with or without
9 ## modification, are permitted only as authorized by the OpenLDAP
12 ## A copy of this license is available in the file LICENSE in the
13 ## top-level directory of the distribution or, alternatively, at
14 ## <http://www.OpenLDAP.org/license.html>.
16 echo "running defines.sh"
17 . $SRCDIR/scripts/defines.sh
19 mkdir -p $TESTDIR $DBDIR1
21 echo "Running slapadd to build slapd database..."
22 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1
23 $SLAPADD -f $CONF1 -l $LDIFORDERED
25 if test $RC != 0 ; then
26 echo "slapadd failed ($RC)!"
30 echo "Starting slapd on TCP/IP port $PORT1..."
31 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
33 if test $WAIT != 0 ; then
41 echo "Testing slapd Manage operations..."
42 for i in 0 1 2 3 4 5; do
43 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
44 'objectclass=*' > /dev/null 2>&1
46 if test $RC = 0 ; then
49 echo "Waiting 5 seconds for slapd to start..."
53 if test $RC != 0 ; then
54 echo "ldapsearch failed ($RC)!"
55 test $KILLSERVERS != no && kill -HUP $KILLPIDS
59 # ITS#3898: #ifndef LDAP_DEVEL, the control is not available
60 MANAGEDITOID="1.3.6.1.4.1.4203.666.5.12"
61 case `$LDAPSEARCH -s base -b "" -h $LOCALHOST -p $PORT1 \
62 '(supportedControl:objectIdentifierMatch:='${MANAGEDITOID}')' \
63 supportedControl | grep "supportedControl: ${MANAGEDITOID}"` in
64 "supportedControl: ${MANAGEDITOID}")
67 echo "The \"manageDIT\" control appears to be unsupported; test disabled"
68 test $KILLSERVERS != no && kill -HUP $KILLPIDS
73 echo "Testing modify, add, and delete..."
74 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
76 $TESTOUT 2>&1 << EOMODS
86 dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example,
88 # add obsolete auxiliary objectclass
91 objectClass: obsoletePerson
93 dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example,
95 # add obsolete attribute
101 # create/modify timestamp test
104 dn: ou=Groups,dc=example,dc=com
105 # change creatorsName
107 replace: creatorsName
108 creatorsName: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
110 dn: cn=ITD Staff,ou=Groups,dc=example,dc=com
111 # change modifiersName
113 replace: modifiersName
114 modifiersName: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
116 dn: dc=example,dc=com
119 replace: modifyTimestamp
120 modifyTimestamp: 19700101000000Z
122 replace: createTimestamp
123 createTimestamp: 19700101000000Z
126 dn: cn=All Staff,ou=Groups,dc=example,dc=com
130 entryUUID: badbadba-dbad-1029-92f7-badbadbadbad
132 dn: cn=All Staff,dc=example,dc=com
134 objectClass: groupOfNames
137 creatorsName: cn=Someone
138 createTimestamp: 19700101000000Z
139 modifiersName: cn=Someone Else
140 modifyTimestamp: 19700101000000Z
141 entryUUID: badbadef-dbad-1029-92f7-badbadbadbad
145 if test $RC != 0 ; then
146 echo "ldapmodify failed ($RC)!"
147 test $KILLSERVERS != no && kill -HUP $KILLPIDS
151 echo "Testing modify, add, and delete..."
152 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
154 $TESTOUT 2>&1 << EOMODS
160 dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example,
162 # update structural object class of entry via objectClass replace
165 objectClass: obsoletePerson
167 replace: structuralObjectClass
168 structuralObjectClass: testPerson
170 dn: cn=James A Jones 1,ou=Alumni Association,ou=People,dc=example,dc=com
171 # update structural object class of entry via objectClass add
174 objectClass: testPerson
176 replace: structuralObjectClass
177 structuralObjectClass: testPerson
179 dn: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
180 # update structural object class of entry via objectClass delete/add
183 objectClass: OpenLDAPperson
186 objectClass: testPerson
188 delete: structuralObjectClass
190 add: structuralObjectClass
191 structuralObjectClass: testPerson
195 if test $RC != 0 ; then
196 echo "ldapmodify failed ($RC)! IGNORED"
197 # test $KILLSERVERS != no && kill -HUP $KILLPIDS
201 echo "Using ldapsearch to retrieve all the entries..."
202 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
203 'objectClass=*' '*' creatorsName modifiersName > $SEARCHOUT 2>&1
205 if test $RC != 0 ; then
206 test $KILLSERVERS != no && kill -HUP $KILLPIDS
207 echo "ldapsearch failed ($RC)!"
211 $LDAPSEARCH -S "" -b "$BASEDN" -s base -h $LOCALHOST -p $PORT1 \
212 'objectClass=*' '*' creatorsName createTimestamp \
213 modifiersName modifyTimestamp >> $SEARCHOUT 2>&1
215 if test $RC != 0 ; then
216 test $KILLSERVERS != no && kill -HUP $KILLPIDS
217 echo "ldapsearch failed ($RC)!"
221 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
222 '(cn=All Staff)' '*' entryUUID >> $SEARCHOUT 2>&1
224 test $KILLSERVERS != no && kill -HUP $KILLPIDS
225 if test $RC != 0 ; then
226 echo "ldapsearch failed ($RC)!"
232 echo "Filtering ldapsearch results..."
233 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
234 echo "Filtering original ldif used to create database..."
235 . $LDIFFILTER < $LDIF > $LDIFFLT
236 echo "Comparing filter output..."
237 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
239 if test $? != 0 ; then
240 echo "comparison failed - manage operations did not complete correctly"
244 echo ">>>>> Test succeeded"
246 test $KILLSERVERS != no && wait