[openssh-commits] [openssh] 05/05: upstream: Add regression test for percent expansions where possible.

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Apr 3 13:43:21 AEDT 2020


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

djm pushed a commit to branch master
in repository openssh.

commit d5318a784d016478fc8da90a38d9062c51c10432
Author: dtucker at openbsd.org <dtucker at openbsd.org>
Date:   Fri Apr 3 02:33:31 2020 +0000

    upstream: Add regression test for percent expansions where possible.
    
    OpenBSD-Regress-ID: 7283be8b2733ac1cbefea3048a23d02594485288
---
 regress/percent.sh | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)

diff --git a/regress/percent.sh b/regress/percent.sh
new file mode 100644
index 00000000..84999fd0
--- /dev/null
+++ b/regress/percent.sh
@@ -0,0 +1,65 @@
+#	$OpenBSD: percent.sh,v 1.1 2020/04/03 02:33:31 dtucker Exp $
+#	Placed in the Public Domain.
+
+tid="percent expansions"
+
+USER=`id -u -n`
+USERID=`id -u`
+HOST=`hostname -s`
+HOSTNAME=`hostname`
+
+# Localcommand is evaluated after connection because %T is not available
+# until then.  Because of this we use a different method of exercising it,
+# and we can't override the remote user otherwise authentication will fail.
+# We also have to explicitly enable it.
+echo "permitlocalcommand yes" >> $OBJ/ssh_proxy
+
+trial()
+{
+	opt="$1"; arg="$2"; expect="$3"
+
+	trace "test $opt=$arg $expect"
+	if [ "$opt" = "localcommand" ]; then
+		${SSH} -F $OBJ/ssh_proxy -o $opt="echo '$arg' >$OBJ/actual" \
+		    somehost true
+		got=`cat $OBJ/actual`
+	else
+		got=`${SSH} -F $OBJ/ssh_proxy -o $opt="$arg" -G \
+		    remuser at somehost | awk '$1=="'$opt'"{print $2}'`
+	fi
+	if [ "$got" != "$expect" ]; then
+		fail "$opt=$arg expect $expect got $got"
+	else
+		trace "$opt=$arg expect $expect got $got"
+	fi
+}
+
+for i in localcommand remotecommand controlpath identityagent forwardagent; do
+	if [ "$i" = "localcommand" ]; then
+		HASH=94237ca18fe6b187dccf57e5593c0bb0a29cc302
+		REMUSER=$USER
+		trial $i '%T' NONE
+	else
+		HASH=dbc43d45c7f8c0ecd0a65c0da484c03b6903622e
+		REMUSER=remuser
+	fi
+	trial $i '%%' '%'
+	trial $i '%C' $HASH
+	trial $i '%i' $USERID
+	trial $i '%h' 127.0.0.1
+	trial $i '%d' $HOME
+	trial $i '%L' $HOST
+	trial $i '%l' $HOSTNAME
+	trial $i '%n' somehost
+	trial $i '%p' $PORT
+	trial $i '%r' $REMUSER
+	trial $i '%u' $USER
+	trial $i '%%/%C/%i/%h/%d/%L/%l/%n/%p/%r/%u' \
+	    "%/$HASH/$USERID/127.0.0.1/$HOME/$HOST/$HOSTNAME/somehost/$PORT/$REMUSER/$USER"
+done
+
+# A subset of options support tilde expansion
+for i in controlpath identityagent forwardagent; do
+	trial $i '~' $HOME/
+	trial $i '~/.ssh' $HOME/.ssh
+done

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


More information about the openssh-commits mailing list