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
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 echo "Searching database..."
55 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 > $SEARCHOUT 2>&1
58 if test $RC != 0 ; then
59 echo "ldapsearch failed ($RC)!"
60 test $KILLSERVERS != no && kill -HUP $KILLPIDS
64 echo "Searching database for DN..."
65 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
66 "(member=OU=Sales+CN=J. Smith,DC=example,DC=net)" >> $SEARCHOUT 2>&1
69 if test $RC != 0 ; then
70 echo "ldapsearch failed ($RC)!"
71 test $KILLSERVERS != no && kill -HUP $KILLPIDS
75 echo "Searching database for uniqueMember..."
76 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
77 "(uniqueMember=dc=example,dc=com)" >> $SEARCHOUT 2>&1
80 if test $RC != 0 ; then
81 echo "ldapsearch failed ($RC)!"
82 test $KILLSERVERS != no && kill -HUP $KILLPIDS
86 echo "Searching database for uniqueMember..."
87 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
88 "(uniqueMember=dc=example,dc=com#'001000'B)" >> $SEARCHOUT 2>&1
91 if test $RC != 0 ; then
92 echo "ldapsearch failed ($RC)!"
93 test $KILLSERVERS != no && kill -HUP $KILLPIDS
97 echo "Searching database for uniqueMember (approx) ..."
98 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
99 "(uniqueMember~=dc=example,dc=com)" >> $SEARCHOUT 2>&1
102 if test $RC != 0 ; then
103 echo "ldapsearch failed ($RC)!"
104 test $KILLSERVERS != no && kill -HUP $KILLPIDS
108 echo "Searching database for uniqueMember (approx) ..."
109 $LDAPSEARCH -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
110 "(uniqueMember~=dc=example,dc=com#'001000'B)" >> $SEARCHOUT 2>&1
113 if test $RC != 0 ; then
114 echo "ldapsearch failed ($RC)!"
115 test $KILLSERVERS != no && kill -HUP $KILLPIDS
119 test $KILLSERVERS != no && kill -HUP $KILLPIDS
123 echo "Filtering ldapsearch results..."
124 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
125 echo "Comparing ldapsearch results against original..."
126 $CMP $SEARCHFLT $LDIFOUT > $CMPOUT
128 if test $? != 0 ; then
129 echo "comparison failed - DN write operations did not complete correctly"
135 echo ">>>>> Test succeeded"