[openssh-commits] [openssh] 05/06: upstream: Also test User expansions when supplied via -l option and

git+noreply at mindrot.org git+noreply at mindrot.org
Mon Mar 3 18:18:06 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 fd7ad8d7bf7dbdeb8f11a8b51aa9d31df1a17e52
Author: dtucker at openbsd.org <dtucker at openbsd.org>
AuthorDate: Sun Mar 2 07:41:06 2025 +0000

    upstream: Also test User expansions when supplied via -l option and
    
    user at host.
    
    OpenBSD-Regress-ID: 56415859260b53ef0dd20f71225ba5fdf6320f50
---
 regress/percent.sh | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/regress/percent.sh b/regress/percent.sh
index f3c82b2f..6ec117fd 100644
--- a/regress/percent.sh
+++ b/regress/percent.sh
@@ -1,4 +1,4 @@
-#	$OpenBSD: percent.sh,v 1.18 2025/03/01 06:12:47 dtucker Exp $
+#	$OpenBSD: percent.sh,v 1.19 2025/03/02 07:41:06 dtucker Exp $
 #	Placed in the Public Domain.
 
 tid="percent expansions"
@@ -29,13 +29,21 @@ trial()
 		    somehost true
 		got=`cat $OBJ/actual`
 		;;
-	user)
+	user|user-l|user-at)
 		if [ "$arg" = '%r' ] || [ "$arg" = '%C' ]; then
 			# User does not support %r, ie itself or %C.  Skip test.
 			got="$expect"
-		else
+		elif [ "$i" = "user" ]; then
 			got=`${SSH} -F $OBJ/ssh_proxy -o $opt="$arg" -G \
 			    remuser at somehost | awk '$1=="'$opt'"{print $2}'`
+		elif [ "$i" = "user-l" ]; then
+			# Also test ssh -l
+			got=`${SSH} -F $OBJ/ssh_proxy -l "$arg" -G \
+			    somehost | awk '$1=="'user'"{print $2}'`
+		elif [ "$i" = "user-at" ]; then
+			# Also test user at host
+			got=`${SSH} -F $OBJ/ssh_proxy -G "$arg at somehost" | \
+			    awk '$1=="'user'"{print $2}'`
 		fi
 		;;
 	userknownhostsfile)
@@ -71,7 +79,7 @@ trial()
 
 for i in matchexec localcommand remotecommand controlpath identityagent \
     forwardagent localforward remoteforward revokedhostkeys \
-    user userknownhostsfile; do
+    user user-l user-at userknownhostsfile; do
 	verbose $tid $i percent
 	case "$i" in
 	localcommand|userknownhostsfile)
@@ -102,7 +110,8 @@ for i in matchexec localcommand remotecommand controlpath identityagent \
 	trial $i '%u' $USER
 	# We can't specify a full path outside the regress dir, so skip tests
 	# containing %d for UserKnownHostsFile, and %r can't refer to itself.
-	if [ "$i" != "userknownhostsfile" ] && [ "$i" != "user" ]; then
+	if [ "$i" != "userknownhostsfile" ] && [ "$i" != "user" ] && \
+	     [ "$i" != "user-l" ] && [ "$i" != "user-at" ]; then
 		trial $i '%d' $HOME
 		in='%%/%i/%h/%d/%L/%l/%n/%p/%r/%u'
 		out="%/$USERID/127.0.0.1/$HOME/$HOST/$HOSTNAME/somehost/$PORT/$REMUSER/$USER"
@@ -117,7 +126,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 userknownhostsfile; do
+    user user-l user-at 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