2
# $OpenLDAP: pkg/ldap/tests/scripts/test055-valregex,v 1.2.2.2 2009/01/22 00:01:20 kurt Exp $
3
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5
## Copyright 1998-2009 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>.
20
echo "Test does not support $BACKEND backend"
24
echo "running defines.sh"
25
. $SRCDIR/scripts/defines.sh
28
mkdir -p $TESTDIR $DBDIR1
30
echo "Running slapadd to build slapd database..."
31
. $CONFFILTER $BACKEND $MONITORDB < $VALREGEXCONF > $CONF1
32
$SLAPADD -f $CONF1 -l $LDIFORDERED
34
if test $RC != 0 ; then
35
echo "slapadd failed ($RC)!"
39
echo "Starting slapd on TCP/IP port $PORT1..."
40
$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
42
if test $WAIT != 0 ; then
50
echo "Testing attribute value regex subsitution..."
51
for i in 0 1 2 3 4 5; do
52
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
53
'objectclass=*' > /dev/null 2>&1
55
if test $RC = 0 ; then
58
echo "Waiting 5 seconds for slapd to start..."
62
if test $RC != 0 ; then
63
echo "ldapsearch failed ($RC)!"
64
test $KILLSERVERS != no && kill -HUP $KILLPIDS
68
cat /dev/null > $SEARCHOUT
70
echo "# Try an attribute vale regex that match, but substitute does not"
71
echo "# this should fail"
72
$LDAPMODIFY -D "$JAJDN" -h $LOCALHOST -p $PORT1 -w jaj >> \
73
$TESTOUT 2>&1 << EOMODS
74
dn: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
82
echo "ldapmodify failed as expected"
85
echo "ldapmodify should have failed ($RC)!"
86
test $KILLSERVERS != no && kill -HUP $KILLPIDS
90
echo "ldapmodify failed ($RC)!"
91
test $KILLSERVERS != no && kill -HUP $KILLPIDS
96
echo "# Try an attribute vale regex that match and substitute does"
97
echo "# this should succeed"
98
$LDAPMODIFY -D "$JAJDN" -h $LOCALHOST -p $PORT1 -w jaj >> \
99
$TESTOUT 2>&1 << EOMODS
100
dn: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc=com
107
test $KILLSERVERS != no && kill -HUP $KILLPIDS
111
echo "ldapmodify succeed as expected"
114
echo "ldapmodify failed ($RC)!"
119
echo ">>>>> Test succeeded"
121
test $KILLSERVERS != no && wait