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 ## If you use this script then
20 ## Make sure that you turn on LDAP_COMP_MATCH in slapd source codes
21 ## To disable, set "WITH_COMP_MATCH=no" in source_root/openldap/tests/run.in
22 if test "$AC_WITH_COMP_MATCH" != "yes" ; then
27 mkdir -p $TESTDIR $DBDIR1
29 echo "Running slapadd to build slapd database..."
30 . $CONFFILTER $BACKEND $MONITORDB < $COMPCONF > $ADDCONF
31 $SLAPADD -f $ADDCONF -l $LDIFCOMPMATCH
33 if test $RC != 0 ; then
34 echo "slapadd failed ($RC)!"
38 echo "Running slapindex to index slapd database..."
39 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1
42 if test $RC != 0 ; then
43 echo "warning: slapindex failed ($RC)"
44 echo " assuming no indexing support"
47 echo "Starting slapd on TCP/IP port $PORT1..."
48 $SLAPD -f $ADDCONF -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
50 if test $WAIT != 0 ; then
56 echo "Testing slapd searching..."
57 for i in 0 1 2 3 4 5; do
58 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
59 'objectclass=*' > /dev/null 2>&1
61 if test $RC = 0 ; then
64 echo "Waiting 5 seconds for slapd to start..."
68 if test $RC != 0 ; then
69 echo "ldapsearch failed ($RC)!"
70 test $KILLSERVERS != no && kill -HUP $KILLPIDS
74 cat /dev/null > $SEARCHOUT
76 echo "Testing Component Filter Match RFC3687 searching:"
77 echo "# Testing Component Filter Match RFC3687 searching:" >> $SEARCHOUT
79 FILTER="(componentTest:componentFilterMatch:=item:{ component \"id\", rule caseExactMatch, value \"worldcup\" )"
81 echo "# f=$FILTER ..." >> $SEARCHOUT
82 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
83 "$FILTER" >> $SEARCHOUT 2>&1
86 if test $RC != 0 ; then
87 echo "ldapsearch failed ($RC)!"
88 test $KILLSERVERS != no && kill -HUP $KILLPIDS
92 FILTER="(componentTest:componentFilterMatch:=not:item:{ component \"id2\", rule caseExactMatch, value \"worldcup\" )"
94 echo "# f=$FILTER ..." >> $SEARCHOUT
95 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
96 "$FILTER" >> $SEARCHOUT 2>&1
99 if test $RC != 0 ; then
100 echo "ldapsearch failed ($RC)!"
101 test $KILLSERVERS != no && kill -HUP $KILLPIDS
105 FILTER="(componentTest:componentFilterMatch:=not:item:{ component \"id2\", rule componentFilterMatch, value not:item:{ component \"id.0\", rule integerMatch, value 5 }})"
106 echo " f=$FILTER ..."
107 echo "# f=$FILTER ..." >> $SEARCHOUT
108 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
109 "$FILTER" >> $SEARCHOUT 2>&1
112 if test $RC != 0 ; then
113 echo "ldapsearch failed ($RC)!"
114 test $KILLSERVERS != no && kill -HUP $KILLPIDS
118 FILTER="(componentTest:componentFilterMatch:=and:{item:{ component \"100\", rule caseIgnoreMatch, value "foobar" },item:{ component \"id2.rr.kk\", rule componentFilterMatch, value item:{ component \"id3\", rule integerMatch, value 1 }}})"
119 echo " f=$FILTER ..."
120 echo "# f=$FILTER ..." >> $SEARCHOUT
121 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
122 "$FILTER" >> $SEARCHOUT 2>&1
125 if test $RC != 0 ; then
126 echo "ldapsearch failed ($RC)!"
127 test $KILLSERVERS != no && kill -HUP $KILLPIDS
131 FILTER="(componentTest:componentFilterMatch:=and:{not:item:{ component \"100\", rule caseIgnoreMatch, value "foobar" },not:item:{ component \"id2.rr.kk\", rule componentFilterMatch, value item:{ component \"id3\", rule integerMatch, value 1 }}})"
132 echo " f=$FILTER ..."
133 echo "# f=$FILTER ..." >> $SEARCHOUT
134 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
135 "$FILTER" >> $SEARCHOUT 2>&1
138 if test $RC != 0 ; then
139 echo "ldapsearch failed ($RC)!"
140 test $KILLSERVERS != no && kill -HUP $KILLPIDS
144 FILTER="(componentTest:componentFilterMatch:=or:{not:item:{ component \"100\", rule caseIgnoreMatch, value "foobar" },not:item:{ component \"id2.rr.kk\", rule componentFilterMatch, value item:{ component \"id3\", rule integerMatch, value 1 }}})"
145 echo " f=$FILTER ..."
146 echo "# f=$FILTER ..." >> $SEARCHOUT
147 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
148 "$FILTER" >> $SEARCHOUT 2>&1
151 if test $RC != 0 ; then
152 echo "ldapsearch failed ($RC)!"
153 test $KILLSERVERS != no && kill -HUP $KILLPIDS
156 test $KILLSERVERS != no && kill -HUP $KILLPIDS
158 echo "Filtering ldapsearch results..."
159 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
160 echo "Comparing filter output..."
161 $CMP $SEARCHFLT $COMPSEARCHOUT > $CMPOUT
163 if test $? != 0 ; then
164 echo "Comparison failed"
168 echo ">>>>> Test succeeded"