3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 2004-2006 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 if test $UNIQUE = uniqueno; then
20 echo "Attribute Uniqueness overlay not available, test skipped"
24 mkdir -p $TESTDIR $DBDIR1
26 echo "Running slapadd to build slapd database..."
27 . $CONFFILTER $BACKEND $MONITORDB < $UNIQUECONF > $CONF1
28 $SLAPADD -f $CONF1 -l $LDIFUNIQUE
30 if test $RC != 0 ; then
31 echo "slapadd failed ($RC)!"
35 echo "Starting slapd on TCP/IP port $PORT1..."
36 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
38 if test $WAIT != 0 ; then
46 echo "Testing slapd attribute uniqueness operations..."
47 for i in 0 1 2 3 4 5; do
48 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
49 'objectclass=*' > /dev/null 2>&1
51 if test $RC = 0 ; then
54 echo "Waiting 5 seconds for slapd to start..."
58 if test $RC != 0 ; then
59 echo "ldapsearch failed ($RC)!"
60 test $KILLSERVERS != no && kill -HUP $KILLPIDS
64 echo "Adding a unique record..."
66 #$LDAPADD -D "$UNIQUEDN" -h $LOCALHOST -p $PORT1 -w $PASSWD > \
67 # $TESTOUT 2>&1 << EOTUNIQ1
68 $LDAPADD -D "$UNIQUEDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
69 > /dev/null << EOTUNIQ1
70 dn: uid=dave,ou=users,o=unique
71 objectClass: inetOrgPerson
75 businessCategory: otest
78 # NOTE: use special chars in attr value to be used
79 # in internal searches ITS#4212
80 displayName: Dave (ITS#4212)
82 employeeType: contractor
87 if test $RC != 0 ; then
88 echo "ldapadd failed ($RC)!"
89 test $KILLSERVERS != no && kill -HUP $KILLPIDS
93 #echo ----------------------
94 #$LDAPSEARCH -S "" -b "o=unique" -h $LOCALHOST -p $PORT1
96 echo "Adding a non-unique record..."
98 $LDAPADD -D "$UNIQUEDN" -h $LOCALHOST -p $PORT1 -w $PASSWD > \
99 $TESTOUT 2>&1 << EOTUNIQ2
100 dn: uid=bill,ou=users,o=unique
101 objectClass: inetOrgPerson
105 businessCategory: rtest
110 employeeType: contractor
115 if test $RC != 19 ; then
116 echo "unique check failed ($RC)!"
117 test $KILLSERVERS != no && kill -HUP $KILLPIDS
122 #echo ----------------------
123 #$LDAPSEARCH -S "" -b "o=unique" -h $LOCALHOST -p $PORT1
127 test $KILLSERVERS != no && kill -HUP $KILLPIDS
129 echo ">>>>> Test succeeded"
131 test $KILLSERVERS != no && wait