2 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 ## Copyright 2004-2007 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
32 echo "Testing slapd DN parsing..."
33 for i in 0 1 2 3 4 5; do
34 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
35 'objectclass=*' > /dev/null 2>&1
37 if test $RC = 0 ; then
40 echo "Waiting 5 seconds for slapd to start..."
44 if test $RC != 0 ; then
45 echo "ldapsearch failed ($RC)!"
46 test $KILLSERVERS != no && kill -HUP $KILLPIDS
50 echo "Loading database..."
51 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD -c -f $LDIFDN > \
54 cat /dev/null > $SEARCHOUT
56 echo "Searching database..."
57 echo "# Searching database..." >> $SEARCHOUT
58 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 >> $SEARCHOUT 2>&1
61 if test $RC != 0 ; then
62 echo "ldapsearch failed ($RC)!"
63 test $KILLSERVERS != no && kill -HUP $KILLPIDS
67 DN="OU=Sales+CN=J. Smith,DC=example,DC=net"
68 echo "Searching database for DN=\"$DN\"..."
69 echo "# Searching database for DN=\"$DN\"..." >> $SEARCHOUT
70 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
71 "(member=$DN)" >> $SEARCHOUT 2>&1
74 if test $RC != 0 ; then
75 echo "ldapsearch failed ($RC)!"
76 test $KILLSERVERS != no && kill -HUP $KILLPIDS
80 DN="testUUID=597ae2f6-16a6-1027-98f4-ABCDEFabcdef,DC=Example"
81 echo "Searching database for entryUUID-named DN=\"$DN\"..."
82 echo "# Searching database for entryUUID-named DN=\"$DN\"..." >> $SEARCHOUT
83 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
88 if test $RC != 0 ; then
89 echo "ldapsearch failed ($RC)!"
90 test $KILLSERVERS != no && kill -HUP $KILLPIDS
94 DN="dc=example,dc=com"
95 echo "Searching database for nameAndOptionalUID=\"$DN\"..."
96 echo "# Searching database for nameAndOptionalUID=\"$DN\"..." >> $SEARCHOUT
97 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
98 "(uniqueMember=$DN)" >> $SEARCHOUT 2>&1
101 if test $RC != 0 ; then
102 echo "ldapsearch failed ($RC)!"
103 test $KILLSERVERS != no && kill -HUP $KILLPIDS
107 DN="dc=example,dc=com#'001000'B"
108 echo "Searching database for nameAndOptionalUID=\"$DN\"..."
109 echo "# Searching database for nameAndOptionalUID=\"$DN\"..." >> $SEARCHOUT
110 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
111 "(uniqueMember=$DN)" >> $SEARCHOUT 2>&1
114 if test $RC != 0 ; then
115 echo "ldapsearch failed ($RC)!"
116 test $KILLSERVERS != no && kill -HUP $KILLPIDS
120 DN="dc=example,dc=com"
121 echo "Searching database for uniqueMember~=\"$DN\" (approx)..."
122 echo "# Searching database for uniqueMember~=\"$DN\" (approx)..." >> $SEARCHOUT
123 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
124 "(uniqueMember~=)" >> $SEARCHOUT 2>&1
127 if test $RC != 0 ; then
128 echo "ldapsearch failed ($RC)!"
129 test $KILLSERVERS != no && kill -HUP $KILLPIDS
133 DN="dc=example,dc=com#'001000'B"
134 echo "Searching database for uniqueMember~=\"$DN\" (approx)..."
135 echo "# Searching database for uniqueMember~=\"$DN\" (approx)..." >> $SEARCHOUT
136 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
137 "(uniqueMember~=$DN)" >> $SEARCHOUT 2>&1
140 if test $RC != 0 ; then
141 echo "ldapsearch failed ($RC)!"
142 test $KILLSERVERS != no && kill -HUP $KILLPIDS
146 test $KILLSERVERS != no && kill -HUP $KILLPIDS
148 echo "Filtering ldapsearch results..."
149 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
150 echo "Filtering original data..."
151 . $LDIFFILTER < $DNOUT > $LDIFFLT
152 echo "Comparing ldapsearch results against original..."
153 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
155 if test $? != 0 ; then
156 echo "comparison failed - DN write operations did not complete correctly"
162 echo ">>>>> Test succeeded"
164 test $KILLSERVERS != no && wait