3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2008 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 $SLAPPASSWD -g -n >$CONFIGPWF
22 echo "rootpw `$SLAPPASSWD -T $CONFIGPWF`" >$TESTDIR/configpw.conf
24 echo "Running slapadd to build slapd database..."
25 . $CONFFILTER $BACKEND $MONITORDB < $UNDOCONF > $CONF1
26 $SLAPADD -f $CONF1 <<EOF
28 objectClass: organization
33 if test $RC != 0 ; then
34 echo "slapadd failed ($RC)!"
38 echo "Starting slapd on TCP/IP port $PORT1..."
39 mkdir $TESTDIR/confdir
40 $SLAPD -f $CONF1 -F $TESTDIR/confdir -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
42 if test $WAIT != 0 ; then
49 for i in 0 1 2 3 4 5; do
50 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
51 'objectclass=*' > /dev/null 2>&1
53 if test $RC = 0 ; then
56 echo "Waiting 5 seconds for slapd to start..."
59 if test $RC != 0 ; then
60 echo "ldapsearch failed ($RC)!"
61 test $KILLSERVERS != no && kill -HUP $KILLPIDS
65 echo Dynamically assaulting the schema
66 $LDAPMODIFY -D cn=config -h $LOCALHOST -p $PORT1 -y $CONFIGPWF \
68 dn: cn={0}core,cn=schema,cn=config
70 replace: olcObjectClasses
71 olcObjectClasses: ( rawr )
75 if test $RC != 80 ; then
76 echo "invalid objectclass modify allowed ($RC)"
77 test $KILLSERVERS != no && kill -HUP $KILLPIDS
81 $LDAPMODIFY -D cn=config -h $LOCALHOST -p $PORT1 -y $CONFIGPWF \
83 dn: cn={0}core,cn=schema,cn=config
85 replace: olcAttributeTypes
86 olcAttributeTypes: ( rawr )
90 if test $RC != 80 ; then
91 echo "invalid attributeType modify allowed ($RC)"
92 test $KILLSERVERS != no && kill -HUP $KILLPIDS
96 echo Surveying the damage
97 $LDAPMODIFY -D "cn=manager,o=undo" -w secret -h $LOCALHOST -p $PORT1 <<EOF
100 objectClass: organization
105 if test $RC != 0 ; then
106 echo "schema destroyed by an unsuccessful operation"
107 test $KILLSERVERS != no && kill -HUP $KILLPIDS
111 test $KILLSERVERS != no && kill -HUP $KILLPIDS
113 echo ">>>>> Test succeeded"
115 test $KILLSERVERS != no && wait