File openssh-test-updates.patch of Package openssh.29886

From 67932e5399fba4057c8145708fce631aa24a2582 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Fri, 11 Nov 2022 08:14:19 +0100
Subject: [PATCH] test updates

Patch-mainline: V_8_0_P1
Git-commit: ffdde469ed56249f5dc8af98da468dde35531398
OpenBSD-Regress-ID: 0998702c41235782cf0beee396ec49b5056eaed9
upstream: Count the number of key types instead of assuming there
are only two.

Patch-mainline: V_8_0_P1
Git-commit: 2a9b3a2ce411d16cda9c79ab713c55f65b0ec257
OpenBSD-Regress-ID: 72f72ff49946c61bc949e1692dd9e3d71370891b
upstream: Generate all key supported key types and enable for keyscan
test.

Changes in v 7.2
 - fix up for gssapi and ssh v1

Patch-mainline: V_8_1_P1
Git-commit: de08335a4cfaa9b7081e94ea4a8b7153c230546d
OpenBSD-Regress-ID: 384c7d209d2443d25ea941d7f677e932621fb253

upstream: Add a sleep to allow forwards to come up.

Currently when the multiplex client requests a forward it returns
once the request has been sent but not necessarily when the forward
is up.  This causes intermittent text failures due to this race,
so add some sleeps to mitigate this until we can fix it properly.
---
 regress/agent-timeout.sh |  6 ++++--
 regress/keyscan.sh       | 14 +++++++++++---
 regress/multiplex.sh     |  6 ++++++
 regress/test-exec.sh     |  8 ++++----
 4 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/regress/agent-timeout.sh b/regress/agent-timeout.sh
index 9598c203..53e5f6f1 100644
--- a/regress/agent-timeout.sh
+++ b/regress/agent-timeout.sh
@@ -12,16 +12,18 @@ if [ $r -ne 0 ]; then
 	fail "could not start ssh-agent: exit code $r"
 else
 	trace "add keys with timeout"
+	keys=0
 	for t in ${SSH_KEYTYPES}; do
 		${SSHADD} -t ${SSHAGENT_TIMEOUT} $OBJ/$t > /dev/null 2>&1
 		if [ $? -ne 0 ]; then
 			fail "ssh-add did succeed exit code 0"
 		fi
+		keys=$((${keys} + 1))
 	done
 	n=`${SSHADD} -l 2> /dev/null | wc -l`
 	trace "agent has $n keys"
-	if [ $n -ne 2 ]; then
-		fail "ssh-add -l did not return 2 keys: $n"
+	if [ $n -ne $keys ]; then
+		fail "ssh-add -l did not return $keys keys: $n"
 	fi
 	trace "sleeping 2*${SSHAGENT_TIMEOUT} seconds"
 	sleep ${SSHAGENT_TIMEOUT}
diff --git a/regress/keyscan.sh b/regress/keyscan.sh
index f97364b7..42c21eac 100644
--- a/regress/keyscan.sh
+++ b/regress/keyscan.sh
@@ -3,12 +3,20 @@
 
 tid="keyscan"
 
-# remove DSA hostkey
-rm -f ${OBJ}/host.dsa
+KEYTYPES=`${SSH} -Q key-plain | sed -e '/^null$/d'`
+for i in $KEYTYPES; do
+	if [ -z "$algs" ]; then
+		algs="$i"
+	else
+		algs="$algs,$i"
+	fi
+done
+echo "HostKeyAlgorithms $algs" >> sshd_config
+
+cat sshd_config
 
 start_sshd
 
-KEYTYPES=`${SSH} -Q key-plain`
 if ssh_version 1; then
 	KEYTYPES="${KEYTYPES} rsa1"
 fi
