xref: /freebsd/crypto/openssh/regress/envpass.sh (revision 3b4228da231d5b7734ca132d3407a00f8dd8079e)
1#	$OpenBSD: envpass.sh,v 1.3 2004/06/22 22:42:02 dtucker Exp $
2#	Placed in the Public Domain.
3
4tid="environment passing"
5
6# NB accepted env vars are in test-exec.sh (_XXX_TEST_* and _XXX_TEST)
7
8trace "pass env, don't accept"
9verbose "test $tid: pass env, don't accept"
10_TEST_ENV=blah ${SSH} -oSendEnv="*" -F $OBJ/ssh_proxy otherhost \
11	sh << 'EOF'
12	test -z "$_TEST_ENV"
13EOF
14r=$?
15if [ $r -ne 0 ]; then
16	fail "environment found"
17fi
18
19trace "don't pass env, accept"
20verbose "test $tid: don't pass env, accept"
21${SSH} -F $OBJ/ssh_proxy otherhost \
22	sh << 'EOF'
23	test -z "$_XXX_TEST_A" && test -z "$_XXX_TEST_B"
24EOF
25r=$?
26if [ $r -ne 0 ]; then
27	fail "environment found"
28fi
29
30trace "pass single env, accept single env"
31verbose "test $tid: pass single env, accept single env"
32_XXX_TEST=blah ${SSH} -oSendEnv="_XXX_TEST" -F $OBJ/ssh_proxy otherhost \
33	sh << 'EOF'
34	test X"$_XXX_TEST" = X"blah"
35EOF
36r=$?
37if [ $r -ne 0 ]; then
38	fail "environment not found"
39fi
40
41trace "pass multiple env, accept multiple env"
42verbose "test $tid: pass multiple env, accept multiple env"
43_XXX_TEST_A=1 _XXX_TEST_B=2 ${SSH} -oSendEnv="_XXX_TEST_*" \
44    -F $OBJ/ssh_proxy otherhost \
45	sh << 'EOF'
46	test X"$_XXX_TEST_A" = X"1" -a X"$_XXX_TEST_B" = X"2"
47EOF
48r=$?
49if [ $r -ne 0 ]; then
50	fail "environment not found"
51fi
52