5 if test $# -ge 1 ; then
9 . $SRCDIR/scripts/args.sh $*
11 echo "running defines.sh"
12 . $SRCDIR/scripts/defines.sh
14 echo "Cleaning up in $DBDIR..."
18 echo "Running slapadd to build slapd database..."
19 . $CONFFILTER $BACKEND $MONITORDB < $MCONF > $ADDCONF
20 $SLAPADD -f $ADDCONF -l $LDIFORDERED
22 if test $RC != 0 ; then
23 echo "slapadd failed ($RC)!"
27 echo "Running slapindex to index slapd database..."
28 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $DBCONF
31 if test $RC != 0 ; then
32 echo "warning: slapindex failed ($RC)"
33 echo " assuming no indexing support"
36 echo "Starting slapd on TCP/IP port $PORT..."
37 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
39 if test $WAIT != 0 ; then
44 echo "Testing slapd searching..."
45 for i in 0 1 2 3 4 5; do
46 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
47 '(objectclass=*)' > /dev/null 2>&1
49 if test $RC = 0 ; then
52 echo "Waiting 5 seconds for slapd to start..."
56 if test $RC != 0 ; then
57 echo "ldapsearch failed ($RC)!"
62 cat /dev/null > $SEARCHOUT
64 echo "Testing exact searching..."
65 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
66 '(sn=jENSEN)' >> $SEARCHOUT 2>&1
68 if test $RC != 0 ; then
69 echo "ldapsearch failed ($RC)!"
74 echo "Testing OR searching..."
75 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
76 '(|(givenname=Xx*yY*Z)(cn=)(undef=*)(objectclass=groupofnames)(sn=jones)(member=cn=Manager,o=University of Michigan,c=US)(uniqueMember=cn=Manager,o=University of Michigan,c=US))' >> $SEARCHOUT 2>&1
78 if test $RC != 0 ; then
79 echo "ldapsearch failed ($RC)!"
84 echo "Testing AND matching and ends-with searching..."
85 $LDAPSEARCH -S "" -b "ou=groups,$BASEDN" -s one -h $LOCALHOST -p $PORT \
86 '(&(objectclass=groupofnames)(cn=A*)(member=cn=Mark Elliot,ou=Alumni Association,ou=People,o=University of Michigan,c=US))' >> $SEARCHOUT 2>&1
88 if test $RC != 0 ; then
89 echo "ldapsearch failed ($RC)!"
94 echo "Testing NOT searching..."
95 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
96 '(!(objectclass=pilotPerson))' >> $SEARCHOUT 2>&1
98 if test $RC != 0 ; then
99 echo "ldapsearch failed ($RC)!"
104 echo "Testing objectClass/attributeType inheritance ..."
105 $LDAPSEARCH -M -a never -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
106 '(&(objectClass=inetorgperson)(userid=uham))' \
107 "2.5.4.0" "userid" >> $SEARCHOUT 2>&1
109 if test $RC != 0 ; then
110 echo "ldapsearch failed ($RC)!"
117 LDIF=$SEARCHOUTMASTER
119 echo "Filtering ldapsearch results..."
120 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
121 echo "Filtering original ldif used to create database..."
122 . $LDIFFILTER < $LDIF > $LDIFFLT
123 echo "Comparing filter output..."
124 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
126 if test $? != 0 ; then
127 echo "Comparison failed"
131 echo ">>>>> Test succeeded"