1- # $OpenBSD: percent.sh,v 1.19 2025/03/02 07:41:06 dtucker Exp $
1+ # $OpenBSD: percent.sh,v 1.20 2025/03/03 06:54:37 dtucker Exp $
22# Placed in the Public Domain.
33
44tid=" percent expansions"
@@ -68,6 +68,18 @@ trial()
6868 remuser@somehost | awk ' $1=="' $opt ' "{print $2" "$3}' `
6969 expect=" /$expect /$expect "
7070 ;;
71+ setenv)
72+ # First make sure we don't expand variable names.
73+ got=` ${SSH} -F $OBJ /ssh_proxy -o $opt =" $arg =TESTVAL" -G \
74+ remuser@somehost | awk ' $1=="' $opt ' "{print $2}' `
75+ if [ " $got " != " $arg =TESTVAL" ]; then
76+ fatal " incorrectly expanded setenv variable name"
77+ fi
78+ # Now check that the the value expands as expected.
79+ got=` ${SSH} -F $OBJ /ssh_proxy -o $opt =TESTVAL=" $arg " -G \
80+ remuser@somehost | awk ' $1=="' $opt ' "{print $2}' `
81+ got=` echo " $got " | sed ' s/^TESTVAL=//' `
82+ ;;
7183 * )
7284 got=` ${SSH} -F $OBJ /ssh_proxy -o $opt =" $arg " -G \
7385 remuser@somehost | awk ' $1=="' $opt ' "{print $2}' `
@@ -79,7 +91,7 @@ trial()
7991
8092for i in matchexec localcommand remotecommand controlpath identityagent \
8193 forwardagent localforward remoteforward revokedhostkeys \
82- user user-l user-at userknownhostsfile; do
94+ user user-l user-at setenv userknownhostsfile; do
8395 verbose $tid $i percent
8496 case " $i " in
8597 localcommand|userknownhostsfile)
126138# Subset of above since we don't expand shell-style variables on anything that
127139# runs a command because the shell will expand those.
128140for i in controlpath identityagent forwardagent localforward remoteforward \
129- user user-l user-at userknownhostsfile; do
141+ user user-l user-at setenv userknownhostsfile; do
130142 verbose $tid $i dollar
131143 FOO=bar
132144 export FOO
0 commit comments