3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2012 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
20 mkdir -p $TESTDIR $DBDIR1
22 echo "Running slapadd to build slapd database..."
23 . $CONFFILTER $BACKEND $MONITORDB < $VALREGEXCONF > $CONF1
24 $SLAPADD -f $CONF1 -l $LDIFORDERED
26 if test $RC != 0 ; then
27 echo "slapadd failed ($RC)!"
31 echo "Starting slapd on TCP/IP port $PORT1..."
32 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
34 if test $WAIT != 0 ; then
42 echo "Testing attribute value regex subsitution..."
43 for i in 0 1 2 3 4 5; do
44 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
45 'objectclass=*' > /dev/null 2>&1
47 if test $RC = 0 ; then
50 echo "Waiting 5 seconds for slapd to start..."
54 if test $RC != 0 ; then
55 echo "ldapsearch failed ($RC)!"
56 test $KILLSERVERS != no && kill -HUP $KILLPIDS
60 cat /dev/null > $SEARCHOUT
62 echo "# Try an attribute vale regex that match, but substitute does not"
63 echo "# this should fail"
64 $LDAPMODIFY -D "$JAJDN" -h $LOCALHOST -p $PORT1 -w jaj >> \
65 $TESTOUT 2>&1 << EOMODS
66 dn: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
74 echo "ldapmodify failed as expected"
77 if test $BACKEND != null ; then
78 echo "ldapmodify should have failed ($RC)!"
79 test $KILLSERVERS != no && kill -HUP $KILLPIDS
84 echo "ldapmodify failed ($RC)!"
85 test $KILLSERVERS != no && kill -HUP $KILLPIDS
90 echo "# Try an attribute vale regex that match and substitute does"
91 echo "# this should succeed"
92 $LDAPMODIFY -D "$JAJDN" -h $LOCALHOST -p $PORT1 -w jaj >> \
93 $TESTOUT 2>&1 << EOMODS
94 dn: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
101 test $KILLSERVERS != no && kill -HUP $KILLPIDS
105 echo "ldapmodify succeed as expected"
108 echo "ldapmodify failed ($RC)!"
113 echo ">>>>> Test succeeded"
115 test $KILLSERVERS != no && wait