3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 2004 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
44 echo "Testing slapd attribute uniqueness operations..."
45 for i in 0 1 2 3 4 5; do
46 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
47 'objectclass=*' > /dev/null 2>&1
49 if test $RC = 0 ; then
52 echo "Waiting 5 seconds for slapd to start..."
56 if test $RC != 0 ; then
57 echo "ldapsearch failed ($RC)!"
58 test $KILLSERVERS != no && kill -HUP $KILLPIDS
62 echo "Adding a unique record..."
64 #$LDAPADD -D "$UNIQUEDN" -h $LOCALHOST -p $PORT1 -w $PASSWD > \
65 # $TESTOUT 2>&1 << EOTUNIQ1
66 $LDAPADD -D "$UNIQUEDN" -h $LOCALHOST -p $PORT1 -w $PASSWD << EOTUNIQ1
67 dn: uid=dave,ou=users,o=unique
68 objectClass: inetOrgPerson
72 businessCategory: otest
77 employeeType: contractor
82 if test $RC != 0 ; then
83 echo "ldapadd failed ($RC)!"
84 test $KILLSERVERS != no && kill -HUP $KILLPIDS
88 #echo ----------------------
89 #$LDAPSEARCH -S "" -b "o=unique" -h $LOCALHOST -p $PORT1
91 echo "Adding a non-unique record..."
93 $LDAPADD -D "$UNIQUEDN" -h $LOCALHOST -p $PORT1 -w $PASSWD > \
94 $TESTOUT 2>&1 << EOTUNIQ2
95 dn: uid=bill,ou=users,o=unique
96 objectClass: inetOrgPerson
100 businessCategory: rtest
105 employeeType: contractor
110 if test $RC != 0 ; then
111 echo "ldapadd failed ($RC)!"
112 test $KILLSERVERS != no && kill -HUP $KILLPIDS
117 #echo ----------------------
118 #$LDAPSEARCH -S "" -b "o=unique" -h $LOCALHOST -p $PORT1
122 test $KILLSERVERS != no && kill -HUP $KILLPIDS
124 echo ">>>>> Test succeeded"