summaryrefslogtreecommitdiff
path: root/regress/usr.bin
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@cvs.openbsd.org>2022-04-21 01:36:47 +0000
committerDarren Tucker <dtucker@cvs.openbsd.org>2022-04-21 01:36:47 +0000
commitdad7f02870d0a1d4628e7a8af7e84b257c18843e (patch)
tree8b483f0d3f2e2a566b8bf6657e2f3fc226a21112 /regress/usr.bin
parent4f0da5ee9b891bf703ad7b7ca65d3c075349485f (diff)
It looks like we can't completely avoid waiting for processes to
exit so retrieve the pid via controlmaster and use that.
Diffstat (limited to 'regress/usr.bin')
-rw-r--r--regress/usr.bin/ssh/forward-control.sh25
1 files changed, 18 insertions, 7 deletions
diff --git a/regress/usr.bin/ssh/forward-control.sh b/regress/usr.bin/ssh/forward-control.sh
index 24594cc154e..63bbdebe5cb 100644
--- a/regress/usr.bin/ssh/forward-control.sh
+++ b/regress/usr.bin/ssh/forward-control.sh
@@ -1,4 +1,4 @@
-# $OpenBSD: forward-control.sh,v 1.10 2022/04/20 13:25:55 dtucker Exp $
+# $OpenBSD: forward-control.sh,v 1.11 2022/04/21 01:36:46 dtucker Exp $
# Placed in the Public Domain.
tid="sshd control of local and remote forwarding"
@@ -20,6 +20,14 @@ wait_for_process_to_exit() {
return 0
}
+mux_cmd() {
+ ${SSH} -F $OBJ/ssh_proxy -S $CTL -O $1 host 2>&1
+}
+
+controlmaster_pid() {
+ mux_cmd check | cut -f2 -d= | cut -f1 -d')'
+}
+
# usage: check_lfwd Y|N message
check_lfwd() {
_expected=$1
@@ -29,12 +37,13 @@ check_lfwd() {
-o ExitOnForwardFailure=yes \
-MS $CTL -o ControlPersist=yes \
-f host true
- ${SSH} -F $OBJ/ssh_proxy -S $CTL -O check host >/dev/null 2>&1 || \
- fatal "check_lfwd ssh fail: $_message"
+ mux_cmd check >/dev/null || fatal "check_lfwd ssh fail: $_message"
${SSH} -F $OBJ/ssh_config -p $LFWD_PORT \
-oConnectionAttempts=10 host true >/dev/null 2>&1
_result=$?
- ${SSH} -F $OBJ/ssh_proxy -S $CTL -O exit host >/dev/null 2>&1
+ _sshpid=`controlmaster_pid`
+ mux_cmd exit >/dev/null
+ wait_for_process_to_exit $_sshpid
if test "x$_expected" = "xY" -a $_result -ne 0 ; then
fail "check_lfwd failed (expecting success): $_message"
elif test "x$_expected" = "xN" -a $_result -eq 0 ; then
@@ -55,13 +64,15 @@ check_rfwd() {
-o ExitOnForwardFailure=yes \
-MS $CTL -o ControlPersist=yes \
-f host true
- ${SSH} -F $OBJ/ssh_proxy -S $CTL -O check host >/dev/null 2>&1
+ mux_cmd check >/dev/null
_result=$?
- if ${SSH} -F $OBJ/ssh_proxy -S $CTL -O check host >/dev/null 2>&1; then
+ _sshpid=`controlmaster_pid`
+ if test $_result -eq 0; then
${SSH} -F $OBJ/ssh_config -p $RFWD_PORT \
-oConnectionAttempts=10 host true >/dev/null 2>&1
_result=$?
- ${SSH} -F $OBJ/ssh_proxy -S $CTL -O exit host >/dev/null 2>&1
+ mux_cmd exit >/dev/null
+ wait_for_process_to_exit $_sshpid
fi
if test "x$_expected" = "xY" -a $_result -ne 0 ; then
fail "check_rfwd failed (expecting success): $_message"