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