]> git.sur5r.net Git - openldap/blobdiff - tests/scripts/sql-test000-read
Happy new year! (belated)
[openldap] / tests / scripts / sql-test000-read
index c7d14b5334082ed10cade68889bc3d99f525dd03..75e921d8ef71cf11a2f5bd59145fdfdaf9cc9b6a 100755 (executable)
@@ -2,7 +2,7 @@
 # $OpenLDAP$
 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
 ##
-## Copyright 1998-2005 The OpenLDAP Foundation.
+## Copyright 1998-2008 The OpenLDAP Foundation.
 ## All rights reserved.
 ##
 ## Redistribution and use in source and binary forms, with or without
@@ -74,7 +74,7 @@ RC=$?
 if test $RC = 0 ; then
        echo "ldapwhoami should have failed ($RC)!"
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
-       exit $RC
+       exit 1
 fi
 
 echo "Testing baseobject search..."
@@ -326,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" \
@@ -412,6 +425,49 @@ 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
@@ -427,7 +483,7 @@ case $RC in
        ;;
 *)     echo "failed ($RC)!"
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
-       exit $RC
+       exit 1
        ;;
 esac
 
@@ -446,7 +502,7 @@ case $RC in
        ;;
 *)     echo "failed ($RC)!"
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
-       exit $RC
+       exit 1
        ;;
 esac
 
@@ -484,7 +540,7 @@ case $RC in
        ;;
 *)     echo "failed ($RC)!"
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
-       exit $RC
+       exit 1
        ;;
 esac
 
@@ -494,7 +550,7 @@ 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