Darren Tucker | 430c6a1 | 2004-06-22 13:38:56 +1000 | [diff] [blame^] | 1 | # $OpenBSD: envpass.sh,v 1.2 2004/06/22 03:12:13 markus Exp $ |
Darren Tucker | 9fe95da | 2004-06-16 20:33:55 +1000 | [diff] [blame] | 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 \ |
Darren Tucker | 430c6a1 | 2004-06-22 13:38:56 +1000 | [diff] [blame^] | 11 | sh << 'EOF' |
| 12 | test -z $_TEST_ENV |
| 13 | EOF |
Darren Tucker | 9fe95da | 2004-06-16 20:33:55 +1000 | [diff] [blame] | 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 \ |
Darren Tucker | 430c6a1 | 2004-06-22 13:38:56 +1000 | [diff] [blame^] | 22 | sh << 'EOF' |
| 23 | test -z $_XXX_TEST_A && test -z $_XXX_TEST_B |
| 24 | EOF |
Darren Tucker | 9fe95da | 2004-06-16 20:33:55 +1000 | [diff] [blame] | 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 \ |
Darren Tucker | 430c6a1 | 2004-06-22 13:38:56 +1000 | [diff] [blame^] | 33 | sh << 'EOF' |
| 34 | test X"$_XXX_TEST" = X"blah" |
| 35 | EOF |
Darren Tucker | 9fe95da | 2004-06-16 20:33:55 +1000 | [diff] [blame] | 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 \ |
Darren Tucker | 430c6a1 | 2004-06-22 13:38:56 +1000 | [diff] [blame^] | 45 | sh << 'EOF' |
| 46 | test X"$_XXX_TEST_A" = X"1" -a X"$_XXX_TEST_B" = X"2" |
| 47 | EOF |
Darren Tucker | 9fe95da | 2004-06-16 20:33:55 +1000 | [diff] [blame] | 48 | r=$? |
| 49 | if [ $r -ne 0 ]; then |
| 50 | fail "environment not found" |
| 51 | fi |