]> git.sur5r.net Git - openldap/blobdiff - tests/scripts/sql-test000-read
Happy new year! (belated)
[openldap] / tests / scripts / sql-test000-read
index 8d7c6e3bd0552ea8d16a5d0b0e082048a5e46c5c..75e921d8ef71cf11a2f5bd59145fdfdaf9cc9b6a 100755 (executable)
@@ -2,7 +2,7 @@
 # $OpenLDAP$
 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
 ##
-## Copyright 1998-2004 The OpenLDAP Foundation.
+## Copyright 1998-2008 The OpenLDAP Foundation.
 ## All rights reserved.
 ##
 ## Redistribution and use in source and binary forms, with or without
@@ -71,14 +71,36 @@ fi
 echo -n "Testing incorrect bind (should fail)... "
 $LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "$BINDDN" -w "XXX"
 RC=$?
-if test $RC == 0 ; then
+if test $RC = 0 ; then
        echo "ldapwhoami should have failed ($RC)!"
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
+       exit 1
+fi
+
+echo "Testing baseobject search..."
+echo "# Testing baseobject search..." >> $SEARCHOUT
+$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" -s base >> $SEARCHOUT 2>&1
+
+RC=$?
+if test $RC != 0 ; then
+       echo "ldapsearch failed ($RC)!"
+       test $KILLSERVERS != no && kill -HUP $KILLPIDS
+       exit $RC
+fi
+
+echo "Testing onelevel search..."
+echo "# Testing onelevel search..." >> $SEARCHOUT
+$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" -s one >> $SEARCHOUT 2>&1
+
+RC=$?
+if test $RC != 0 ; then
+       echo "ldapsearch failed ($RC)!"
+       test $KILLSERVERS != no && kill -HUP $KILLPIDS
        exit $RC
 fi
 
-echo "Testing search..."
-echo "# Testing search..." > $SEARCHOUT
+echo "Testing subtree search..."
+echo "# Testing subtree search..." >> $SEARCHOUT
 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" >> $SEARCHOUT 2>&1
 
 RC=$?
@@ -88,6 +110,17 @@ if test $RC != 0 ; then
        exit $RC
 fi
 
+echo "Testing subtree search with manageDSAit..."
+echo "# Testing subtree search with manageDSAit..." >> $SEARCHOUT
+$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" -M '*' ref >> $SEARCHOUT 2>&1
+
+RC=$?
+if test $RC != 0 ; then
+       echo "ldapsearch failed ($RC)!"
+       test $KILLSERVERS != no && kill -HUP $KILLPIDS
+       exit $RC
+fi
+
 echo "Testing invalid filter..."
 echo "# Testing invalid filter..." >> $SEARCHOUT
 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
@@ -293,6 +326,19 @@ if test $RC != 0 ; then
        exit $RC
 fi
 
+# ITS#4604
+echo "Testing undefined attribute in filter..."
+echo "# Testing undefined attribute in filter..." >> $SEARCHOUT
+$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
+        "(|(o=example)(foobar=x))" >> $SEARCHOUT 2>&1
+
+RC=$?
+if test $RC != 0 ; then
+       echo "ldapsearch failed ($RC)!"
+       test $KILLSERVERS != no && kill -HUP $KILLPIDS
+       exit $RC
+fi
+
 echo "Testing objectClass inheritance in filter..."
 echo "# Testing objectClass inheritance in filter..." >> $SEARCHOUT
 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
@@ -329,6 +375,18 @@ if test $RC != 0 ; then
        exit $RC
 fi
 
+echo "Testing entryUUID in filter..."
+echo "# Testing entryUUID in filter..." >> $SEARCHOUT
+$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
+        "(entryUUID=00000001-0000-0001-0000-000000000000)" >> $SEARCHOUT 2>&1
+
+RC=$?
+if test $RC != 0 ; then
+       echo "ldapsearch failed ($RC)!"
+       test $KILLSERVERS != no && kill -HUP $KILLPIDS
+       exit $RC
+fi
+
 echo "Testing attribute inheritance in requested attributes..."
 echo "# Testing attribute inheritance in requested attributes..." >> $SEARCHOUT
 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
