]> git.sur5r.net Git - openldap/blobdiff - tests/scripts/test035-meta
Add missing revision string
[openldap] / tests / scripts / test035-meta
index e3df6710ec92f125f4cece2360e867a1ef4e3eef..bed89b52eb71beb0ed9ec24e3d17233be8e12cd7 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
@@ -23,12 +23,17 @@ if test $BACKMETA = metano ; then
        exit 0
 fi
 
+if test $BACKLDAP = ldapno ; then 
+       echo "ldap backend not available, test skipped"
+       exit 0
+fi
+
 rm -rf $TESTDIR
 
 mkdir -p $TESTDIR $DBDIR1 $DBDIR2
 
 echo "Starting slapd on TCP/IP port $PORT1..."
-. $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1
+. $CONFFILTER $BACKEND $MONITORDB < $METACONF1 > $CONF1
 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
 PID=$!
 if test $WAIT != 0 ; then
@@ -37,6 +42,8 @@ if test $WAIT != 0 ; then
 fi
 KILLPIDS="$PID"
 
+sleep 1
+
 echo "Using ldapsearch to check that slapd is running..."
 for i in 0 1 2 3 4 5; do
        $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
@@ -74,6 +81,8 @@ if test $WAIT != 0 ; then
 fi
 KILLPIDS="$KILLPIDS $PID"
 
+sleep 1
+
 echo "Using ldapsearch to check that slapd is running..."
 for i in 0 1 2 3 4 5; do
        $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
@@ -111,6 +120,8 @@ if test $WAIT != 0 ; then
 fi
 KILLPIDS="$KILLPIDS $PID"
 
+sleep 1
+
 echo "Using ldapsearch to check that slapd is running..."
 for i in 0 1 2 3 4 5; do
        $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT3 \
@@ -149,7 +160,34 @@ case $RC in
                exit 0
        ;;
        *)
-               echo "Compare failed ($RC)!"
+               echo "Search failed ($RC)!"
+               test $KILLSERVERS != no && kill -HUP $KILLPIDS
+               exit $RC
+       ;;
+esac
+
+# ITS#4195: spurious matchedDN when the search scopes the main target,
+# and the searchBase is not present, so that target returns noSuchObject
+BASEDN="ou=Meta,o=Example,c=US"
+echo "Searching base=\"$BASEDN\"..."
+echo "# searching base=\"$BASEDN\"..." >> $SEARCHOUT
+$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT3 -b "$BASEDN" >> $SEARCHOUT 2>&1
+RC=$?
+#if test $RC != 0 ; then
+#      echo "Search failed ($RC)!"
+#      test $KILLSERVERS != no && kill -HUP $KILLPIDS
+#      exit $RC
+#fi
+case $RC in 
+       0)
+       ;;
+       51)
+               echo "### Hit LDAP_BUSY problem; you may want to re-run the test"
+               test $KILLSERVERS != no && kill -HUP $KILLPIDS
+               exit 0
+       ;;
+       *)
+               echo "Search failed ($RC)!"
                test $KILLSERVERS != no && kill -HUP $KILLPIDS
                exit $RC
        ;;
@@ -259,7 +297,7 @@ case $RC in
                exit 0
        ;;
        *)
-               echo "Compare failed ($RC)!"
+               echo "Modify failed ($RC)!"
                test $KILLSERVERS != no && kill -HUP $KILLPIDS
                exit $RC
        ;;
@@ -283,7 +321,7 @@ case $RC in
                exit 0
        ;;
        *)
-               echo "Compare failed ($RC)!"
+               echo "Search failed ($RC)!"
                test $KILLSERVERS != no && kill -HUP $KILLPIDS
                exit $RC
        ;;
@@ -309,7 +347,7 @@ case $RC in
                exit 0
        ;;
        *)
-               echo "Compare failed ($RC)!"
+               echo "Search failed ($RC)!"
                test $KILLSERVERS != no && kill -HUP $KILLPIDS
                exit $RC
        ;;
