3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2009 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 if test $BACKEND = "ldif" ; then
20 echo "LDIF backend does not support relax control, test skipped"
24 mkdir -p $TESTDIR $DBDIR1
26 echo "Running slapadd to build slapd database..."
27 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1
28 $SLAPADD -f $CONF1 -l $LDIFORDERED
30 if test $RC != 0 ; then
31 echo "slapadd failed ($RC)!"
35 echo "Starting slapd on TCP/IP port $PORT1..."
36 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
38 if test $WAIT != 0 ; then
46 echo "Testing slapd Manage operations..."
47 for i in 0 1 2 3 4 5; do
48 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
49 'objectclass=*' > /dev/null 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)!"
60 test $KILLSERVERS != no && kill -HUP $KILLPIDS
64 echo "Testing modify, add, and delete..."
65 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
67 $TESTOUT 2>&1 << EOMODS
77 dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example,
79 # add obsolete auxiliary objectclass
82 objectClass: obsoletePerson
84 dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example,
86 # add obsolete attribute
92 # create/modify timestamp test
95 dn: ou=Groups,dc=example,dc=com
99 creatorsName: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
101 dn: cn=ITD Staff,ou=Groups,dc=example,dc=com
102 # change modifiersName
104 replace: modifiersName
105 modifiersName: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
107 dn: dc=example,dc=com
110 replace: modifyTimestamp
111 modifyTimestamp: 19700101000000Z
113 replace: createTimestamp
114 createTimestamp: 19700101000000Z
117 dn: cn=All Staff,ou=Groups,dc=example,dc=com
121 entryUUID: badbadba-dbad-1029-92f7-badbadbadbad
123 dn: cn=All Staff,dc=example,dc=com
125 objectClass: groupOfNames
128 creatorsName: cn=Someone
129 createTimestamp: 19700101000000Z
130 modifiersName: cn=Someone Else
131 modifyTimestamp: 19700101000000Z
132 entryUUID: badbadef-dbad-1029-92f7-badbadbadbad
135 # Tests that did not work until ITS#5792
138 dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example,
140 # update structural object class of entry via objectClass replace
143 objectClass: obsoletePerson
144 objectClass: testPerson
147 dn: cn=James A Jones 1,ou=Alumni Association,ou=People,dc=example,dc=com
148 # update structural object class of entry via objectClass add
151 objectClass: testPerson
154 dn: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
155 # update structural object class of entry via objectClass delete/add
158 objectClass: OpenLDAPperson
161 objectClass: testPerson
166 if test $RC != 0 ; then
167 echo "ldapmodify failed ($RC)!"
168 test $KILLSERVERS != no && kill -HUP $KILLPIDS
172 echo "Using ldapsearch to retrieve all the entries..."
173 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
174 'objectClass=*' '*' creatorsName modifiersName > $SEARCHOUT 2>&1
176 if test $RC != 0 ; then
177 test $KILLSERVERS != no && kill -HUP $KILLPIDS
178 echo "ldapsearch failed ($RC)!"
182 $LDAPSEARCH -S "" -b "$BASEDN" -s base -h $LOCALHOST -p $PORT1 \
183 'objectClass=*' '*' creatorsName createTimestamp \
184 modifiersName modifyTimestamp >> $SEARCHOUT 2>&1
186 if test $RC != 0 ; then
187 test $KILLSERVERS != no && kill -HUP $KILLPIDS
188 echo "ldapsearch failed ($RC)!"
192 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
193 '(cn=All Staff)' '*' entryUUID >> $SEARCHOUT 2>&1
195 test $KILLSERVERS != no && kill -HUP $KILLPIDS
196 if test $RC != 0 ; then
197 echo "ldapsearch failed ($RC)!"
203 echo "Filtering ldapsearch results..."
204 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
205 echo "Filtering original ldif used to create database..."
206 . $LDIFFILTER < $LDIF > $LDIFFLT
207 echo "Comparing filter output..."
208 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
210 if test $? != 0 ; then
211 echo "comparison failed - manage operations did not complete correctly"
215 echo ">>>>> Test succeeded"
217 test $KILLSERVERS != no && wait