@@ -356,7 +414,7 @@ fi
 echo "Testing operational attributes in request..."
 echo "# Testing operational attributes in request..." >> $SEARCHOUT
 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
-        '+' >> $SEARCHOUT 2>&1
+        '+' 2>&1 > $SEARCHFLT
 
 RC=$?
 if test $RC != 0 ; then
@@ -365,6 +423,51 @@ if test $RC != 0 ; then
        exit $RC
 fi
 
+grep -v '^entryCSN:' $SEARCHFLT >> $SEARCHOUT 
+
+SIZELIMIT=4
+echo "Testing size limit..."
+$LDAPRSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
+       -z $SIZELIMIT -S "" '(objectClass=*)' >$SEARCHFLT 2>&1
+RC=$?
+COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHFLT`
+case $RC in
+       0)
+               if test x"$COUNT" != x ; then
+                       if test "$COUNT" -gt "$SIZELIMIT" ; then
+                               echo "...error: got $COUNT entries instead of the requested $SIZELIMIT"
+                               test $KILLSERVERS != no && kill -HUP $KILLPIDS
+                               exit 1
+                       fi
+                       echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)"
+               else
+                       echo "...error: did not expect ldapsearch success ($RC)!"
+                       test $KILLSERVERS != no && kill -HUP $KILLPIDS
+                       exit 1
+               fi
+       ;;
+       4)
+               if test x"$COUNT" != x ; then
+                       if test "$COUNT" = "$SIZELIMIT" ; then
+                               echo "...bumped into requested size limit ($SIZELIMIT)"
+                       else
+                               echo "...error: got $COUNT entries with a requested sizelimit of $SIZELIMIT"
+                               test $KILLSERVERS != no && kill -HUP $KILLPIDS
+                               exit $RC
+                       fi
+               else
+                       echo "...error: bumped into server-side size limit, but got no entries!"
+                        test $KILLSERVERS != no && kill -HUP $KILLPIDS
+                        exit $RC
+               fi
+       ;;
+       *)
+               echo "ldapsearch failed ($RC)!"
+               test $KILLSERVERS != no && kill -HUP $KILLPIDS
+               exit $RC
+       ;;
+esac
+
 echo -n "Testing compare (should be TRUE)... "
 $LDAPCOMPARE -h $LOCALHOST -p $PORT1 "$BINDDN" \
         "sn:kovalev" >> $TESTOUT 2>&1
@@ -380,7 +483,7 @@ case $RC in
        ;;
 *)     echo "failed ($RC)!"
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
-       exit $RC
+       exit 1
        ;;
 esac
 
@@ -399,7 +502,7 @@ case $RC in
        ;;
 *)     echo "failed ($RC)!"
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
-       exit $RC
+       exit 1
        ;;
 esac
 
@@ -422,13 +525,32 @@ case $RC in
        ;;
 esac
 
+echo -n "Testing compare on hasSubordinates (should be TRUE)... "
+$LDAPCOMPARE -h $LOCALHOST -p $PORT1 "$BASEDN" \
+        "hasSubordinates:TRUE" >> $TESTOUT 2>&1
+
+RC=$?
+case $RC in
+6)
+       echo "TRUE"
+       ;;
+5)     echo "FALSE!"
+       test $KILLSERVERS != no && kill -HUP $KILLPIDS
+       exit $RC
+       ;;
+*)     echo "failed ($RC)!"
+       test $KILLSERVERS != no && kill -HUP $KILLPIDS
+       exit 1
+       ;;
+esac
+
 echo "Filtering ldapsearch results..."
 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
 echo "Filtering original ldif..."
 . $LDIFFILTER < $SQLREAD > $LDIFFLT
 echo "Comparing filter output..."
 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
-       
+
 if test $? != 0 ; then
        echo "comparison failed - SQL search didn't succeed"
        test $KILLSERVERS != no && kill -HUP $KILLPIDS