]> git.sur5r.net Git - openldap/blobdiff - tests/scripts/test035-meta
Merge remote-tracking branch 'origin/mdb.master' into OPENLDAP_REL_ENG_2_4
[openldap] / tests / scripts / test035-meta
index 30075cea8447dedcab14fd1b449763111681ed8c..7b986cb99651700e2747d768c4717e7f08406c37 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-2013 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
@@ -471,21 +476,23 @@ case $RC in
        ;;
 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 \
-       >> $SEARCHOUT 2>&1
+       >> $TESTOUT 2>&1
 RC=$?
-case $RC in 
-       0)
+case $RC,$BACKEND in
+       4,* | 0,null)
+       ;;
+       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
@@ -493,21 +500,23 @@ case $RC in
        ;;
 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 \
-       >> $SEARCHOUT 2>&1
+       >> $TESTOUT 2>&1
 RC=$?
-case $RC in 
-       0)
+case $RC,$BACKEND in
+       4,* | 0,null)
+       ;;
+       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
@@ -516,9 +525,9 @@ case $RC in
 esac
 
 echo "Filtering ldapsearch results..."
-$LDIFFILTER < $SEARCHOUT > $SEARCHFLT
+$LDIFFILTER < $SEARCHOUT > $SEARCHFLT
 echo "Filtering original ldif used to create database..."
-$LDIFFILTER < $METAOUT > $LDIFFLT
+$LDIFFILTER < $METAOUT > $LDIFFLT
 echo "Comparing filter output..."
 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
        
@@ -658,13 +667,40 @@ RC=$?
 #      test $KILLSERVERS != no && kill -HUP $KILLPIDS
 #      exit $RC
 #fi
-case $RC in 
-       0)
+case $RC,$BACKEND in
+       0,null)
+       ;;
+       0,*)
                echo "WhoAmI should have failed ($RC)!"
                test $KILLSERVERS != no && kill -HUP $KILLPIDS
                exit -1
        ;;
-       51)
+       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,$BACKEND in
+       0,null)
+       ;;
+       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"
        ;;
        *)
@@ -681,21 +717,23 @@ RC=$?
 #      test $KILLSERVERS != no && kill -HUP $KILLPIDS
 #      exit -1
 #fi
-case $RC in 
-       6)
+case $RC,$BACKEND in
+       6,* | 5,null)
        ;;
-       51)
+       51,*)
                echo "### Hit LDAP_BUSY problem; you may want to re-run the test"
        ;;
        *)
                echo "Compare failed ($RC)!"
                test $KILLSERVERS != no && kill -HUP $KILLPIDS
-               exit $RC
+               exit 1
        ;;
 esac
 
 test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
 echo ">>>>> Test succeeded"
-exit 0
 
+test $KILLSERVERS != no && wait
+
+exit 0