-# $OpenBSD: percent.sh,v 1.19 2025/03/02 07:41:06 dtucker Exp $
+# $OpenBSD: percent.sh,v 1.20 2025/03/03 06:54:37 dtucker Exp $
# Placed in the Public Domain.
tid="percent expansions"
remuser@somehost | awk '$1=="'$opt'"{print $2" "$3}'`
expect="/$expect /$expect"
;;
+ setenv)
+ # First make sure we don't expand variable names.
+ got=`${SSH} -F $OBJ/ssh_proxy -o $opt="$arg=TESTVAL" -G \
+ remuser@somehost | awk '$1=="'$opt'"{print $2}'`
+ if [ "$got" != "$arg=TESTVAL" ]; then
+ fatal "incorrectly expanded setenv variable name"
+ fi
+ # Now check that the the value expands as expected.
+ got=`${SSH} -F $OBJ/ssh_proxy -o $opt=TESTVAL="$arg" -G \
+ remuser@somehost | awk '$1=="'$opt'"{print $2}'`
+ got=`echo "$got" | sed 's/^TESTVAL=//'`
+ ;;
*)
got=`${SSH} -F $OBJ/ssh_proxy -o $opt="$arg" -G \
remuser@somehost | awk '$1=="'$opt'"{print $2}'`
for i in matchexec localcommand remotecommand controlpath identityagent \
forwardagent localforward remoteforward revokedhostkeys \
- user user-l user-at userknownhostsfile; do
+ user user-l user-at setenv userknownhostsfile; do
verbose $tid $i percent
case "$i" in
localcommand|userknownhostsfile)
# Subset of above since we don't expand shell-style variables on anything that
# runs a command because the shell will expand those.
for i in controlpath identityagent forwardagent localforward remoteforward \
- user user-l user-at userknownhostsfile; do
+ user user-l user-at setenv userknownhostsfile; do
verbose $tid $i dollar
FOO=bar
export FOO