From 4c37ef08abc56fe883e75333f04cf2a7382fce07 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Wed, 16 Jun 2004 20:08:56 +1000 Subject: [PATCH] - djm@cvs.openbsd.org 2004/04/27 09:47:30 [regress/Makefile regress/test-exec.sh, added regress/envpass.sh] regress test for environment passing, SendEnv & AcceptEnv options; ok markus@ --- ChangeLog | 8 +++++++- envpass.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ regress/Makefile | 3 ++- regress/test-exec.sh | 4 +++- 4 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 envpass.sh diff --git a/ChangeLog b/ChangeLog index 024e4f219..1c6382737 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,12 @@ 20040616 - (dtucker) [openbsd-compat/port-aix.c] Expand whitespace -> tabs. No code changes. + - (dtucker) OpenBSD CVS Sync regress/ + - djm@cvs.openbsd.org 2004/04/27 09:47:30 + [Makefile test-exec.sh] + regress test for environment passing, SendEnv & AcceptEnv options; + ok markus@ + 20040615 - (djm) OpenBSD CVS Sync @@ -1226,4 +1232,4 @@ - (djm) Trim deprecated options from INSTALL. Mention UsePAM - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu -$Id: ChangeLog,v 1.3388 2004/06/16 02:01:15 dtucker Exp $ +$Id: ChangeLog,v 1.3389 2004/06/16 10:08:56 dtucker Exp $ diff --git a/envpass.sh b/envpass.sh new file mode 100644 index 000000000..67044d421 --- /dev/null +++ b/envpass.sh @@ -0,0 +1,44 @@ +# $OpenBSD: envpass.sh,v 1.1 2004/04/27 09:47:30 djm Exp $ +# Placed in the Public Domain. + +tid="environment passing" + +# NB accepted env vars are in test-exec.sh (_XXX_TEST_* and _XXX_TEST) + +trace "pass env, don't accept" +verbose "test $tid: pass env, don't accept" +_TEST_ENV=blah ${SSH} -oSendEnv="*" -F $OBJ/ssh_proxy otherhost \ + '[ -z "$_TEST_ENV" ]' +r=$? +if [ $r -ne 0 ]; then + fail "environment found" +fi + +trace "don't pass env, accept" +verbose "test $tid: don't pass env, accept" +${SSH} -F $OBJ/ssh_proxy otherhost \ + '[ -z "$_XXX_TEST_A" -a -z "$_XXX_TEST_B" ]' +r=$? +if [ $r -ne 0 ]; then + fail "environment found" +fi + +trace "pass single env, accept single env" +verbose "test $tid: pass single env, accept single env" +_XXX_TEST=blah ${SSH} -oSendEnv="_XXX_TEST" -F $OBJ/ssh_proxy otherhost \ + '[ "x$_XXX_TEST" = "xblah" ]' +r=$? +if [ $r -ne 0 ]; then + fail "environment not found" +fi + +trace "pass multiple env, accept multiple env" +verbose "test $tid: pass multiple env, accept multiple env" +_XXX_TEST_A=1 _XXX_TEST_B=2 ${SSH} -oSendEnv="_XXX_TEST_*" \ + -F $OBJ/ssh_proxy otherhost \ + '[ "x$_XXX_TEST_A" = "x1" -a "x$_XXX_TEST_B" = "x2" ]' +r=$? +if [ $r -ne 0 ]; then + fail "environment not found" +fi + diff --git a/regress/Makefile b/regress/Makefile index cf65b3630..c7e7bb06a 100644 --- a/regress/Makefile +++ b/regress/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.27 2004/02/17 08:23:20 dtucker Exp $ +# $OpenBSD: Makefile,v 1.28 2004/04/27 09:47:30 djm Exp $ REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t-exec tests: $(REGRESS_TARGETS) @@ -13,6 +13,7 @@ LTESTS= connect \ proto-version \ proto-mismatch \ exit-status \ + envpass \ transfer \ banner \ rekey \ diff --git a/regress/test-exec.sh b/regress/test-exec.sh index 986d99287..a0df0e957 100644 --- a/regress/test-exec.sh +++ b/regress/test-exec.sh @@ -1,4 +1,4 @@ -# $OpenBSD: test-exec.sh,v 1.15 2004/02/24 16:56:30 markus Exp $ +# $OpenBSD: test-exec.sh,v 1.16 2004/04/27 09:47:30 djm Exp $ # Placed in the Public Domain. PORT=4242 @@ -162,6 +162,8 @@ cat << EOF > $OBJ/sshd_config PidFile $PIDFILE AuthorizedKeysFile $OBJ/authorized_keys_%u LogLevel QUIET + AcceptEnv _XXX_TEST_* + AcceptEnv _XXX_TEST StrictModes no EOF