From: dtucker@openbsd.org Date: Mon, 3 Mar 2025 06:54:37 +0000 (+0000) Subject: upstream: Test for %-token and env var expansion in SetEnv. X-Git-Tag: V_10_0_P1~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6575859d7acb110acf408707f98ed9744ca7d692;p=thirdparty%2Fopenssh-portable.git upstream: Test for %-token and env var expansion in SetEnv. OpenBSD-Regress-ID: bd6139a6177ac4afb29a0ce4afc23567b22ef9f9 --- diff --git a/regress/percent.sh b/regress/percent.sh index 6ec117fd9..91d0e3157 100644 --- a/regress/percent.sh +++ b/regress/percent.sh @@ -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" @@ -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}'` @@ -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) @@ -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