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
66 dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example,
68 # add obsolete auxiliary objectclass
71 objectClass: obsoletePerson
73 dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example,
75 # add obsolete attribute
83 if test $RC != 0 ; then
84 echo "ldapmodify failed ($RC)!"
85 test $KILLSERVERS != no && kill -HUP $KILLPIDS
89 echo "Testing modify, add, and delete..."
90 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
92 $TESTOUT 2>&1 << EOMODS
98 #dn: cn=ITD Staff,ou=Groups,dc=example,dc=com
102 #entryUUID: B51EE239-C24A-11D9-A541-000D9342AD1E
104 dn: ou=Groups,dc=example,dc=com
105 # change creatorsName
107 replace: creatorsName
108 creatorsName: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
110 dn: cn=ITD Staff,ou=Groups,dc=example,dc=com
111 # change modifiersName
113 replace: modifiersName
114 modifiersName: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
116 dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example,
118 # update structural object class of entry via objectClass replace
121 objectClass: obsoletePerson
123 replace: structuralObjectClass
124 structuralObjectClass: testPerson
126 dn: cn=James A Jones 1,ou=Alumni Association,ou=People,dc=example,dc=com
127 # update structural object class of entry via objectClass add
130 objectClass: testPerson
132 replace: structuralObjectClass
133 structuralObjectClass: testPerson
135 dn: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
136 # update structural object class of entry via objectClass delete/add
139 objectClass: OpenLDAPperson
142 objectClass: testPerson
144 delete: structuralObjectClass
146 add: structuralObjectClass
147 structuralObjectClass: testPerson
152 if test $RC != 0 ; then
153 echo "ldapmodify failed ($RC)! IGNORED"
154 # test $KILLSERVERS != no && kill -HUP $KILLPIDS
158 echo "Using ldapsearch to retrieve all the entries..."
159 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
160 'objectClass=*' > $SEARCHOUT 2>&1
162 test $KILLSERVERS != no && kill -HUP $KILLPIDS
163 if test $RC != 0 ; then
164 echo "ldapsearch failed ($RC)!"
170 echo "Filtering ldapsearch results..."
171 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
172 echo "Filtering original ldif used to create database..."
173 . $LDIFFILTER < $LDIF > $LDIFFLT
174 echo "Comparing filter output..."
175 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
177 if test $? != 0 ; then
178 echo "comparison failed - manage operations did not complete correctly"
182 echo ">>>>> Test succeeded"