summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@cvs.openbsd.org>2021-08-08 06:38:34 +0000
committerDarren Tucker <dtucker@cvs.openbsd.org>2021-08-08 06:38:34 +0000
commitded962c4d8403183d18a8532cc7c03b6063dc3ed (patch)
treece46f907399858386e50296ead691194f477537d /regress
parent5181742f7153e62bd1db5ba5f25472a5ae8fde3f (diff)
Drop -q in ssh-log-wrapper.sh to preserve logs.
scp and sftp like to add -q to the command line passed to ssh which overrides the LogLevel we set in the config files and suppresses output to the debug logs so drop any "-q" from the invoked ssh. In the one case where we actually want to use -q in the banner test, call the ssh binary directly bypassing the logging wrapper.
Diffstat (limited to 'regress')
-rw-r--r--regress/usr.bin/ssh/banner.sh6
-rw-r--r--regress/usr.bin/ssh/test-exec.sh13
2 files changed, 13 insertions, 6 deletions
diff --git a/regress/usr.bin/ssh/banner.sh b/regress/usr.bin/ssh/banner.sh
index 0d9654fe247..a84feb5ad7c 100644
--- a/regress/usr.bin/ssh/banner.sh
+++ b/regress/usr.bin/ssh/banner.sh
@@ -1,4 +1,4 @@
-# $OpenBSD: banner.sh,v 1.3 2017/04/30 23:34:55 djm Exp $
+# $OpenBSD: banner.sh,v 1.4 2021/08/08 06:38:33 dtucker Exp $
# Placed in the Public Domain.
tid="banner"
@@ -37,7 +37,9 @@ done
trace "test suppress banner (-q)"
verbose "test $tid: suppress banner (-q)"
-( ${SSH} -q -F $OBJ/ssh_proxy otherhost true 2>$OBJ/banner.out && \
+# ssh-log-wrapper drops "-q" to preserve debug output so use ssh directly
+# for just this test.
+( ${REAL_SSH} -q -F $OBJ/ssh_proxy otherhost true 2>$OBJ/banner.out && \
cmp $OBJ/empty.in $OBJ/banner.out ) || \
fail "suppress banner (-q)"
diff --git a/regress/usr.bin/ssh/test-exec.sh b/regress/usr.bin/ssh/test-exec.sh
index a2e38ee6d55..a0144bc0b06 100644
--- a/regress/usr.bin/ssh/test-exec.sh
+++ b/regress/usr.bin/ssh/test-exec.sh
@@ -1,4 +1,4 @@
-# $OpenBSD: test-exec.sh,v 1.83 2021/07/25 12:13:03 dtucker Exp $
+# $OpenBSD: test-exec.sh,v 1.84 2021/08/08 06:38:33 dtucker Exp $
# Placed in the Public Domain.
USER=`id -un`
@@ -139,10 +139,15 @@ fi
>$TEST_REGRESS_LOGFILE
# Create wrapper ssh with logging. We can't just specify "SSH=ssh -E..."
-# because sftp and scp don't handle spaces in arguments.
+# because sftp and scp don't handle spaces in arguments. scp and sftp like
+# to use -q so we remove those to preserve our debug logging. In the rare
+# instance where -q is desirable -qq is equivalent and is not removed.
SSHLOGWRAP=$OBJ/ssh-log-wrapper.sh
-echo "#!/bin/sh" > $SSHLOGWRAP
-echo "exec ${SSH} -E${TEST_SSH_LOGFILE} "'"$@"' >>$SSHLOGWRAP
+cat >$SSHLOGWRAP <<EOD
+#!/bin/sh
+for i; do shift; case "\$i" in -q) :;; *) set -- "\$@" "\$i";; esac; done
+exec ${SSH} -E${TEST_SSH_LOGFILE} "\$@"
+EOD
chmod a+rx $OBJ/ssh-log-wrapper.sh
REAL_SSH="$SSH"