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 \
59 -Emv='(supportedControl:objectIdentifierMatch:=1.3.6.1.4.1.4203.666.5.12)' \
60 '(supportedControl:objectIdentifierMatch:=1.3.6.1.4.1.4203.666.5.12)' \
61 supportedControl | grep '1.3.6.1.4.1.4203.666.5.12' | cut -d ' ' -f 2` in
62 "1.3.6.1.4.1.4203.666.5.12")
63 echo "The \"manageDIT\" control appears to be (partially) supported..."
66 echo "The \"manageDIT\" control appears to be unsupported; test disabled"
67 test $KILLSERVERS != no && kill -HUP $KILLPIDS
72 echo "Testing modify, add, and delete..."
73 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
75 $TESTOUT 2>&1 << EOMODS
85 dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example,
87 # add obsolete auxiliary objectclass
90 objectClass: obsoletePerson
92 dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example,
94 # add obsolete attribute
100 # create/modify timestamp test
103 dn: ou=Groups,dc=example,dc=com
104 # change creatorsName
106 replace: creatorsName
107 creatorsName: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
109 dn: cn=ITD Staff,ou=Groups,dc=example,dc=com
110 # change modifiersName
112 replace: modifiersName
113 modifiersName: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
118 if test $RC != 0 ; then
119 echo "ldapmodify failed ($RC)!"
120 test $KILLSERVERS != no && kill -HUP $KILLPIDS
124 echo "Testing modify, add, and delete..."
125 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
127 $TESTOUT 2>&1 << EOMODS
133 dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example,
135 # update structural object class of entry via objectClass replace
138 objectClass: obsoletePerson
140 replace: structuralObjectClass
141 structuralObjectClass: testPerson
143 dn: cn=James A Jones 1,ou=Alumni Association,ou=People,dc=example,dc=com
144 # update structural object class of entry via objectClass add
147 objectClass: testPerson
149 replace: structuralObjectClass
150 structuralObjectClass: testPerson
152 dn: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
153 # update structural object class of entry via objectClass delete/add
156 objectClass: OpenLDAPperson
159 objectClass: testPerson
161 delete: structuralObjectClass
163 add: structuralObjectClass
164 structuralObjectClass: testPerson
169 if test $RC != 0 ; then
170 echo "ldapmodify failed ($RC)! IGNORED"
171 # test $KILLSERVERS != no && kill -HUP $KILLPIDS
175 echo "Using ldapsearch to retrieve all the entries..."
176 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
177 'objectClass=*' '*' creatorsName modifiersName > $SEARCHOUT 2>&1
179 test $KILLSERVERS != no && kill -HUP $KILLPIDS
180 if test $RC != 0 ; then
181 echo "ldapsearch failed ($RC)!"
187 echo "Filtering ldapsearch results..."
188 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
189 echo "Filtering original ldif used to create database..."
190 . $LDIFFILTER < $LDIF > $LDIFFLT
191 echo "Comparing filter output..."
192 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
194 if test $? != 0 ; then
195 echo "comparison failed - manage operations did not complete correctly"
199 echo ">>>>> Test succeeded"