@@ -340,7 +378,7 @@ case $RC in
                exit 0
        ;;
        *)
-               echo "Compare failed ($RC)!"
+               echo "Search failed ($RC)!"
                test $KILLSERVERS != no && kill -HUP $KILLPIDS
                exit $RC
        ;;
@@ -370,7 +408,7 @@ case $RC in
                exit 0
        ;;
        *)
-               echo "Compare failed ($RC)!"
+               echo "Search failed ($RC)!"
                test $KILLSERVERS != no && kill -HUP $KILLPIDS
                exit $RC
        ;;
@@ -400,7 +438,87 @@ case $RC in
                exit 0
        ;;
        *)
-               echo "Compare failed ($RC)!"
+               echo "Search failed ($RC)!"
+               test $KILLSERVERS != no && kill -HUP $KILLPIDS
+               exit $RC
+       ;;
+esac
+
+echo "Waiting 10 seconds for cached connections to timeout..."
+sleep 10
+
+echo "Searching with a timed out connection..."
+echo "# searching filter=\"$FILTER\"" >> $SEARCHOUT
+echo "#        attrs=\"member\"" >> $SEARCHOUT
+echo "#        base=\"$BASEDN\"" >> $SEARCHOUT
+echo "#        with a timed out connection..." >> $SEARCHOUT
+$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT3 -D "cn=Manager,$BASEDN" -w $PASSWD \
+       -b "$BASEDN" "$FILTER" member \
+       >> $SEARCHOUT 2>&1
+RC=$?
+#if test $RC != 0 ; then
+#      echo "Search failed ($RC)!"
+#      test $KILLSERVERS != no && kill -HUP $KILLPIDS
+#      exit $RC
+#fi
+case $RC in 
+       0)
+       ;;
+       51)
+               echo "### Hit LDAP_BUSY problem; you may want to re-run the test"
+               test $KILLSERVERS != no && kill -HUP $KILLPIDS
+               exit 0
+       ;;
+       *)
+               echo "Search failed ($RC)!"
+               test $KILLSERVERS != no && kill -HUP $KILLPIDS
+               exit $RC
+       ;;
+esac
+
+# NOTE: cannot send to $SEARCHOUT because the returned entries
+# are not predictable...
+echo "Checking server-enforced size limit..."
+echo "# Checking server-enforced size limit..." >> $SEARCHOUT
+$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT3 \
+       -D "cn=Bjorn Jensen,ou=Information Technology Division,ou=People,$BASEDN" -w bjorn \
+       -b "$BASEDN" "(objectClass=*)" 1.1 \
+       >> $TESTOUT 2>&1
+RC=$?
+case $RC in 
+       0)
+               echo "Search should have failed ($RC)!"
+               test $KILLSERVERS != no && kill -HUP $KILLPIDS
+               exit -1
+       ;;
+       4)
+       ;;
+       *)
+               echo "Search failed ($RC)!"
+               test $KILLSERVERS != no && kill -HUP $KILLPIDS
+               exit $RC
+       ;;
+esac
+
+# NOTE: cannot send to $SEARCHOUT because the returned entries
+# are not predictable...
+echo "Checking client-requested size limit..."
+echo "# Checking client-requested size limit..." >> $SEARCHOUT
+$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT3 \
+       -D "cn=Bjorn Jensen,ou=Information Technology Division,ou=People,$BASEDN" -w bjorn \
+       -b "$BASEDN" -z 2 "(objectClass=*)" 1.1 \
+       >> $TESTOUT 2>&1
+RC=$?
+case $RC in 
+       0)
+               echo "Search should have failed ($RC)!"
+               test $KILLSERVERS != no && kill -HUP $KILLPIDS
+               exit -1
+       ;;
+       4)
+       ;;
+       *)
+               echo "Search failed ($RC)!"
                test $KILLSERVERS != no && kill -HUP $KILLPIDS
                exit $RC
        ;;
@@ -439,7 +557,7 @@ case $RC in
                exit 0
        ;;
        *)
