Import OpenSSH-5.1p1.
[dragonfly.git] / crypto / openssh-3.9p1 / regress / envpass.sh
1 #       $OpenBSD: envpass.sh,v 1.3 2004/06/22 22:42:02 dtucker Exp $
2 #       Placed in the Public Domain.
3
4 tid="environment passing"
5
6 # NB accepted env vars are in test-exec.sh (_XXX_TEST_* and _XXX_TEST)
7
8 trace "pass env, don't accept"
9 verbose "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"
13 EOF
14 r=$?
15 if [ $r -ne 0 ]; then
16         fail "environment found"
17 fi
18
19 trace "don't pass env, accept"
20 verbose "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"
24 EOF
25 r=$?
26 if [ $r -ne 0 ]; then
27         fail "environment found"
28 fi
29
30 trace "pass single env, accept single env"
31 verbose "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"
35 EOF
36 r=$?
37 if [ $r -ne 0 ]; then
38         fail "environment not found"
39 fi
40
41 trace "pass multiple env, accept multiple env"
42 verbose "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"
47 EOF
48 r=$?
49 if [ $r -ne 0 ]; then
50         fail "environment not found"
51 fi