From 2b02892339771fc2c02fdd15027af22b4aee06c8 Mon Sep 17 00:00:00 2001 From: dtucker Date: Fri, 6 Jan 2023 12:33:33 +0000 Subject: [PATCH] When OpenSSL is not available, skip parts of percent test that require it. Based on github pr#368 from ren mingshuai. --- regress/usr.bin/ssh/percent.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/regress/usr.bin/ssh/percent.sh b/regress/usr.bin/ssh/percent.sh index 6bc10243911..3b87b902492 100644 --- a/regress/usr.bin/ssh/percent.sh +++ b/regress/usr.bin/ssh/percent.sh @@ -1,4 +1,4 @@ -# $OpenBSD: percent.sh,v 1.14 2022/02/20 03:47:26 dtucker Exp $ +# $OpenBSD: percent.sh,v 1.15 2023/01/06 12:33:33 dtucker Exp $ # Placed in the Public Domain. tid="percent expansions" @@ -74,10 +74,12 @@ for i in matchexec localcommand remotecommand controlpath identityagent \ trial $i '%T' NONE fi # Matches implementation in readconf.c:ssh_connection_hash() - HASH=`printf "${HOSTNAME}127.0.0.1${PORT}$REMUSER" | - $OPENSSL_BIN sha1 | cut -f2 -d' '` + if [ ! -z "${OPENSSL_BIN}" ]; then + HASH=`printf "${HOSTNAME}127.0.0.1${PORT}$REMUSER" | + $OPENSSL_BIN sha1 | cut -f2 -d' '` + trial $i '%C' $HASH + fi trial $i '%%' '%' - trial $i '%C' $HASH trial $i '%i' $USERID trial $i '%h' 127.0.0.1 trial $i '%L' $HOST @@ -91,8 +93,10 @@ for i in matchexec localcommand remotecommand controlpath identityagent \ # containing %d for UserKnownHostsFile if [ "$i" != "userknownhostsfile" ]; then trial $i '%d' $HOME - 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" + 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" + fi fi done -- 2.20.1