Instead of skipping the all-tokens test if we don't have OpenSSL (since
authordtucker <dtucker@openbsd.org>
Sat, 14 Jan 2023 09:57:08 +0000 (09:57 +0000)
committerdtucker <dtucker@openbsd.org>
Sat, 14 Jan 2023 09:57:08 +0000 (09:57 +0000)
we use it to compute the hash), put the hash at the end and just omit it
if we don't have it.  Prompted by bz#3521.

regress/usr.bin/ssh/percent.sh

index 3b87b90..e34aaf2 100644 (file)
@@ -1,4 +1,4 @@
-#      $OpenBSD: percent.sh,v 1.15 2023/01/06 12:33:33 dtucker Exp $
+#      $OpenBSD: percent.sh,v 1.16 2023/01/14 09:57:08 dtucker Exp $
 #      Placed in the Public Domain.
 
 tid="percent expansions"
@@ -7,6 +7,7 @@ USER=`id -u -n`
 USERID=`id -u`
 HOST=`hostname | cut -f1 -d.`
 HOSTNAME=`hostname`
+HASH=""
 
 # Localcommand is evaluated after connection because %T is not available
 # until then.  Because of this we use a different method of exercising it,
@@ -93,10 +94,13 @@ for i in matchexec localcommand remotecommand controlpath identityagent \
        # containing %d for UserKnownHostsFile
        if [ "$i" != "userknownhostsfile" ]; 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"
                if [ ! -z "${HASH}" ]; then
-                       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"
+                       in="$in/%C"
+                       out="$out/$HASH"
                fi
+               trial $i "$in" "$out"
        fi
 done