2 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 ## Copyright 2004-2005 The OpenLDAP Foundation.
5 ## All rights reserved.
7 ## Redistribution and use in source and binary forms, with or without
8 ## modification, are permitted only as authorized by the OpenLDAP
11 ## A copy of this license is available in the file LICENSE in the
12 ## top-level directory of the distribution or, alternatively, at
13 ## <http://www.OpenLDAP.org/license.html>.
15 echo "running defines.sh"
16 . $SRCDIR/scripts/defines.sh
18 mkdir -p $TESTDIR $DBDIR1
20 . $CONFFILTER $BACKEND $MONITORDB < $DNCONF > $CONF1
21 echo "Starting slapd on TCP/IP port $PORT1..."
22 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
24 if test $WAIT != 0 ; then
30 echo "Testing slapd DN parsing..."
31 for i in 0 1 2 3 4 5; do
32 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
33 'objectclass=*' > /dev/null 2>&1
35 if test $RC = 0 ; then
38 echo "Waiting 5 seconds for slapd to start..."
42 if test $RC != 0 ; then
43 echo "ldapsearch failed ($RC)!"
44 test $KILLSERVERS != no && kill -HUP $KILLPIDS
48 echo "Loading database..."
49 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD -c -f $LDIFDN > \
52 echo "Searching database..."
53 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 > $SEARCHOUT 2>&1
56 if test $RC != 0 ; then
57 echo "ldapsearch failed ($RC)!"
58 test $KILLSERVERS != no && kill -HUP $KILLPIDS
62 echo "Searching database for DN..."
63 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
64 "(member=OU=Sales+CN=J. Smith,DC=example,DC=net)" >> $SEARCHOUT 2>&1
67 if test $RC != 0 ; then
68 echo "ldapsearch failed ($RC)!"
69 test $KILLSERVERS != no && kill -HUP $KILLPIDS
73 echo "Searching database for uniqueMember..."
74 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
75 "(uniqueMember=dc=example,dc=com)" >> $SEARCHOUT 2>&1
78 if test $RC != 0 ; then
79 echo "ldapsearch failed ($RC)!"
80 test $KILLSERVERS != no && kill -HUP $KILLPIDS
84 echo "Searching database for uniqueMember..."
85 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
86 "(uniqueMember=dc=example,dc=com#'001000'B)" >> $SEARCHOUT 2>&1
89 if test $RC != 0 ; then
90 echo "ldapsearch failed ($RC)!"
91 test $KILLSERVERS != no && kill -HUP $KILLPIDS
95 echo "Searching database for uniqueMember (approx) ..."
96 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
97 "(uniqueMember~=dc=example,dc=com)" >> $SEARCHOUT 2>&1
100 if test $RC != 0 ; then
101 echo "ldapsearch failed ($RC)!"
102 test $KILLSERVERS != no && kill -HUP $KILLPIDS
106 echo "Searching database for uniqueMember (approx) ..."
107 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
108 "(uniqueMember~=dc=example,dc=com#'001000'B)" >> $SEARCHOUT 2>&1
111 if test $RC != 0 ; then
112 echo "ldapsearch failed ($RC)!"
113 test $KILLSERVERS != no && kill -HUP $KILLPIDS
117 test $KILLSERVERS != no && kill -HUP $KILLPIDS
121 echo "Comparing ldapsearch results against original..."
122 $CMP $SEARCHOUT $LDIFOUT > $CMPOUT
124 if test $? != 0 ; then
125 echo "comparison failed - DN write operations did not complete correctly"
131 echo ">>>>> Test succeeded"