X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=tests%2Fscripts%2Fsql-test000-read;h=75e921d8ef71cf11a2f5bd59145fdfdaf9cc9b6a;hb=6661a26e9bc2f2fa8dd14f573a9d72acd0c5bfae;hp=98ebe373267d89916dba9083ae2ce055e44d9cbc;hpb=b4cb3e39c693e091436953ad35a36ce46ad54ef4;p=openldap diff --git a/tests/scripts/sql-test000-read b/tests/scripts/sql-test000-read index 98ebe37326..75e921d8ef 100755 --- a/tests/scripts/sql-test000-read +++ b/tests/scripts/sql-test000-read @@ -2,7 +2,7 @@ # $OpenLDAP$ ## This work is part of OpenLDAP Software . ## -## 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 @@ -71,10 +71,10 @@ 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 $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" \ @@ -401,7 +414,7 @@ fi echo "Testing operational attributes in request..." echo "# Testing operational attributes in request..." >> $SEARCHOUT $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \ - '+' 2>&1 | grep -v '^entryCSN:' >> $SEARCHOUT + '+' 2>&1 > $SEARCHFLT RC=$? if test $RC != 0 ; then @@ -410,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 @@ -425,7 +483,7 @@ case $RC in ;; *) echo "failed ($RC)!" test $KILLSERVERS != no && kill -HUP $KILLPIDS - exit $RC + exit 1 ;; esac @@ -444,7 +502,7 @@ case $RC in ;; *) echo "failed ($RC)!" test $KILLSERVERS != no && kill -HUP $KILLPIDS - exit $RC + exit 1 ;; esac @@ -482,7 +540,7 @@ case $RC in ;; *) echo "failed ($RC)!" test $KILLSERVERS != no && kill -HUP $KILLPIDS - exit $RC + exit 1 ;; esac @@ -492,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