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 echo "Testing modify, add, and delete..."
58 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
60 $TESTOUT 2>&1 << EOMODS
70 dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example,
72 # add obsolete auxiliary objectclass
75 objectClass: obsoletePerson
77 dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example,
79 # add obsolete attribute
85 # create/modify timestamp test
88 dn: ou=Groups,dc=example,dc=com
92 creatorsName: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
94 dn: cn=ITD Staff,ou=Groups,dc=example,dc=com
95 # change modifiersName
97 replace: modifiersName
98 modifiersName: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
103 if test $RC != 0 ; then
104 echo "ldapmodify failed ($RC)!"
105 test $KILLSERVERS != no && kill -HUP $KILLPIDS
109 echo "Testing modify, add, and delete..."
110 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
112 $TESTOUT 2>&1 << EOMODS
118 dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example,
120 # update structural object class of entry via objectClass replace
123 objectClass: obsoletePerson
125 replace: structuralObjectClass
126 structuralObjectClass: testPerson
128 dn: cn=James A Jones 1,ou=Alumni Association,ou=People,dc=example,dc=com
129 # update structural object class of entry via objectClass add
132 objectClass: testPerson
134 replace: structuralObjectClass
135 structuralObjectClass: testPerson
137 dn: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
138 # update structural object class of entry via objectClass delete/add
141 objectClass: OpenLDAPperson
144 objectClass: testPerson
146 delete: structuralObjectClass
148 add: structuralObjectClass
149 structuralObjectClass: testPerson
154 if test $RC != 0 ; then
155 echo "ldapmodify failed ($RC)! IGNORED"
156 # test $KILLSERVERS != no && kill -HUP $KILLPIDS
160 echo "Using ldapsearch to retrieve all the entries..."
161 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
162 'objectClass=*' '*' creatorsName modifiersName > $SEARCHOUT 2>&1
164 test $KILLSERVERS != no && kill -HUP $KILLPIDS
165 if test $RC != 0 ; then
166 echo "ldapsearch failed ($RC)!"
172 echo "Filtering ldapsearch results..."
173 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
174 echo "Filtering original ldif used to create database..."
175 . $LDIFFILTER < $LDIF > $LDIFFLT
176 echo "Comparing filter output..."
177 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
179 if test $? != 0 ; then
180 echo "comparison failed - manage operations did not complete correctly"
184 echo ">>>>> Test succeeded"