envpass.sh revision 137015
1137015Sdes# $OpenBSD: envpass.sh,v 1.3 2004/06/22 22:42:02 dtucker Exp $ 2137015Sdes# Placed in the Public Domain. 3137015Sdes 4137015Sdestid="environment passing" 5137015Sdes 6137015Sdes# NB accepted env vars are in test-exec.sh (_XXX_TEST_* and _XXX_TEST) 7137015Sdes 8137015Sdestrace "pass env, don't accept" 9137015Sdesverbose "test $tid: pass env, don't accept" 10137015Sdes_TEST_ENV=blah ${SSH} -oSendEnv="*" -F $OBJ/ssh_proxy otherhost \ 11137015Sdes sh << 'EOF' 12137015Sdes test -z "$_TEST_ENV" 13137015SdesEOF 14137015Sdesr=$? 15137015Sdesif [ $r -ne 0 ]; then 16137015Sdes fail "environment found" 17137015Sdesfi 18137015Sdes 19137015Sdestrace "don't pass env, accept" 20137015Sdesverbose "test $tid: don't pass env, accept" 21137015Sdes${SSH} -F $OBJ/ssh_proxy otherhost \ 22137015Sdes sh << 'EOF' 23137015Sdes test -z "$_XXX_TEST_A" && test -z "$_XXX_TEST_B" 24137015SdesEOF 25137015Sdesr=$? 26137015Sdesif [ $r -ne 0 ]; then 27137015Sdes fail "environment found" 28137015Sdesfi 29137015Sdes 30137015Sdestrace "pass single env, accept single env" 31137015Sdesverbose "test $tid: pass single env, accept single env" 32137015Sdes_XXX_TEST=blah ${SSH} -oSendEnv="_XXX_TEST" -F $OBJ/ssh_proxy otherhost \ 33137015Sdes sh << 'EOF' 34137015Sdes test X"$_XXX_TEST" = X"blah" 35137015SdesEOF 36137015Sdesr=$? 37137015Sdesif [ $r -ne 0 ]; then 38137015Sdes fail "environment not found" 39137015Sdesfi 40137015Sdes 41137015Sdestrace "pass multiple env, accept multiple env" 42137015Sdesverbose "test $tid: pass multiple env, accept multiple env" 43137015Sdes_XXX_TEST_A=1 _XXX_TEST_B=2 ${SSH} -oSendEnv="_XXX_TEST_*" \ 44137015Sdes -F $OBJ/ssh_proxy otherhost \ 45137015Sdes sh << 'EOF' 46137015Sdes test X"$_XXX_TEST_A" = X"1" -a X"$_XXX_TEST_B" = X"2" 47137015SdesEOF 48137015Sdesr=$? 49137015Sdesif [ $r -ne 0 ]; then 50137015Sdes fail "environment not found" 51137015Sdesfi 52