4 echo "running defines.sh"
5 . $SRCDIR/scripts/defines.sh
7 mkdir -p $TESTDIR $DBDIR1
9 echo "Running slapadd to build slapd database..."
10 . $CONFFILTER $BACKEND $MONITORDB < $MCONF > $ADDCONF
11 $SLAPADD -f $ADDCONF -l $LDIFORDERED
13 if test $RC != 0 ; then
14 echo "slapadd failed ($RC)!"
18 echo "Running slapindex to index slapd database..."
19 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1
22 if test $RC != 0 ; then
23 echo "warning: slapindex failed ($RC)"
24 echo " assuming no indexing support"
27 echo "Starting slapd on TCP/IP port $PORT1..."
28 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
30 if test $WAIT != 0 ; then
36 echo "Testing slapd searching..."
37 for i in 0 1 2 3 4 5; do
38 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
39 'objectclass=*' > /dev/null 2>&1
41 if test $RC = 0 ; then
44 echo "Waiting 5 seconds for slapd to start..."
48 if test $RC != 0 ; then
49 echo "ldapsearch failed ($RC)!"
50 test $KILLSERVERS != no && kill -HUP $KILLPIDS
54 cat /dev/null > $SEARCHOUT
56 echo "Testing exact searching..."
57 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
58 '(sn:=jensen)' >> $SEARCHOUT 2>&1
60 if test $RC != 0 ; then
61 echo "ldapsearch failed ($RC)!"
62 test $KILLSERVERS != no && kill -HUP $KILLPIDS
66 echo "Testing OR searching..."
67 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
68 '(|(givenName=XX*YY*Z)(cn=)(undef=*)(objectclass=groupofnames)(objectclass=groupofuniquenames)(sn:caseExactMatch:=Jones))' >> $SEARCHOUT 2>&1
70 if test $RC != 0 ; then
71 echo "ldapsearch failed ($RC)!"
72 test $KILLSERVERS != no && kill -HUP $KILLPIDS
76 echo "Testing AND matching and ends-with searching..."
77 $LDAPSEARCH -S "" -b "ou=groups,$BASEDN" -s one -h $LOCALHOST -p $PORT1 \
78 '(&(|(objectclass=groupofnames)(objectclass=groupofuniquenames))(cn=A*))' >> $SEARCHOUT 2>&1
80 if test $RC != 0 ; then
81 echo "ldapsearch failed ($RC)!"
82 test $KILLSERVERS != no && kill -HUP $KILLPIDS
86 echo "Testing NOT searching..."
87 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
88 '(!(objectclass=pilotPerson))' >> $SEARCHOUT 2>&1
90 if test $RC != 0 ; then
91 echo "ldapsearch failed ($RC)!"
92 test $KILLSERVERS != no && kill -HUP $KILLPIDS
96 echo "Testing objectClass/attributeType inheritance ..."
97 $LDAPSEARCH -M -a never -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
98 '(&(objectClass=inetorgperson)(userid=uham))' \
99 "2.5.4.0" "userid" >> $SEARCHOUT 2>&1
101 if test $RC != 0 ; then
102 echo "ldapsearch failed ($RC)!"
103 test $KILLSERVERS != no && kill -HUP $KILLPIDS
107 echo "Testing extended RFC2254 searching..."
108 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
109 '(:dn:caseExactMatch:=University of Michigan)' >> $SEARCHOUT 2>&1
112 if test $RC != 0 ; then
113 echo "ldapsearch failed ($RC)!"
114 test $KILLSERVERS != no && kill -HUP $KILLPIDS
118 echo "Testing values return filter searching..."
119 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
120 -E '!mv=(o=University of Michigan)' \
121 '(o=University of Michigan)' >> $SEARCHOUT 2>&1
123 if test $RC != 0 ; then
124 echo "ldapsearch failed ($RC)!"
125 test $KILLSERVERS != no && kill -HUP $KILLPIDS
129 test $KILLSERVERS != no && kill -HUP $KILLPIDS
131 LDIF=$SEARCHOUTMASTER
134 echo "Filtering ldapsearch results..."
135 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
136 echo "Filtering original ldif used to create database..."
137 . $LDIFFILTER < $LDIF > $LDIFFLT
138 . $LDIFFILTER < $LDIF2 >> $LDIFFLT
139 echo "Comparing filter output..."
140 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
142 if test $? != 0 ; then
143 echo "Comparison failed"
147 echo ">>>>> Test succeeded"