[openssh-commits] [openssh] 06/06: upstream: Test for %-token and env var expansion in SetEnv.

git+noreply at mindrot.org git+noreply at mindrot.org
Mon Mar 3 18:18:07 AEDT 2025


This is an automated email from the git hooks/post-receive script.

dtucker pushed a commit to branch master
in repository openssh.

commit 6575859d7acb110acf408707f98ed9744ca7d692
Author: dtucker at openbsd.org <dtucker at openbsd.org>
AuthorDate: Mon Mar 3 06:54:37 2025 +0000

    upstream: Test for %-token and env var expansion in SetEnv.
    
    OpenBSD-Regress-ID: bd6139a6177ac4afb29a0ce4afc23567b22ef9f9
---
 regress/percent.sh | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/regress/percent.sh b/regress/percent.sh
index 6ec117fd..91d0e315 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 at 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 at 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 at somehost | awk '$1=="'$opt'"{print $2}'`
+		got=`echo "$got" | sed 's/^TESTVAL=//'`
+		;;
 	*)
 		got=`${SSH} -F $OBJ/ssh_proxy -o $opt="$arg" -G \
 		    remuser at 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

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list