]> git.sur5r.net Git - openldap/blobdiff - tests/scripts/test028-idassert
Merge remote branch 'origin/mdb.master'
[openldap] / tests / scripts / test028-idassert
index 55db91c4aeca05a821d037c930dcd6b65a42506a..3e8965439a0241f8b213325ab5c6f96028c699ae 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-2011 The OpenLDAP Foundation.
 ## All rights reserved.
 ##
 ## Redistribution and use in source and binary forms, with or without
@@ -16,7 +16,7 @@
 echo "running defines.sh"
 . $SRCDIR/scripts/defines.sh
 
-echo "### This test requires the ldap backend."
+echo "### This test requires the LDAP backend and the rwm overlay."
 echo "### If available, and explicitly requested, it can use SASL bind;"
 echo "### note that SASL must be properly set up, and the requested"
 echo "### mechanism must be available.  Define SLAPD_USE_SASL={yes|<mech>},"
@@ -27,6 +27,16 @@ if test $BACKLDAP = "ldapno" ; then
        exit 0
 fi 
 
+if test $RWM = "rwmno" ; then 
+       echo "Rewrite/remap overlay not available, test skipped"
+       exit 0
+fi 
+
+if test $THREADS = "threadsno" ; then
+       echo "Need threads support, test skipped"
+       exit 0
+fi 
+
 if test $WITH_SASL = "yes" ; then
        if test $USE_SASL != "no" ; then
                if test $USE_SASL = "yes" ; then
@@ -69,6 +79,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 \
@@ -94,30 +106,30 @@ AUTHZID="u:it/jaj"
 echo "Testing ldapwhoami as proxy US, $AUTHZID..."
 $LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "cn=proxy US,ou=Admin,dc=example,dc=com" -w proxy -e\!"authzid=$AUTHZID"
 RC=$?
-if test $RC != 0 ; then
+if test $RC != 0 && test $BACKEND != null ; then
        echo "ldapwhoami failed ($RC)!"
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
        exit $RC
 fi
 
 AUTHZID="u:bjorn"
-echo "Testing ldapwhoami as proxy US, $AUTHZID..."
+echo "Testing ldapwhoami as proxy US, $AUTHZID... (should fail)"
 $LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "cn=proxy US,ou=Admin,dc=example,dc=com" -w proxy -e\!"authzid=$AUTHZID"
 RC=$?
 if test $RC != 1 ; then
        echo "ldapwhoami should have failed ($RC)!"
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
-       exit $RC
+       exit 1
 fi
 
 AUTHZID="u:bjensen"
-echo "Testing ldapwhoami as proxy US, $AUTHZID..."
+echo "Testing ldapwhoami as proxy US, $AUTHZID... (should fail)"
 $LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "cn=proxy US,ou=Admin,dc=example,dc=com" -w proxy -e\!"authzid=$AUTHZID"
 RC=$?
 if test $RC != 1 ; then
        echo "ldapwhoami should have failed ($RC)!"
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
-       exit $RC
+       exit 1
 fi
 
 echo "Testing ldapwhoami as proxy IT..."
@@ -130,30 +142,30 @@ if test $RC != 0 ; then
 fi
 
 AUTHZID="u:it/jaj"
-echo "Testing ldapwhoami as proxy IT, $AUTHZID..."
+echo "Testing ldapwhoami as proxy IT, $AUTHZID... (should fail)"
 $LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "cn=proxy IT,ou=Admin,dc=example,dc=com" -w proxy -e\!"authzid=$AUTHZID"
 RC=$?
 if test $RC != 1 ; then
        echo "ldapwhoami should have failed ($RC)!"
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
-       exit $RC
+       exit 1
 fi
 
 AUTHZID="u:bjorn"
-echo "Testing ldapwhoami as proxy IT, $AUTHZID..."
+echo "Testing ldapwhoami as proxy IT, $AUTHZID... (should fail)"
 $LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "cn=proxy IT,ou=Admin,dc=example,dc=com" -w proxy -e\!"authzid=$AUTHZID"
 RC=$?
 if test $RC != 1 ; then
        echo "ldapwhoami should have failed ($RC)!"
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
-       exit $RC
+       exit 1
 fi
 
 AUTHZID="dn:cn=Sandbox,ou=Admin,dc=example,dc=com"
 echo "Testing ldapwhoami as proxy IT, $AUTHZID..."
 $LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "cn=proxy IT,ou=Admin,dc=example,dc=com" -w proxy -e\!"authzid=$AUTHZID"
 RC=$?
-if test $RC != 0 ; then
+if test $RC != 0 && test $BACKEND != null ; then
        echo "ldapwhoami failed ($RC)!"
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
        exit $RC
@@ -186,19 +198,19 @@ $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASE" \
        -D "$ID" -w jaj > $SEARCHOUT 2>&1
 
 RC=$?
-if test $RC != 0 ; then
+if test $RC != 0 && test $BACKEND != null ; then
        echo "ldapsearch failed ($RC)!"
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
        exit $RC
 fi
 
 echo "Filtering ldapsearch results..."
-. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
+$LDIFFILTER -s ldif=e < $SEARCHOUT > $SEARCHFLT
 echo "Filtering original ldif used to create database..."
-. $LDIFFILTER < $IDASSERTOUT > $LDIFFLT
+$LDIFFILTER -s ldif=e < $IDASSERTOUT > $LDIFFLT
 echo "Comparing filter output..."
 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
-       
+
 if test $? != 0 ; then
        echo "comparison failed - search with identity assertion didn't succeed"
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
@@ -220,9 +232,9 @@ if test $USE_SASL != "no" ; then
        fi
 
        echo "Filtering ldapsearch results..."
-       $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
+       $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
        echo "Filtering original ldif used to create database..."
-       $LDIFFILTER < $IDASSERTOUT > $LDIFFLT
+       $LDIFFILTER < $IDASSERTOUT > $LDIFFLT
        echo "Comparing filter output..."
        $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
        
@@ -236,5 +248,7 @@ fi
 test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
 echo ">>>>> Test succeeded"
-exit 0
 
+test $KILLSERVERS != no && wait
+
+exit 0