Darren Tucker | 5d909f0 | 2005-03-07 18:35:34 +1100 | [diff] [blame^] | 1 | # $OpenBSD: envpass.sh,v 1.4 2005/03/04 08:48:46 djm 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 | |
Darren Tucker | 5d909f0 | 2005-03-07 18:35:34 +1100 | [diff] [blame^] | 8 | # Prepare a custom config to test for a configuration parsing bug fixed in 4.0 |
| 9 | cat << EOF > $OBJ/ssh_proxy_envpass |
| 10 | Host test-sendenv-confparse-bug |
| 11 | SendEnv * |
| 12 | EOF |
| 13 | cat $OBJ/ssh_proxy >> $OBJ/ssh_proxy_envpass |
| 14 | |
Darren Tucker | 9fe95da | 2004-06-16 20:33:55 +1000 | [diff] [blame] | 15 | trace "pass env, don't accept" |
| 16 | verbose "test $tid: pass env, don't accept" |
Darren Tucker | 5d909f0 | 2005-03-07 18:35:34 +1100 | [diff] [blame^] | 17 | _TEST_ENV=blah ${SSH} -oSendEnv="*" -F $OBJ/ssh_proxy_envpass otherhost \ |
Darren Tucker | 430c6a1 | 2004-06-22 13:38:56 +1000 | [diff] [blame] | 18 | sh << 'EOF' |
Darren Tucker | 6eabe64 | 2004-06-23 09:23:58 +1000 | [diff] [blame] | 19 | test -z "$_TEST_ENV" |
Darren Tucker | 430c6a1 | 2004-06-22 13:38:56 +1000 | [diff] [blame] | 20 | EOF |
Darren Tucker | 9fe95da | 2004-06-16 20:33:55 +1000 | [diff] [blame] | 21 | r=$? |
| 22 | if [ $r -ne 0 ]; then |
| 23 | fail "environment found" |
| 24 | fi |
| 25 | |
| 26 | trace "don't pass env, accept" |
| 27 | verbose "test $tid: don't pass env, accept" |
Darren Tucker | 5d909f0 | 2005-03-07 18:35:34 +1100 | [diff] [blame^] | 28 | _XXX_TEST_A=1 _XXX_TEST_B=2 ${SSH} -F $OBJ/ssh_proxy_envpass otherhost \ |
Darren Tucker | 430c6a1 | 2004-06-22 13:38:56 +1000 | [diff] [blame] | 29 | sh << 'EOF' |
Darren Tucker | 6eabe64 | 2004-06-23 09:23:58 +1000 | [diff] [blame] | 30 | test -z "$_XXX_TEST_A" && test -z "$_XXX_TEST_B" |
Darren Tucker | 430c6a1 | 2004-06-22 13:38:56 +1000 | [diff] [blame] | 31 | EOF |
Darren Tucker | 9fe95da | 2004-06-16 20:33:55 +1000 | [diff] [blame] | 32 | r=$? |
| 33 | if [ $r -ne 0 ]; then |
| 34 | fail "environment found" |
| 35 | fi |
| 36 | |
| 37 | trace "pass single env, accept single env" |
| 38 | verbose "test $tid: pass single env, accept single env" |
Darren Tucker | 5d909f0 | 2005-03-07 18:35:34 +1100 | [diff] [blame^] | 39 | _XXX_TEST=blah ${SSH} -oSendEnv="_XXX_TEST" -F $OBJ/ssh_proxy_envpass \ |
| 40 | otherhost sh << 'EOF' |
Darren Tucker | 430c6a1 | 2004-06-22 13:38:56 +1000 | [diff] [blame] | 41 | test X"$_XXX_TEST" = X"blah" |
| 42 | EOF |
Darren Tucker | 9fe95da | 2004-06-16 20:33:55 +1000 | [diff] [blame] | 43 | r=$? |
| 44 | if [ $r -ne 0 ]; then |
| 45 | fail "environment not found" |
| 46 | fi |
| 47 | |
| 48 | trace "pass multiple env, accept multiple env" |
| 49 | verbose "test $tid: pass multiple env, accept multiple env" |
| 50 | _XXX_TEST_A=1 _XXX_TEST_B=2 ${SSH} -oSendEnv="_XXX_TEST_*" \ |
Darren Tucker | 5d909f0 | 2005-03-07 18:35:34 +1100 | [diff] [blame^] | 51 | -F $OBJ/ssh_proxy_envpass otherhost \ |
Darren Tucker | 430c6a1 | 2004-06-22 13:38:56 +1000 | [diff] [blame] | 52 | sh << 'EOF' |
| 53 | test X"$_XXX_TEST_A" = X"1" -a X"$_XXX_TEST_B" = X"2" |
| 54 | EOF |
Darren Tucker | 9fe95da | 2004-06-16 20:33:55 +1000 | [diff] [blame] | 55 | r=$? |
| 56 | if [ $r -ne 0 ]; then |
| 57 | fail "environment not found" |
| 58 | fi |
Darren Tucker | 5d909f0 | 2005-03-07 18:35:34 +1100 | [diff] [blame^] | 59 | |
| 60 | rm -f $OBJ/ssh_proxy_envpass |