3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2004 The OpenLDAP Foundation.
6 ## All rights reserved.
8 ## Redistribution and use in source and binary forms, with or without
9 ## modification, are permitted only as authorized by the OpenLDAP
12 ## A copy of this license is available in the file LICENSE in the
13 ## top-level directory of the distribution or, alternatively, at
14 ## <http://www.OpenLDAP.org/license.html>.
16 echo "running defines.sh"
17 . $SRCDIR/scripts/defines.sh
19 mkdir -p $TESTDIR $DBDIR1
21 echo "Running slapadd to build slapd database..."
22 . $CONFFILTER $BACKEND $MONITORDB < $MCONF > $ADDCONF
23 $SLAPADD -f $ADDCONF -l $LDIFORDERED
25 if test $RC != 0 ; then
26 echo "slapadd failed ($RC)!"
30 echo "Running slapindex to index slapd database..."
31 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1
34 if test $RC != 0 ; then
35 echo "warning: slapindex failed ($RC)"
36 echo " assuming no indexing support"
39 echo "Starting slapd on TCP/IP port $PORT1..."
40 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
42 if test $WAIT != 0 ; then
48 echo "Testing slapd searching..."
49 for i in 0 1 2 3 4 5; do
50 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
51 'objectclass=*' > /dev/null 2>&1
53 if test $RC = 0 ; then
56 echo "Waiting 5 seconds for slapd to start..."
60 if test $RC != 0 ; then
61 echo "ldapsearch failed ($RC)!"
62 test $KILLSERVERS != no && kill -HUP $KILLPIDS
66 cat /dev/null > $SEARCHOUT
68 echo "Testing exact searching..."
69 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
70 '(sn:=jensen)' >> $SEARCHOUT 2>&1
72 if test $RC != 0 ; then
73 echo "ldapsearch failed ($RC)!"
74 test $KILLSERVERS != no && kill -HUP $KILLPIDS
78 echo "Testing approximate searching..."
79 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
80 '(sn~=jensen)' name >> $SEARCHOUT 2>&1
82 if test $RC != 0 ; then
83 echo "ldapsearch failed ($RC)!"
84 test $KILLSERVERS != no && kill -HUP $KILLPIDS
88 echo "Testing OR searching..."
89 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
90 '(|(givenName=XX*YY*Z)(cn=)(undef=*)(objectclass=groupofnames)(objectclass=groupofuniquenames)(sn:caseExactMatch:=Jones))' >> $SEARCHOUT 2>&1
92 if test $RC != 0 ; then
93 echo "ldapsearch failed ($RC)!"
94 test $KILLSERVERS != no && kill -HUP $KILLPIDS
98 echo "Testing AND matching and ends-with searching..."
99 $LDAPSEARCH -S "" -b "ou=groups,$BASEDN" -s one -h $LOCALHOST -p $PORT1 \
100 '(&(|(objectclass=groupofnames)(objectclass=groupofuniquenames))(cn=A*))' >> $SEARCHOUT 2>&1
102 if test $RC != 0 ; then
103 echo "ldapsearch failed ($RC)!"
104 test $KILLSERVERS != no && kill -HUP $KILLPIDS
108 echo "Testing NOT searching..."
109 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
110 '(!(objectclass=pilotPerson))' >> $SEARCHOUT 2>&1
112 if test $RC != 0 ; then
113 echo "ldapsearch failed ($RC)!"
114 test $KILLSERVERS != no && kill -HUP $KILLPIDS
118 echo "Testing objectClass/attributeType inheritance ..."
119 $LDAPSEARCH -M -a never -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
120 '(&(objectClass=inetorgperson)(userid=uham))' \
121 "2.5.4.0" "userid" >> $SEARCHOUT 2>&1
123 if test $RC != 0 ; then
124 echo "ldapsearch failed ($RC)!"
125 test $KILLSERVERS != no && kill -HUP $KILLPIDS
128 echo "Testing extended RFC2254 searching..."
129 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
130 '(:dn:caseIgnoreIA5Match:=example)' >> $SEARCHOUT 2>&1
133 if test $RC != 0 ; then
134 echo "ldapsearch failed ($RC)!"
135 test $KILLSERVERS != no && kill -HUP $KILLPIDS
139 echo "Testing values return filter searching..."
140 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
141 -E '!mv=(o=Example, Inc.)' \
142 '(o=Example, Inc.)' >> $SEARCHOUT 2>&1
144 if test $RC != 0 ; then
145 echo "ldapsearch failed ($RC)!"
146 test $KILLSERVERS != no && kill -HUP $KILLPIDS
150 test $KILLSERVERS != no && kill -HUP $KILLPIDS
152 LDIF=$SEARCHOUTMASTER
155 echo "Filtering ldapsearch results..."
156 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
157 echo "Filtering original ldif used to create database..."
158 . $LDIFFILTER < $LDIF > $LDIFFLT
159 . $LDIFFILTER < $LDIF2 >> $LDIFFLT
160 echo "Comparing filter output..."
161 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
163 if test $? != 0 ; then
164 echo "Comparison failed"
168 echo ">>>>> Test succeeded"