5 if test $# -ge 1 ; then
9 if test $# -ge 1 ; then
13 if test $# -ge 1 ; then
17 if test $# -ge 1 ; then
21 echo "running defines.sh"
22 . $SRCDIR/scripts/defines.sh
24 echo "Cleaning up in $DBDIR..."
28 echo "Running slapadd to build slapd database..."
29 . $CONFFILTER $BACKEND $MONITORDB < $MCONF > $ADDCONF
30 $SLAPADD -f $ADDCONF -l $LDIFORDERED
32 if test $RC != 0 ; then
33 echo "slapadd failed ($RC)!"
37 echo "Running slapindex to index slapd database..."
38 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $DBCONF
41 if test $RC != 0 ; then
42 echo "warning: slapindex failed ($RC)"
43 echo " assuming no indexing support"
46 echo "Starting slapd on TCP/IP port $PORT..."
47 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
49 if test $WAIT != 0 ; then
54 echo "Testing slapd searching..."
55 for i in 0 1 2 3 4 5; do
56 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
57 '(objectclass=*)' > /dev/null 2>&1
59 if test $RC = 0 ; then
62 echo "Waiting 5 seconds for slapd to start..."
66 if test $RC != 0 ; then
67 echo "ldapsearch failed ($RC)!"
72 cat /dev/null > $SEARCHOUT
74 echo "Testing exact searching..."
75 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
76 '(sn=jensen)' >> $SEARCHOUT 2>&1
78 if test $RC != 0 ; then
79 echo "ldapsearch failed ($RC)!"
84 echo "Testing OR searching..."
85 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
86 '(|(givenName=XX*YY*Z)(cn=)(undef=*)(objectclass=groupofnames)(sn=jones)(member=cn=Manager,o=University of Michigan,c=US))' >> $SEARCHOUT 2>&1
88 if test $RC != 0 ; then
89 echo "ldapsearch failed ($RC)!"
94 echo "Testing AND matching and ends-with searching..."
95 $LDAPSEARCH -S "" -b "ou=groups,$BASEDN" -s one -h $LOCALHOST -p $PORT \
96 '(&(objectclass=groupofnames)(cn=A*)(member=cn=Mark Elliot,ou=Alumni Association,ou=People,o=University of Michigan,c=US))' >> $SEARCHOUT 2>&1
98 if test $RC != 0 ; then
99 echo "ldapsearch failed ($RC)!"
104 echo "Testing NOT searching..."
105 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
106 '(!(objectclass=pilotPerson))' >> $SEARCHOUT 2>&1
108 if test $RC != 0 ; then
109 echo "ldapsearch failed ($RC)!"
114 echo "Testing objectClass/attributeType inheritance ..."
115 $LDAPSEARCH -M -a never -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
116 '(&(objectClass=inetorgperson)(userid=uham))' \
117 "2.5.4.0" "userid" >> $SEARCHOUT 2>&1
119 if test $RC != 0 ; then
120 echo "ldapsearch failed ($RC)!"
127 LDIF=$SEARCHOUTMASTER
129 echo "Filtering ldapsearch results..."
130 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
131 echo "Filtering original ldif used to create database..."
132 . $LDIFFILTER < $LDIF > $LDIFFLT
133 echo "Comparing filter output..."
134 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
136 if test $? != 0 ; then
137 echo "Comparison failed"
141 echo ">>>>> Test succeeded"