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 MANAGEDITOID="1.3.6.1.4.1.4203.666.5.12"
59 case `$LDAPSEARCH -s base -b "" -h $LOCALHOST -p $PORT1 \
60 '(supportedControl:objectIdentifierMatch:='${MANAGEDITOID}')' \
61 supportedControl | grep "supportedControl: ${MANAGEDITOID}"` in
62 "supportedControl: ${MANAGEDITOID}")
65 echo "The \"manageDIT\" control appears to be unsupported; test disabled"
66 test $KILLSERVERS != no && kill -HUP $KILLPIDS
71 echo "Testing modify, add, and delete..."
72 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
74 $TESTOUT 2>&1 << EOMODS
84 dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example,
86 # add obsolete auxiliary objectclass
89 objectClass: obsoletePerson
91 dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example,
93 # add obsolete attribute
99 # create/modify timestamp test
102 dn: ou=Groups,dc=example,dc=com
103 # change creatorsName
105 replace: creatorsName
106 creatorsName: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
108 dn: cn=ITD Staff,ou=Groups,dc=example,dc=com
109 # change modifiersName
111 replace: modifiersName
112 modifiersName: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
117 if test $RC != 0 ; then
118 echo "ldapmodify failed ($RC)!"
119 test $KILLSERVERS != no && kill -HUP $KILLPIDS
123 echo "Testing modify, add, and delete..."
124 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
126 $TESTOUT 2>&1 << EOMODS
132 dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example,
134 # update structural object class of entry via objectClass replace
137 objectClass: obsoletePerson
139 replace: structuralObjectClass
140 structuralObjectClass: testPerson
142 dn: cn=James A Jones 1,ou=Alumni Association,ou=People,dc=example,dc=com
143 # update structural object class of entry via objectClass add
146 objectClass: testPerson
148 replace: structuralObjectClass
149 structuralObjectClass: testPerson
151 dn: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
152 # update structural object class of entry via objectClass delete/add
155 objectClass: OpenLDAPperson
158 objectClass: testPerson
160 delete: structuralObjectClass
162 add: structuralObjectClass
163 structuralObjectClass: testPerson
168 if test $RC != 0 ; then
169 echo "ldapmodify failed ($RC)! IGNORED"
170 # test $KILLSERVERS != no && kill -HUP $KILLPIDS
174 echo "Using ldapsearch to retrieve all the entries..."
175 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
176 'objectClass=*' '*' creatorsName modifiersName > $SEARCHOUT 2>&1
178 test $KILLSERVERS != no && kill -HUP $KILLPIDS
179 if test $RC != 0 ; then
180 echo "ldapsearch failed ($RC)!"
186 echo "Filtering ldapsearch results..."
187 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
188 echo "Filtering original ldif used to create database..."
189 . $LDIFFILTER < $LDIF > $LDIFFLT
190 echo "Comparing filter output..."
191 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
193 if test $? != 0 ; then
194 echo "comparison failed - manage operations did not complete correctly"
198 echo ">>>>> Test succeeded"