From 3a42c1f7cbaec2f4a35896d807c041ceebc77b4e Mon Sep 17 00:00:00 2001 From: Love Hornquist Astrand Date: Mon, 14 Dec 2009 22:43:37 -0800 Subject: [PATCH] More debug logging --- tests/gss/check-context.in | 181 ++++++++++++++++++------------------- 1 file changed, 90 insertions(+), 91 deletions(-) diff --git a/tests/gss/check-context.in b/tests/gss/check-context.in index 3587f7cf9..8740bd506 100644 --- a/tests/gss/check-context.in +++ b/tests/gss/check-context.in @@ -123,56 +123,56 @@ fi trap "kill ${kdcpid}; echo signal killing kdc; exit 1;" EXIT -exitcode=0 +testfailed="echo test failed; cat messages.log; exit 1" -echo "Getting client initial tickets" +echo "Getting client initial tickets" ; > messages.log ${kinit} --password-file=${objdir}/foopassword --forwardable user1@${R} || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } -echo "======test unreadable/non existant keytab and its error message" +echo "======test unreadable/non existant keytab and its error message" ; > messages.log ${context} --mech-type=krb5 host@lucid.test.h5l.se || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } mv ${keytabfile} ${keytabfile}.no -echo "checking non existant keytabfile (krb5)" +echo "checking non existant keytabfile (krb5)" ; > messages.log ${context} --mech-type=krb5 host@lucid.test.h5l.se > test_context.log 2>&1 && \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } grep ${keytabfile} test_context.log > /dev/null || \ - { exitcode=1 ; echo "string missing failed"; } -echo "checking non existant keytabfile (spengo)" + { echo "string missing failed"; eval "$testfailed"; } +echo "checking non existant keytabfile (spengo)" ; > messages.log ${context} --mech-type=spnego host@lucid.test.h5l.se > test_context.log 2>&1 && \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } grep ${keytabfile} test_context.log > /dev/null || \ - { exitcode=1 ; echo "string missing failed"; } + { echo "string missing failed"; eval "$testfailed"; } mv ${keytabfile}.no ${keytabfile} echo "======test naming combinations" -echo "plain" +echo "plain" ; > messages.log ${context} --name-type=hostbased-service host@lucid.test.h5l.se || \ - { exitcode=1 ; echo "test failed"; } -echo "plain (krb5)" + { eval "$testfailed"; } +echo "plain (krb5)" ; > messages.log ${context} --name-type=krb5-principal-name host/lucid.test.h5l.se@${R} || \ - { exitcode=1 ; echo "test failed"; } -echo "plain (krb5 realmless)" + { eval "$testfailed"; } +echo "plain (krb5 realmless)" ; > messages.log ${context} --name-type=krb5-principal-name host/lucid.test.h5l.se || \ - { exitcode=1 ; echo "test failed"; } -echo "dns canon on (long name) OFF, need dns_wrapper" + { eval "$testfailed"; } +echo "dns canon on (long name) OFF, need dns_wrapper" ; > messages.log #${context} --dns-canon host@lucid.test.h5l.se || \ -# { exitcode=1 ; echo "test failed"; } -echo "dns canon off (long name)" +# { eval "$testfailed"; } +echo "dns canon off (long name)" ; > messages.log ${context} --no-dns-canon host@lucid.test.h5l.se || \ - { exitcode=1 ; echo "test failed"; } -echo "dns canon off (short name)" + { eval "$testfailed"; } +echo "dns canon off (short name)" ; > messages.log ${context} --no-dns-canon host@lucid || \ - { exitcode=1 ; echo "test failed"; } -echo "dns canon off (short name, krb5)" + { eval "$testfailed"; } +echo "dns canon off (short name, krb5)" ; > messages.log ${context} --no-dns-canon --name-type=krb5-principal-name host/lucid@${R} || \ - { exitcode=1 ; echo "test failed"; } -echo "dns canon off (short name, krb5)" + { eval "$testfailed"; } +echo "dns canon off (short name, krb5)" ; > messages.log ${context} --no-dns-canon --name-type=krb5-principal-name host/lucid || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } echo "======test context building" for mech in krb5 krb5iov spnego spnegoiov; do @@ -185,32 +185,32 @@ for mech in krb5 krb5iov spnego spnegoiov; do iov="--iov" fi - echo "${mech} no-mutual ${iov}" + echo "${mech} no-mutual ${iov}" ; > messages.log ${context} --mech-type=${mech} \ --wrapunwrap ${iov} \ --name-type=hostbased-service host@lucid.test.h5l.se || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } - echo "${mech} mutual ${iov}" + echo "${mech} mutual ${iov}" ; > messages.log ${context} --mech-type=${mech} \ --mutual \ --wrapunwrap ${iov} \ --name-type=hostbased-service host@lucid.test.h5l.se || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } - echo "${mech} delegate ${iov}" + echo "${mech} delegate ${iov}" ; > messages.log ${context} --mech-type=${mech} \ --delegate \ --wrapunwrap ${iov} \ --name-type=hostbased-service host@lucid.test.h5l.se || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } - echo "${mech} mutual delegate ${iov}" + echo "${mech} mutual delegate ${iov}" ; > messages.log ${context} --mech-type=${mech} \ --mutual --delegate \ --wrapunwrap ${iov} \ --name-type=hostbased-service host@lucid.test.h5l.se || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } done echo "======dce-style" @@ -225,14 +225,14 @@ for mech in krb5 krb5iov spnego; do iov="--iov" fi - echo "${mech}: dce-style ${iov}" + echo "${mech}: dce-style ${iov}" ; > messages.log ${context} \ --mech-type=${mech} \ --mutual \ --dce-style \ --wrapunwrap ${iov} \ --name-type=hostbased-service host@lucid.test.h5l.se || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } done @@ -240,15 +240,15 @@ echo "test gsskrb5_register_acceptor_identity (both positive and negative)" cp ${keytabfile} ${keytabfile}.new for mech in krb5 spnego; do - echo "${mech}: acceptor_identity positive" + echo "${mech}: acceptor_identity positive" ; > messages.log ${context} --gsskrb5-acceptor-identity=${keytabfile}.new \ --mech-type=$mech host@lucid.test.h5l.se || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } - echo "${mech}: acceptor_identity negative" + echo "${mech}: acceptor_identity negative" ; > messages.log ${context} --gsskrb5-acceptor-identity=${keytabfile}.foo \ --mech-type=$mech host@lucid.test.h5l.se 2>/dev/null && \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } done rm ${keytabfile}.new @@ -258,7 +258,7 @@ rm ${keytabfile}.new #${context} --mech-type=sasl-digest-md5 \ # --name-type=hostbased-service \ # host@lucid.test.h5l.se || \ -# { exitcode=1 ; echo "test failed"; } +# { eval "$testfailed"; } echo "====== gss-api session key check" @@ -267,179 +267,178 @@ echo "====== gss-api session key check" coolenctype="aes256-cts-hmac-sha1-96" limit_enctype="des3-cbc-sha1" -echo "Getting client initial tickets" +echo "Getting client initial tickets" ; > messages.log ${kinit} --password-file=${objdir}/foopassword user1@${R} || \ - { echo "kinit failed"; exitcode=1; } + { eval "$testfailed"; } -echo "Building context on cred w/o aes, but still ${coolenctype} session key" + +echo "Building context on cred w/o aes, but still ${coolenctype} session key" ; > messages.log ${context} \ --mech-type=krb5 \ --mutual-auth \ --session-enctype=${coolenctype} \ --name-type=hostbased-service host@no-aes.test.h5l.se || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } -echo "Building context on cred, check if its limited still" +echo "Building context on cred, check if its limited still" ; > messages.log ${context} \ --mech-type=krb5 \ --client-name=user1@${R} \ --limit-enctype="${limit_enctype}" \ --mutual-auth \ --name-type=hostbased-service host@no-aes.test.h5l.se || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } echo "====== ok-as-delegate" -echo "Getting client initial tickets" +echo "Getting client initial tickets" ; > messages.log ${kinit} --forwardable \ --password-file=${objdir}/foopassword user1@${R} || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } -echo "ok-as-delegate not used" +echo "ok-as-delegate not used" ; > messages.log ${context} \ --mech-type=krb5 \ --delegate \ --name-type=hostbased-service host@lucid.test.h5l.se || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } -echo "host without ok-as-delegate with policy-delegate" +echo "host without ok-as-delegate with policy-delegate" ; > messages.log ${context} \ --mech-type=krb5 \ --policy-delegate \ --server-no-delegate \ --name-type=hostbased-service host@lucid.test.h5l.se || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } -echo "ok-as-delegate used by policy" +echo "ok-as-delegate used by policy" ; > messages.log ${context} \ --mech-type=krb5 \ --policy-delegate \ --name-type=hostbased-service host@ok-delegate.test.h5l.se || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } -echo "Getting client initial tickets with --ok-as-delgate" +echo "Getting client initial tickets with --ok-as-delgate" ; > messages.log ${kinit} --ok-as-delegate --forwardable \ --password-file=${objdir}/foopassword user1@${R} || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } -echo "policy delegate to non delegate host" +echo "policy delegate to non delegate host" ; > messages.log ${context} \ --mech-type=krb5 \ --policy-delegate \ --server-no-delegate \ --name-type=hostbased-service host@lucid.test.h5l.se || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } -echo "ok-as-delegate" +echo "ok-as-delegate" ; > messages.log ${context} \ --mech-type=krb5 \ --delegate \ --name-type=hostbased-service host@lucid.test.h5l.se || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } echo "======export/import cred" -echo "export-import cred (krb5)" +echo "export-import cred (krb5)" ; > messages.log ${context} \ --mech-type=krb5 \ --delegate \ --export-import-cred \ --name-type=hostbased-service host@ok-delegate.test.h5l.se || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } -echo "export-import cred (spnego)" +echo "export-import cred (spnego)" ; > messages.log ${context} \ --mech-type=spnego \ --delegate \ --export-import-cred \ --name-type=hostbased-service host@ok-delegate.test.h5l.se || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } echo "======time diffs between client and server" -echo "Getting client initial ticket" +echo "Getting client initial ticket" ; > messages.log ${kinit} --password-file=${objdir}/foopassword user1@${R} || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } -echo "No time offset" +echo "No time offset" ; > messages.log ${context} \ --mech-type=krb5 \ --name-type=hostbased-service host@lucid.test.h5l.se || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } -echo "Getting client initial ticket" -${kinit} --password-file=${objdir}/foopassword user1@${R} || exitcode=1 +echo "Getting client initial ticket" ; > messages.log +${kinit} --password-file=${objdir}/foopassword user1@${R} || \ + { eval "$testfailed"; } -echo "Server time offset" +echo "Server time offset" ; > messages.log ${context} \ --mech-type=krb5 \ --mutual-auth \ --server-time-offset=3600 \ --max-loops=3 \ --name-type=hostbased-service host@lucid.test.h5l.se || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } -echo "Server time offset (cached ?)" +echo "Server time offset (cached ?)" ; > messages.log ${context} \ --mech-type=krb5 \ --mutual-auth \ --server-time-offset=3600 \ --max-loops=2 \ --name-type=hostbased-service host@lucid.test.h5l.se || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } -echo "Getting client initial ticket" +echo "Getting client initial ticket" ; > messages.log ${kinit} --password-file=${objdir}/foopassword user1@${R} || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } # Pre-poplute the cache since tgs-req will fail since our time is wrong ${kgetcred} host/lucid.test.h5l.se@${R} || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } -echo "Client time offset" +echo "Client time offset" ; > messages.log ${context} \ --mech-type=krb5 \ --mutual-auth \ --client-time-offset=3600 \ --name-type=hostbased-service host@lucid.test.h5l.se || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } -echo "Getting client initial tickets (use-referrals)" +echo "Getting client initial tickets (use-referrals)" ; > messages.log ${kinit} \ --password-file=${objdir}/foopassword \ --use-referrals user1@${R} || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } # XXX these tests really need to use somethat that resolve to something ${context} \ --mech-type=krb5 \ host@short || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } ${context} \ --mech-type=krb5 \ --name-type=krb5-principal-name host/short || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } ${context} \ --mech-type=krb5 \ host@long.test.h5l.se || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } ${context} \ --mech-type=krb5 \ --name-type=krb5-principal-name \ host/long.test.h5l.se || \ - { exitcode=1 ; echo "test failed"; } + { eval "$testfailed"; } trap "" EXIT echo "killing kdc (${kdcpid})" kill ${kdcpid} 2> /dev/null -[ "$exitcode" = 0 ] && echo "all ok" - -exit $exitcode - +exit 0