3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2005 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
39 echo "Testing slapd Manage operations..."
40 for i in 0 1 2 3 4 5; do
41 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
42 'objectclass=*' > /dev/null 2>&1
44 if test $RC = 0 ; then
47 echo "Waiting 5 seconds for slapd to start..."
51 if test $RC != 0 ; then
52 echo "ldapsearch failed ($RC)!"
53 test $KILLSERVERS != no && kill -HUP $KILLPIDS
57 # ITS#3898: #ifndef LDAP_DEVEL, the control is not available
58 case `$LDAPSEARCH -s base -b "" -h $LOCALHOST -p $PORT1 -A \
59 '(supportedControl:objectIdentifierMatch:=1.3.6.1.4.1.4203.666.5.12)' \
60 supportedControl | grep supportedControl` in
64 echo "The \"manageDIT\" control appears to be unsupported; test disabled"
65 test $KILLSERVERS != no && kill -HUP $KILLPIDS
70 echo "Testing modify, add, and delete..."
71 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
73 $TESTOUT 2>&1 << EOMODS
83 dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example,
85 # add obsolete auxiliary objectclass
88 objectClass: obsoletePerson
90 dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example,
92 # add obsolete attribute
98 # create/modify timestamp test
101 dn: ou=Groups,dc=example,dc=com
102 # change creatorsName
104 replace: creatorsName
105 creatorsName: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
107 dn: cn=ITD Staff,ou=Groups,dc=example,dc=com
108 # change modifiersName
110 replace: modifiersName
111 modifiersName: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
116 if test $RC != 0 ; then
117 echo "ldapmodify failed ($RC)!"
118 test $KILLSERVERS != no && kill -HUP $KILLPIDS
122 echo "Testing modify, add, and delete..."
123 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
125 $TESTOUT 2>&1 << EOMODS
131 dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example,
133 # update structural object class of entry via objectClass replace
136 objectClass: obsoletePerson
138 replace: structuralObjectClass
139 structuralObjectClass: testPerson
141 dn: cn=James A Jones 1,ou=Alumni Association,ou=People,dc=example,dc=com
142 # update structural object class of entry via objectClass add
145 objectClass: testPerson
147 replace: structuralObjectClass
148 structuralObjectClass: testPerson
150 dn: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
151 # update structural object class of entry via objectClass delete/add
154 objectClass: OpenLDAPperson
157 objectClass: testPerson
159 delete: structuralObjectClass
161 add: structuralObjectClass
162 structuralObjectClass: testPerson
167 if test $RC != 0 ; then
168 echo "ldapmodify failed ($RC)! IGNORED"
169 # test $KILLSERVERS != no && kill -HUP $KILLPIDS
173 echo "Using ldapsearch to retrieve all the entries..."
174 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
175 'objectClass=*' '*' creatorsName modifiersName > $SEARCHOUT 2>&1
177 test $KILLSERVERS != no && kill -HUP $KILLPIDS
178 if test $RC != 0 ; then
179 echo "ldapsearch failed ($RC)!"
185 echo "Filtering ldapsearch results..."
186 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
187 echo "Filtering original ldif used to create database..."
188 . $LDIFFILTER < $LDIF > $LDIFFLT
189 echo "Comparing filter output..."
190 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
192 if test $? != 0 ; then
193 echo "comparison failed - manage operations did not complete correctly"
197 echo ">>>>> Test succeeded"