envpass.sh revision 146998
1146998Sdes# $OpenBSD: envpass.sh,v 1.4 2005/03/04 08:48:46 djm 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 8146998Sdes# Prepare a custom config to test for a configuration parsing bug fixed in 4.0 9146998Sdescat << EOF > $OBJ/ssh_proxy_envpass 10146998SdesHost test-sendenv-confparse-bug 11146998Sdes SendEnv * 12146998SdesEOF 13146998Sdescat $OBJ/ssh_proxy >> $OBJ/ssh_proxy_envpass 14146998Sdes 15137015Sdestrace "pass env, don't accept" 16137015Sdesverbose "test $tid: pass env, don't accept" 17146998Sdes_TEST_ENV=blah ${SSH} -oSendEnv="*" -F $OBJ/ssh_proxy_envpass otherhost \ 18137015Sdes sh << 'EOF' 19137015Sdes test -z "$_TEST_ENV" 20137015SdesEOF 21137015Sdesr=$? 22137015Sdesif [ $r -ne 0 ]; then 23137015Sdes fail "environment found" 24137015Sdesfi 25137015Sdes 26137015Sdestrace "don't pass env, accept" 27137015Sdesverbose "test $tid: don't pass env, accept" 28146998Sdes_XXX_TEST_A=1 _XXX_TEST_B=2 ${SSH} -F $OBJ/ssh_proxy_envpass otherhost \ 29137015Sdes sh << 'EOF' 30137015Sdes test -z "$_XXX_TEST_A" && test -z "$_XXX_TEST_B" 31137015SdesEOF 32137015Sdesr=$? 33137015Sdesif [ $r -ne 0 ]; then 34137015Sdes fail "environment found" 35137015Sdesfi 36137015Sdes 37137015Sdestrace "pass single env, accept single env" 38137015Sdesverbose "test $tid: pass single env, accept single env" 39146998Sdes_XXX_TEST=blah ${SSH} -oSendEnv="_XXX_TEST" -F $OBJ/ssh_proxy_envpass \ 40146998Sdes otherhost sh << 'EOF' 41137015Sdes test X"$_XXX_TEST" = X"blah" 42137015SdesEOF 43137015Sdesr=$? 44137015Sdesif [ $r -ne 0 ]; then 45137015Sdes fail "environment not found" 46137015Sdesfi 47137015Sdes 48137015Sdestrace "pass multiple env, accept multiple env" 49137015Sdesverbose "test $tid: pass multiple env, accept multiple env" 50137015Sdes_XXX_TEST_A=1 _XXX_TEST_B=2 ${SSH} -oSendEnv="_XXX_TEST_*" \ 51146998Sdes -F $OBJ/ssh_proxy_envpass otherhost \ 52137015Sdes sh << 'EOF' 53137015Sdes test X"$_XXX_TEST_A" = X"1" -a X"$_XXX_TEST_B" = X"2" 54137015SdesEOF 55137015Sdesr=$? 56137015Sdesif [ $r -ne 0 ]; then 57137015Sdes fail "environment not found" 58137015Sdesfi 59146998Sdes 60146998Sdesrm -f $OBJ/ssh_proxy_envpass 61