-               echo "Compare failed ($RC)!"
+               echo "Passwd ExOp failed ($RC)!"
                test $KILLSERVERS != no && kill -HUP $KILLPIDS
                exit $RC
        ;;
@@ -462,7 +580,7 @@ case $RC in
                echo "### Hit LDAP_BUSY problem; you may want to re-run the test"
        ;;
        *)
-               echo "Compare failed ($RC)!"
+               echo "WhoAmI failed ($RC)!"
                test $KILLSERVERS != no && kill -HUP $KILLPIDS
                exit $RC
        ;;
@@ -485,7 +603,7 @@ case $RC in
                echo "### Hit LDAP_BUSY problem; you may want to re-run the test"
        ;;
        *)
-               echo "Compare failed ($RC)!"
+               echo "WhoAmI failed ($RC)!"
                test $KILLSERVERS != no && kill -HUP $KILLPIDS
                exit $RC
        ;;
@@ -510,7 +628,7 @@ case $RC in
                exit 0
        ;;
        *)
-               echo "Compare failed ($RC)!"
+               echo "Passwd ExOp failed ($RC)!"
                test $KILLSERVERS != no && kill -HUP $KILLPIDS
                exit $RC
        ;;
@@ -533,12 +651,58 @@ case $RC in
                echo "### Hit LDAP_BUSY problem; you may want to re-run the test"
        ;;
        *)
-               echo "Compare failed ($RC)!"
+               echo "WhoAmI failed ($RC)!"
                test $KILLSERVERS != no && kill -HUP $KILLPIDS
                exit $RC
        ;;
 esac
 
+echo "Binding with incorrect password to database \"$BASEDN\"..."
+$LDAPWHOAMI -h $LOCALHOST -p $PORT3 \
+       -D "cn=Added User,ou=Same as above,ou=Meta,$BASEDN" \
+       -w bogus >> $TESTOUT 2>&1
+RC=$?
+#if test $RC != 0 ; then
+#      echo "WhoAmI failed ($RC)!"
+#      test $KILLSERVERS != no && kill -HUP $KILLPIDS
+#      exit $RC
+#fi
+case $RC in 
+       0)
+               echo "WhoAmI should have failed ($RC)!"
+               test $KILLSERVERS != no && kill -HUP $KILLPIDS
+               exit -1
+       ;;
+       51)
+               echo "### Hit LDAP_BUSY problem; you may want to re-run the test"
+       ;;
+       *)
+       ;;
+esac
+
+echo "Binding with non-existing user to database \"$BASEDN\"..."
+$LDAPWHOAMI -h $LOCALHOST -p $PORT3 \
+       -D "cn=Non-existing User,ou=Same as above,ou=Meta,$BASEDN" \
+       -w bogus >> $TESTOUT 2>&1
+RC=$?
+#if test $RC != 0 ; then
+#      echo "WhoAmI failed ($RC)!"
+#      test $KILLSERVERS != no && kill -HUP $KILLPIDS
+#      exit $RC
+#fi
+case $RC in 
+       0)
+               echo "WhoAmI should have failed ($RC)!"
+               test $KILLSERVERS != no && kill -HUP $KILLPIDS
+               exit -1
+       ;;
+       51)
+               echo "### Hit LDAP_BUSY problem; you may want to re-run the test"
+       ;;
+       *)
+       ;;
+esac
+
 echo "Comparing to database \"$BASEDN\"..."
 $LDAPCOMPARE -h $LOCALHOST -p $PORT3 \
        "cn=Another Added Group,ou=Groups,$BASEDN" \
@@ -547,7 +711,7 @@ RC=$?
 #if test $RC != 6 ; then
 #      echo "Compare failed ($RC)!"
 #      test $KILLSERVERS != no && kill -HUP $KILLPIDS
-#      exit $RC
+#      exit -1
 #fi
 case $RC in 
        6)
@@ -565,5 +729,7 @@ esac
 test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
 echo ">>>>> Test succeeded"
-exit 0
 
+test $KILLSERVERS != no && wait
+
+exit 0