Skip to content

Commit

Permalink
upstream: Test for %-token and env var expansion in SetEnv.
Browse files Browse the repository at this point in the history
OpenBSD-Regress-ID: bd6139a6177ac4afb29a0ce4afc23567b22ef9f9
  • Loading branch information
daztucker committed Mar 3, 2025
1 parent fd7ad8d commit 6575859
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions regress/percent.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $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"
Expand Down Expand Up @@ -68,6 +68,18 @@ trial()
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}'`
Expand All @@ -79,7 +91,7 @@ trial()

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)
Expand Down Expand Up @@ -126,7 +138,7 @@ done
# 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
Expand Down

0 comments on commit 6575859

Please # to comment.