X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=tests%2Fscripts%2Ftest034-translucent;h=acf3454a3670eb2d9327dfae3a9264807c45ce6c;hb=b6f4b3de253a5a8540fd17cd6d279eb377cee111;hp=eeb863e47e541855ef095e9dcc0b531edbf5c95f;hpb=0d360951d0166e0b18f34d82b1ee127da002c1b9;p=openldap diff --git a/tests/scripts/test034-translucent b/tests/scripts/test034-translucent index eeb863e47e..acf3454a36 100755 --- a/tests/scripts/test034-translucent +++ b/tests/scripts/test034-translucent @@ -2,7 +2,7 @@ # $OpenLDAP$ ## This work is part of OpenLDAP Software . ## -## Copyright 2004 The OpenLDAP Foundation. +## Copyright 2004-2009 The OpenLDAP Foundation. ## All rights reserved. ## ## Redistribution and use in source and binary forms, with or without @@ -25,11 +25,6 @@ if test $TRANSLUCENT = translucentno ; then exit 0 fi -if test $BACKEND = ldbm ; then - echo "Translucent Proxy overlay not qualified for use with LDBM, skipping" - exit 0 -fi - if test $AC_ldap = ldapno ; then echo "Translucent Proxy overlay requires back-ldap backend, test skipped" exit 0 @@ -38,6 +33,15 @@ fi # configure backside mkdir -p $TESTDIR $DBDIR1 +$SLAPPASSWD -g -n >$CONFIGPWF +echo "rootpw `$SLAPPASSWD -T $CONFIGPWF`" >$TESTDIR/configpw.conf + +if test $MONITORDB != no ; then + DBIX=2 +else + DBIX=1 +fi + . $CONFFILTER $BACKEND $MONITORDB < $TRANSLUCENTREMOTECONF > $CONF1 echo "Running slapadd to build remote slapd database..." $SLAPADD -f $CONF1 -l $LDIFTRANSLUCENTCONFIG @@ -57,6 +61,8 @@ fi REMOTEPID="$PID" KILLPIDS="$PID" +sleep 1 + for i in 0 1 2 3 4 5; do $LDAPSEARCH -s base -b "$MONITOR" -H $URI1 \ 'objectclass=*' > /dev/null 2>&1 @@ -89,6 +95,8 @@ fi LOCALPID="$PID" KILLPIDS="$LOCALPID $REMOTEPID" +sleep 1 + for i in 0 1 2 3 4 5; do $LDAPSEARCH -s base -b "$MONITOR" -H $URI2 \ 'objectclass=*' > /dev/null 2>&1 @@ -197,39 +205,19 @@ if test $RC != 32 ; then exit 1 fi -echo "Shutting down local slapd..." -kill -HUP $LOCALPID -sleep 5 - -echo "Configuring local slapd without translucent_no_glue..." -. $CONFFILTER $BACKEND $MONITORDB < $TRANSLUCENTLOCALCONF | \ - grep -v translucent_no_glue > $CONF2 - -echo "Restarting local slapd on TCP/IP port $PORT2..." -$SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING >> $LOG2 2>&1 & -PID=$! -if test $WAIT != 0 ; then - echo PID $PID - read foo -fi -LOCALPID="$PID" -KILLPIDS="$REMOTEPID $PID" - -for i in 0 1 2 3 4 5; do - $LDAPSEARCH -s base -b "$MONITOR" -H $URI2 \ - 'objectclass=*' > /dev/null 2>&1 - RC=$? - if test $RC = 0 ; then - break - fi - echo "Waiting 5 seconds for local slapd to start..." - sleep 5 -done +echo "Dynamically configuring local slapd without translucent_no_glue..." +$LDAPMODIFY -D cn=config -H $URI2 -y $CONFIGPWF < \ + $TESTOUT 2>&1 << EOF_MOD8 +version: 1 +dn: uid=danger,ou=users,o=translucent +changetype: modify +delete: initials +EOF_MOD8 + +RC=$? +if test $RC != 0 ; then + echo "ldapmodify failed ($RC)" + grep "$FAILURE" $TESTOUT + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit 1 +fi + echo "Testing modify: valid remote record, combination add-modify-delete..." $LDAPMODIFY -v -D "$TRANSLUCENTROOT" -H $URI2 -w $PASSWD > \ @@ -618,38 +624,22 @@ if test "$ATTR" != "preferredLanguage: ISO8859-1" ; then exit 1 fi -echo "Shutting down local slapd..." -kill -HUP $LOCALPID -sleep 5 - -echo "Configuring local slapd with translucent_strict..." -echo translucent_strict >> $CONF2 - -echo "Restarting slapd on TCP/IP port $PORT2..." -$SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING >> $LOG2 2>&1 & -PID=$! -if test $WAIT != 0 ; then - echo PID $PID - read foo -fi -LOCALPID="$PID" -KILLPIDS="$REMOTEPID $PID" - -for i in 0 1 2 3 4 5; do - $LDAPSEARCH -s base -b "$MONITOR" -H $URI2 \ - 'objectclass=*' > /dev/null 2>&1 - RC=$? - if test $RC = 0 ; then - break - fi - echo "Waiting 5 seconds for local slapd to start..." - sleep 5 -done +echo "Dynamically configuring local slapd with translucent_no_glue and translucent_strict..." +$LDAPMODIFY -D cn=config -H $URI2 -y $CONFIGPWF < \ + $TESTOUT 2>&1 +RC=$? +if test $RC != 49 ; then + echo "ldapwhoami failed ($RC), expected INVALID CREDENTIALS!" + grep "$FAILURE" $TESTOUT + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit 1 +fi + +$LDAPWHOAMI -D "$TRANSLUCENTDN" -H $URI2 -w "$TRANSLUCENTPASSWD" > \ + $TESTOUT 2>&1 +RC=$? +if test $RC != 0 ; then + echo "ldapwhoami failed ($RC), expected SUCCESS!" + grep "$FAILURE" $TESTOUT + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit 1 +fi + +echo "Testing search: unconfigured local filter..." +$LDAPSEARCH -H $URI2 -b "o=translucent" "(employeeType=consultant)" > $SEARCHOUT 2>&1 + +ATTR=`grep dn: $SEARCHOUT` > $NOWHERE 2>&1 +if test -n "$ATTR" ; then + echo "got result $ATTR, should have been no result" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit 1 +fi + +echo "Dynamically configuring local slapd with translucent_local..." + +$LDAPMODIFY -D cn=config -H $URI2 -y $CONFIGPWF < $SEARCHOUT 2>&1 + +ATTR=`grep dn: $SEARCHOUT` > $NOWHERE 2>&1 +if test -z "$ATTR" ; then + echo "got no result, should have found entry" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit 1 +fi + +echo "Testing search: unconfigured remote filter..." +$LDAPSEARCH -H $URI2 -b "o=translucent" "(|(employeeType=foo)(carlicense=right))" > $SEARCHOUT 2>&1 + +ATTR=`grep dn: $SEARCHOUT` > $NOWHERE 2>&1 +if test -n "$ATTR" ; then + echo "got result $ATTR, should have been no result" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit 1 +fi + +echo "Dynamically configuring local slapd with translucent_remote..." + +$LDAPMODIFY -D cn=config -H $URI2 -y $CONFIGPWF < $SEARCHOUT 2>&1 + +ATTR=`grep dn: $SEARCHOUT` > $NOWHERE 2>&1 +if test -z "$ATTR" ; then + echo "got no result, should have found entry" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit 1 +fi + test $KILLSERVERS != no && kill -HUP $KILLPIDS echo ">>>>> Test succeeded" + +test $KILLSERVERS != no && wait + exit 0