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 $DBDIR2
20 . $CONFFILTER $BACKEND $MONITORDB < $EMPTYDNCONF > $CONF1
22 echo "Running slapadd to build \"dc=example,dc=com\" slapd database..."
23 $SLAPADD -f $CONF1 -n 1 -l $LDIFEMPTYDN1
25 if test $RC != 0 ; then
26 echo "slapadd failed ($RC)!"
30 echo "Running slapadd to build empty DN slapd database..."
31 $SLAPADD -f $CONF1 -n 3 -l $LDIFEMPTYDN2
33 if test $RC != 0 ; then
34 echo "slapadd failed ($RC)!"
38 echo "Starting slapd on TCP/IP port $PORT1..."
39 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
41 if test $WAIT != 0 ; then
47 echo "Testing slapd empty DN handling..."
48 for i in 0 1 2 3 4 5; do
49 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
50 'objectclass=*' > /dev/null 2>&1
52 if test $RC = 0 ; then
55 echo "Waiting 5 seconds for slapd to start..."
59 if test $RC != 0 ; then
60 echo "ldapsearch failed ($RC)!"
61 test $KILLSERVERS != no && kill -HUP $KILLPIDS
65 echo "Searching database..."
67 $LDAPSEARCH -b "" -h $LOCALHOST -p $PORT1 > $SEARCHOUT 2>&1
70 if test $RC != 0 ; then
71 echo "ldapsearch failed ($RC)!"
72 test $KILLSERVERS != no && kill -HUP $KILLPIDS
76 test $KILLSERVERS != no && kill -HUP $KILLPIDS
81 echo "Comparing ldapsearch results against original..."
82 $CMP $SEARCHOUT $LDIFOUT > $CMPOUT
84 if test $? != 0 ; then
85 echo "comparison failed - empty DN write operations did not complete correctly"
89 echo "Comparison of database generated via slapadd succeeded"
91 echo "Cleaning up database directories..."
92 /bin/rm -rf testrun/db.*
94 mkdir -p $TESTDIR $DBDIR1 $DBDIR2
96 echo "Starting slapd on TCP/IP port $PORT1..."
97 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
99 if test $WAIT != 0 ; then
105 echo "Testing slapd empty DN handling..."
106 for i in 0 1 2 3 4 5; do
107 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
108 'objectclass=*' > /dev/null 2>&1
110 if test $RC = 0 ; then
113 echo "Waiting 5 seconds for slapd to start..."
117 if test $RC != 0 ; then
118 echo "ldapsearch failed ($RC)!"
119 test $KILLSERVERS != no && kill -HUP $KILLPIDS
123 echo "Loading database..."
124 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
125 -f $LDIFEMPTYDN1 > /dev/null 2>&1
126 $LDAPADD -D "$EMPTYDNDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
127 -f $LDIFEMPTYDN2 > /dev/null 2>&1
129 $LDAPMODIFY -D "$EMPTYDNDN" -h $LOCALHOST -p $PORT1 -w $PASSWD \
130 > /dev/null 2>&1 << EOF
138 echo "Searching database..."
140 $LDAPSEARCH -b "" -h $LOCALHOST -p $PORT1 > $SEARCHOUT 2>&1
143 if test $RC != 0 ; then
144 echo "ldapsearch failed ($RC)!"
145 test $KILLSERVERS != no && kill -HUP $KILLPIDS
149 test $KILLSERVERS != no && kill -HUP $KILLPIDS
153 echo "Comparing ldapsearch results against original..."
154 $CMP $SEARCHOUT $LDIFOUT > $CMPOUT
156 if test $? != 0 ; then
157 echo "comparison failed - empty DN write operations did not complete correctly"
163 echo ">>>>> Test succeeded"