diff --git a/regress/multiplex.sh b/regress/multiplex.sh
index acb9234d..12bfc76c 100644
--- a/regress/multiplex.sh
+++ b/regress/multiplex.sh
@@ -80,6 +80,7 @@ trace "forward over TCP/IP and check result"
 $NC -N -l 127.0.0.1 $((${PORT} + 1)) < ${DATA} > /dev/null &
 netcat_pid=$!
 ${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -L127.0.0.1:$((${PORT} + 2)):127.0.0.1:$((${PORT} + 1)) otherhost >>$TEST_SSH_LOGFILE 2>&1
+sleep 1  # XXX remove once race fixed
 $NC 127.0.0.1 $((${PORT} + 2)) < /dev/null > ${COPY}
 cmp ${DATA} ${COPY}		|| fail "ssh: corrupted copy of ${DATA}"
 kill $netcat_pid 2>/dev/null
@@ -90,6 +91,7 @@ $NC -N -Ul $OBJ/unix-1.fwd < ${DATA} > /dev/null &
 netcat_pid=$!
 ${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -L$OBJ/unix-2.fwd:$OBJ/unix-1.fwd otherhost >>$TEST_SSH_LOGFILE 2>&1
 ${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -R$OBJ/unix-3.fwd:$OBJ/unix-2.fwd otherhost >>$TEST_SSH_LOGFILE 2>&1
+sleep 1  # XXX remove once race fixed
 $NC -U $OBJ/unix-3.fwd < /dev/null > ${COPY} 2>/dev/null
 cmp ${DATA} ${COPY}		|| fail "ssh: corrupted copy of ${DATA}"
 kill $netcat_pid 2>/dev/null
@@ -121,6 +123,7 @@ ${SSH} -F $OBJ/ssh_config -S $CTL -Ocheck otherhost >>$TEST_REGRESS_LOGFILE 2>&1
 verbose "test $tid: cmd forward local (TCP)"
 ${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -L $P:localhost:$PORT otherhost \
      || fail "request local forward failed"
+sleep 1  # XXX remove once race fixed
 ${SSH} -F $OBJ/ssh_config -p$P otherhost true \
      || fail "connect to local forward port failed"
 ${SSH} -F $OBJ/ssh_config -S $CTL -Ocancel -L $P:localhost:$PORT otherhost \
@@ -131,6 +134,7 @@ ${SSH} -F $OBJ/ssh_config -p$P otherhost true \
 verbose "test $tid: cmd forward remote (TCP)"
 ${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -R $P:localhost:$PORT otherhost \
      || fail "request remote forward failed"
+sleep 1  # XXX remove once race fixed
 ${SSH} -F $OBJ/ssh_config -p$P otherhost true \
      || fail "connect to remote forwarded port failed"
 ${SSH} -F $OBJ/ssh_config -S $CTL -Ocancel -R $P:localhost:$PORT otherhost \
@@ -141,6 +145,7 @@ ${SSH} -F $OBJ/ssh_config -p$P otherhost true \
 verbose "test $tid: cmd forward local (UNIX)"
 ${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -L $OBJ/unix-1.fwd:localhost:$PORT otherhost \
      || fail "request local forward failed"
+sleep 1  # XXX remove once race fixed
 echo "" | $NC -U $OBJ/unix-1.fwd | grep "Protocol mismatch" >/dev/null 2>&1 \
      || fail "connect to local forward path failed"
 ${SSH} -F $OBJ/ssh_config -S $CTL -Ocancel -L $OBJ/unix-1.fwd:localhost:$PORT otherhost \
@@ -152,6 +157,7 @@ rm -f $OBJ/unix-1.fwd
 verbose "test $tid: cmd forward remote (UNIX)"
 ${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -R $OBJ/unix-1.fwd:localhost:$PORT otherhost \
      || fail "request remote forward failed"
+sleep 1  # XXX remove once race fixed
 echo "" | $NC -U $OBJ/unix-1.fwd | grep "Protocol mismatch" >/dev/null 2>&1 \
      || fail "connect to remote forwarded path failed"
 ${SSH} -F $OBJ/ssh_config -S $CTL -Ocancel -R $OBJ/unix-1.fwd:localhost:$PORT otherhost \
diff --git a/regress/test-exec.sh b/regress/test-exec.sh
index 114e129f..c981920e 100644
--- a/regress/test-exec.sh
+++ b/regress/test-exec.sh
@@ -450,14 +450,14 @@ fi
 
 rm -f $OBJ/known_hosts $OBJ/authorized_keys_$USER
 
+SSH_KEYTYPES=`$SSH -Q key-plain | sed -e '/^null$/d'`
 if ssh_version 1; then
-	SSH_KEYTYPES="rsa rsa1"
-else
-	SSH_KEYTYPES="rsa ed25519"
+	SSH_KEYTYPES="$SSH_KEYTYPES rsa1"
 fi
-trace "generate keys"
+
 for t in ${SSH_KEYTYPES}; do
 	# generate user key
+	trace "generating key type $t"
 	if [ ! -f $OBJ/$t ] || [ ${SSHKEYGEN_BIN} -nt $OBJ/$t ]; then
 		rm -f $OBJ/$t
 		${SSHKEYGEN} -q -N '' -t $t  -f $OBJ/$t ||\
-- 
2.38.0

openSUSE Build Service is sponsored by