2024-10-22 15:13:28 +08:00
|
|
|
# $OpenBSD: test-exec.sh,v 1.121 2024/10/22 07:13:28 dtucker Exp $
|
2002-05-01 11:17:33 +08:00
|
|
|
# Placed in the Public Domain.
|
|
|
|
|
|
|
|
#SUDO=sudo
|
|
|
|
|
2022-07-25 15:12:45 +08:00
|
|
|
if [ ! -z "$TEST_SSH_ELAPSED_TIMES" ]; then
|
2021-04-07 07:57:56 +08:00
|
|
|
STARTTIME=`date '+%s'`
|
|
|
|
fi
|
|
|
|
|
2021-04-07 07:59:15 +08:00
|
|
|
if [ ! -z "$TEST_SSH_PORT" ]; then
|
|
|
|
PORT="$TEST_SSH_PORT"
|
|
|
|
else
|
|
|
|
PORT=4242
|
|
|
|
fi
|
|
|
|
|
2002-05-01 11:17:33 +08:00
|
|
|
OBJ=$1
|
|
|
|
if [ "x$OBJ" = "x" ]; then
|
|
|
|
echo '$OBJ not defined'
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
if [ ! -d $OBJ ]; then
|
|
|
|
echo "not a directory: $OBJ"
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
SCRIPT=$2
|
|
|
|
if [ "x$SCRIPT" = "x" ]; then
|
|
|
|
echo '$SCRIPT not defined'
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
if [ ! -f $SCRIPT ]; then
|
|
|
|
echo "not a file: $SCRIPT"
|
|
|
|
exit 2
|
|
|
|
fi
|
2004-02-12 23:17:10 +08:00
|
|
|
if $TEST_SHELL -n $SCRIPT; then
|
2002-05-01 11:17:33 +08:00
|
|
|
true
|
|
|
|
else
|
|
|
|
echo "syntax error in $SCRIPT"
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
unset SSH_AUTH_SOCK
|
|
|
|
|
2021-08-08 15:39:56 +08:00
|
|
|
# Portable-specific settings.
|
|
|
|
|
2021-08-08 15:27:52 +08:00
|
|
|
if [ -x /usr/ucb/whoami ]; then
|
|
|
|
USER=`/usr/ucb/whoami`
|
|
|
|
elif whoami >/dev/null 2>&1; then
|
|
|
|
USER=`whoami`
|
|
|
|
elif logname >/dev/null 2>&1; then
|
|
|
|
USER=`logname`
|
|
|
|
else
|
|
|
|
USER=`id -un`
|
|
|
|
fi
|
|
|
|
if test -z "$LOGNAME"; then
|
|
|
|
LOGNAME="${USER}"
|
|
|
|
export LOGNAME
|
|
|
|
fi
|
|
|
|
|
2021-08-08 15:39:56 +08:00
|
|
|
# Unbreak GNU head(1)
|
|
|
|
_POSIX2_VERSION=199209
|
|
|
|
export _POSIX2_VERSION
|
|
|
|
|
|
|
|
case `uname -s 2>/dev/null` in
|
|
|
|
OSF1*)
|
|
|
|
BIN_SH=xpg4
|
|
|
|
export BIN_SH
|
|
|
|
;;
|
|
|
|
CYGWIN*)
|
|
|
|
os=cygwin
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# If configure tells us to use a different egrep, create a wrapper function
|
|
|
|
# to call it. This means we don't need to change all the tests that depend
|
|
|
|
# on a good implementation.
|
|
|
|
if test "x${EGREP}" != "x"; then
|
|
|
|
egrep ()
|
|
|
|
{
|
|
|
|
${EGREP} "$@"
|
|
|
|
}
|
|
|
|
fi
|
|
|
|
|
2005-03-07 15:33:02 +08:00
|
|
|
SRC=`dirname ${SCRIPT}`
|
|
|
|
|
2002-05-01 11:17:33 +08:00
|
|
|
# defaults
|
|
|
|
SSH=ssh
|
|
|
|
SSHD=sshd
|
|
|
|
SSHAGENT=ssh-agent
|
|
|
|
SSHADD=ssh-add
|
|
|
|
SSHKEYGEN=ssh-keygen
|
|
|
|
SSHKEYSCAN=ssh-keyscan
|
|
|
|
SFTP=sftp
|
|
|
|
SFTPSERVER=/usr/libexec/openssh/sftp-server
|
2024-05-17 09:45:22 +08:00
|
|
|
SSHD_SESSION=/usr/libexec/sshd-session
|
2024-10-14 11:02:08 +08:00
|
|
|
SSHD_AUTH=/usr/libexec/sshd-auth
|
2004-06-16 18:15:59 +08:00
|
|
|
SCP=scp
|
2002-05-01 11:17:33 +08:00
|
|
|
|
2018-07-20 12:53:42 +08:00
|
|
|
# Set by make_tmpdir() on demand (below).
|
|
|
|
SSH_REGRESS_TMP=
|
|
|
|
|
2008-03-12 21:17:00 +08:00
|
|
|
# Interop testing
|
2023-10-20 17:39:03 +08:00
|
|
|
PLINK=/usr/local/bin/plink
|
|
|
|
PUTTYGEN=/usr/local/bin/puttygen
|
|
|
|
CONCH=/usr/local/bin/conch
|
|
|
|
DROPBEAR=/usr/local/bin/dropbear
|
|
|
|
DBCLIENT=/usr/local/bin/dbclient
|
|
|
|
DROPBEARKEY=/usr/local/bin/dropbearkey
|
|
|
|
DROPBEARCONVERT=/usr/local/bin/dropbearconvert
|
2008-03-12 21:17:00 +08:00
|
|
|
|
2024-03-08 19:34:10 +08:00
|
|
|
# So we can override this in Portable.
|
|
|
|
TEST_SHELL="${TEST_SHELL:-/bin/sh}"
|
|
|
|
|
2020-01-25 10:57:53 +08:00
|
|
|
# Tools used by multiple tests
|
|
|
|
NC=$OBJ/netcat
|
2023-02-20 15:24:39 +08:00
|
|
|
# Always use the one configure tells us to, even if that's empty.
|
|
|
|
#OPENSSL_BIN="${OPENSSL_BIN:-openssl}"
|
2020-01-25 10:57:53 +08:00
|
|
|
|
2002-05-01 11:17:33 +08:00
|
|
|
if [ "x$TEST_SSH_SSH" != "x" ]; then
|
2004-02-29 17:31:08 +08:00
|
|
|
SSH="${TEST_SSH_SSH}"
|
2002-05-01 11:17:33 +08:00
|
|
|
fi
|
2024-05-17 09:45:22 +08:00
|
|
|
if [ "x$TEST_SSH_SSHD_SESSION" != "x" ]; then
|
|
|
|
SSHD_SESSION="${TEST_SSH_SSHD_SESSION}"
|
|
|
|
fi
|
2024-10-14 11:02:08 +08:00
|
|
|
if [ "x$TEST_SSH_SSHD_AUTH" != "x" ]; then
|
|
|
|
SSHD_AUTH="${TEST_SSH_SSHD_AUTH}"
|
|
|
|
fi
|
2002-05-01 11:17:33 +08:00
|
|
|
if [ "x$TEST_SSH_SSHD" != "x" ]; then
|
2004-02-29 17:31:08 +08:00
|
|
|
SSHD="${TEST_SSH_SSHD}"
|
2002-05-01 11:17:33 +08:00
|
|
|
fi
|
|
|
|
if [ "x$TEST_SSH_SSHAGENT" != "x" ]; then
|
2004-02-29 17:31:08 +08:00
|
|
|
SSHAGENT="${TEST_SSH_SSHAGENT}"
|
2002-05-01 11:17:33 +08:00
|
|
|
fi
|
|
|
|
if [ "x$TEST_SSH_SSHADD" != "x" ]; then
|
2004-02-29 17:31:08 +08:00
|
|
|
SSHADD="${TEST_SSH_SSHADD}"
|
2002-05-01 11:17:33 +08:00
|
|
|
fi
|
|
|
|
if [ "x$TEST_SSH_SSHKEYGEN" != "x" ]; then
|
2004-02-29 17:31:08 +08:00
|
|
|
SSHKEYGEN="${TEST_SSH_SSHKEYGEN}"
|
2002-05-01 11:17:33 +08:00
|
|
|
fi
|
|
|
|
if [ "x$TEST_SSH_SSHKEYSCAN" != "x" ]; then
|
2004-02-29 17:31:08 +08:00
|
|
|
SSHKEYSCAN="${TEST_SSH_SSHKEYSCAN}"
|
2002-05-01 11:17:33 +08:00
|
|
|
fi
|
|
|
|
if [ "x$TEST_SSH_SFTP" != "x" ]; then
|
2004-02-29 17:31:08 +08:00
|
|
|
SFTP="${TEST_SSH_SFTP}"
|
2002-05-01 11:17:33 +08:00
|
|
|
fi
|
|
|
|
if [ "x$TEST_SSH_SFTPSERVER" != "x" ]; then
|
2004-02-29 17:31:08 +08:00
|
|
|
SFTPSERVER="${TEST_SSH_SFTPSERVER}"
|
2002-05-01 11:17:33 +08:00
|
|
|
fi
|
2004-06-16 18:15:59 +08:00
|
|
|
if [ "x$TEST_SSH_SCP" != "x" ]; then
|
|
|
|
SCP="${TEST_SSH_SCP}"
|
|
|
|
fi
|
2008-03-12 21:17:00 +08:00
|
|
|
if [ "x$TEST_SSH_PLINK" != "x" ]; then
|
2023-10-20 17:39:03 +08:00
|
|
|
PLINK="${TEST_SSH_PLINK}"
|
2008-03-12 21:17:00 +08:00
|
|
|
fi
|
|
|
|
if [ "x$TEST_SSH_PUTTYGEN" != "x" ]; then
|
2023-10-20 17:39:03 +08:00
|
|
|
PUTTYGEN="${TEST_SSH_PUTTYGEN}"
|
2008-03-12 21:17:00 +08:00
|
|
|
fi
|
2008-06-30 06:07:56 +08:00
|
|
|
if [ "x$TEST_SSH_CONCH" != "x" ]; then
|
2023-10-20 17:39:03 +08:00
|
|
|
CONCH="${TEST_SSH_CONCH}"
|
2008-06-30 06:07:56 +08:00
|
|
|
fi
|
2023-10-20 15:37:07 +08:00
|
|
|
if [ "x$TEST_SSH_DROPBEAR" != "x" ]; then
|
|
|
|
DROPBEAR="${TEST_SSH_DROPBEAR}"
|
|
|
|
fi
|
|
|
|
if [ "x$TEST_SSH_DBCLIENT" != "x" ]; then
|
|
|
|
DBCLIENT="${TEST_SSH_DBCLIENT}"
|
|
|
|
fi
|
|
|
|
if [ "x$TEST_SSH_DROPBEARKEY" != "x" ]; then
|
|
|
|
DROPBEARKEY="${TEST_SSH_DROPBEARKEY}"
|
|
|
|
fi
|
|
|
|
if [ "x$TEST_SSH_DROPBEARCONVERT" != "x" ]; then
|
|
|
|
DROPBEARCONVERT="${TEST_SSH_DROPBEARCONVERT}"
|
|
|
|
fi
|
2019-11-27 07:43:10 +08:00
|
|
|
if [ "x$TEST_SSH_PKCS11_HELPER" != "x" ]; then
|
|
|
|
SSH_PKCS11_HELPER="${TEST_SSH_PKCS11_HELPER}"
|
|
|
|
fi
|
|
|
|
if [ "x$TEST_SSH_SK_HELPER" != "x" ]; then
|
|
|
|
SSH_SK_HELPER="${TEST_SSH_SK_HELPER}"
|
|
|
|
fi
|
2021-05-24 18:25:18 +08:00
|
|
|
if [ "x$TEST_SSH_OPENSSL" != "x" ]; then
|
2021-07-25 20:13:03 +08:00
|
|
|
OPENSSL_BIN="${TEST_SSH_OPENSSL}"
|
2021-05-24 18:25:18 +08:00
|
|
|
fi
|
2002-05-01 11:17:33 +08:00
|
|
|
|
2004-06-25 11:45:18 +08:00
|
|
|
# Path to sshd must be absolute for rexec
|
2005-08-23 21:32:05 +08:00
|
|
|
case "$SSHD" in
|
|
|
|
/*) ;;
|
2013-11-09 13:55:03 +08:00
|
|
|
*) SSHD=`which $SSHD` ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case "$SSHAGENT" in
|
|
|
|
/*) ;;
|
|
|
|
*) SSHAGENT=`which $SSHAGENT` ;;
|
2005-08-23 21:32:05 +08:00
|
|
|
esac
|
2004-06-25 11:45:18 +08:00
|
|
|
|
2015-02-26 08:58:22 +08:00
|
|
|
# Record the actual binaries used.
|
|
|
|
SSH_BIN=${SSH}
|
|
|
|
SSHD_BIN=${SSHD}
|
|
|
|
SSHAGENT_BIN=${SSHAGENT}
|
|
|
|
SSHADD_BIN=${SSHADD}
|
|
|
|
SSHKEYGEN_BIN=${SSHKEYGEN}
|
|
|
|
SSHKEYSCAN_BIN=${SSHKEYSCAN}
|
|
|
|
SFTP_BIN=${SFTP}
|
|
|
|
SFTPSERVER_BIN=${SFTPSERVER}
|
|
|
|
SCP_BIN=${SCP}
|
|
|
|
|
|
|
|
if [ "x$USE_VALGRIND" != "x" ]; then
|
2019-07-17 19:24:55 +08:00
|
|
|
rm -rf $OBJ/valgrind-out $OBJ/valgrind-vgdb
|
|
|
|
mkdir -p $OBJ/valgrind-out $OBJ/valgrind-vgdb
|
2019-07-18 08:17:54 +08:00
|
|
|
# When using sudo ensure low-priv tests can write pipes and logs.
|
|
|
|
if [ "x$SUDO" != "x" ]; then
|
|
|
|
chmod 777 $OBJ/valgrind-out $OBJ/valgrind-vgdb
|
|
|
|
fi
|
2015-02-26 08:58:22 +08:00
|
|
|
VG_TEST=`basename $SCRIPT .sh`
|
|
|
|
|
|
|
|
# Some tests are difficult to fix.
|
|
|
|
case "$VG_TEST" in
|
2019-07-19 08:41:56 +08:00
|
|
|
reexec)
|
2015-02-26 08:58:22 +08:00
|
|
|
VG_SKIP=1 ;;
|
2019-07-19 16:51:18 +08:00
|
|
|
sftp-chroot)
|
|
|
|
if [ "x${SUDO}" != "x" ]; then
|
|
|
|
VG_SKIP=1
|
|
|
|
fi ;;
|
2015-02-26 08:58:22 +08:00
|
|
|
esac
|
|
|
|
|
|
|
|
if [ x"$VG_SKIP" = "x" ]; then
|
2018-07-11 07:56:36 +08:00
|
|
|
VG_LEAK="--leak-check=no"
|
2018-07-11 08:19:56 +08:00
|
|
|
if [ x"$VALGRIND_CHECK_LEAKS" != "x" ]; then
|
2018-07-11 07:56:36 +08:00
|
|
|
VG_LEAK="--leak-check=full"
|
|
|
|
fi
|
2015-02-26 08:58:22 +08:00
|
|
|
VG_IGNORE="/bin/*,/sbin/*,/usr/*,/var/*"
|
|
|
|
VG_LOG="$OBJ/valgrind-out/${VG_TEST}."
|
2018-07-11 07:56:36 +08:00
|
|
|
VG_OPTS="--track-origins=yes $VG_LEAK"
|
2015-02-26 08:58:22 +08:00
|
|
|
VG_OPTS="$VG_OPTS --trace-children=yes"
|
|
|
|
VG_OPTS="$VG_OPTS --trace-children-skip=${VG_IGNORE}"
|
2019-07-17 19:24:55 +08:00
|
|
|
VG_OPTS="$VG_OPTS --vgdb-prefix=$OBJ/valgrind-vgdb/"
|
2015-02-26 08:58:22 +08:00
|
|
|
VG_PATH="valgrind"
|
|
|
|
if [ "x$VALGRIND_PATH" != "x" ]; then
|
|
|
|
VG_PATH="$VALGRIND_PATH"
|
|
|
|
fi
|
|
|
|
VG="$VG_PATH $VG_OPTS"
|
|
|
|
SSH="$VG --log-file=${VG_LOG}ssh.%p $SSH"
|
|
|
|
SSHD="$VG --log-file=${VG_LOG}sshd.%p $SSHD"
|
|
|
|
SSHAGENT="$VG --log-file=${VG_LOG}ssh-agent.%p $SSHAGENT"
|
|
|
|
SSHADD="$VG --log-file=${VG_LOG}ssh-add.%p $SSHADD"
|
|
|
|
SSHKEYGEN="$VG --log-file=${VG_LOG}ssh-keygen.%p $SSHKEYGEN"
|
|
|
|
SSHKEYSCAN="$VG --log-file=${VG_LOG}ssh-keyscan.%p $SSHKEYSCAN"
|
|
|
|
SFTP="$VG --log-file=${VG_LOG}sftp.%p ${SFTP}"
|
|
|
|
SCP="$VG --log-file=${VG_LOG}scp.%p $SCP"
|
|
|
|
cat > $OBJ/valgrind-sftp-server.sh << EOF
|
|
|
|
#!/bin/sh
|
|
|
|
exec $VG --log-file=${VG_LOG}sftp-server.%p $SFTPSERVER "\$@"
|
|
|
|
EOF
|
|
|
|
chmod a+rx $OBJ/valgrind-sftp-server.sh
|
|
|
|
SFTPSERVER="$OBJ/valgrind-sftp-server.sh"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2013-05-17 07:19:10 +08:00
|
|
|
# Logfiles.
|
|
|
|
# SSH_LOGFILE should be the debug output of ssh(1) only
|
|
|
|
# SSHD_LOGFILE should be the debug output of sshd(8) only
|
2023-03-01 17:29:32 +08:00
|
|
|
# REGRESS_LOGFILE is the log of progress of the regress test itself.
|
|
|
|
# TEST_SSH_LOGDIR will contain datestamped logs of all binaries run in
|
|
|
|
# chronological order.
|
|
|
|
if [ "x$TEST_SSH_LOGDIR" = "x" ]; then
|
|
|
|
TEST_SSH_LOGDIR=$OBJ/log
|
|
|
|
mkdir -p $TEST_SSH_LOGDIR
|
|
|
|
fi
|
2005-03-07 15:33:02 +08:00
|
|
|
if [ "x$TEST_SSH_LOGFILE" = "x" ]; then
|
2013-05-17 07:19:10 +08:00
|
|
|
TEST_SSH_LOGFILE=$OBJ/ssh.log
|
2005-03-07 15:33:02 +08:00
|
|
|
fi
|
2013-05-17 07:19:10 +08:00
|
|
|
if [ "x$TEST_SSHD_LOGFILE" = "x" ]; then
|
|
|
|
TEST_SSHD_LOGFILE=$OBJ/sshd.log
|
|
|
|
fi
|
|
|
|
if [ "x$TEST_REGRESS_LOGFILE" = "x" ]; then
|
|
|
|
TEST_REGRESS_LOGFILE=$OBJ/regress.log
|
|
|
|
fi
|
|
|
|
|
2022-07-04 17:10:31 +08:00
|
|
|
# If set, keep track of successful tests and skip them them if we've
|
|
|
|
# previously completed that test.
|
|
|
|
if [ "x$TEST_REGRESS_CACHE_DIR" != "x" ]; then
|
|
|
|
if [ ! -d "$TEST_REGRESS_CACHE_DIR" ]; then
|
|
|
|
mkdir -p "$TEST_REGRESS_CACHE_DIR"
|
|
|
|
fi
|
|
|
|
TEST="`basename $SCRIPT .sh`"
|
|
|
|
CACHE="${TEST_REGRESS_CACHE_DIR}/${TEST}.cache"
|
|
|
|
for i in ${SSH} ${SSHD} ${SSHAGENT} ${SSHADD} ${SSHKEYGEN} ${SCP} \
|
|
|
|
${SFTP} ${SFTPSERVER} ${SSHKEYSCAN}; do
|
|
|
|
case $i in
|
|
|
|
/*) bin="$i" ;;
|
|
|
|
*) bin="`which $i`" ;;
|
|
|
|
esac
|
|
|
|
if [ "$bin" -nt "$CACHE" ]; then
|
|
|
|
rm -f "$CACHE"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ -f "$CACHE" ]; then
|
|
|
|
echo ok cached $CACHE
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2013-05-17 07:19:10 +08:00
|
|
|
# truncate logfiles
|
|
|
|
>$TEST_REGRESS_LOGFILE
|
2005-03-07 15:33:02 +08:00
|
|
|
|
2023-03-01 17:29:32 +08:00
|
|
|
# Create ssh and sshd wrappers with logging. These create a datestamped
|
|
|
|
# unique file for every invocation so that we can retain all logs from a
|
|
|
|
# given test no matter how many times it's invoked. It also leaves a
|
|
|
|
# symlink with the original name for tests (and people) who look for that.
|
|
|
|
|
|
|
|
# For ssh, e can't just specify "SSH=ssh -E..." 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.
|
2013-05-17 07:31:39 +08:00
|
|
|
SSHLOGWRAP=$OBJ/ssh-log-wrapper.sh
|
2024-10-22 15:13:28 +08:00
|
|
|
rm -f ${SSHLOGWRAP}
|
2021-08-08 14:38:33 +08:00
|
|
|
cat >$SSHLOGWRAP <<EOD
|
|
|
|
#!/bin/sh
|
2023-03-01 17:29:32 +08:00
|
|
|
timestamp="\`$OBJ/timestamp\`"
|
|
|
|
logfile="${TEST_SSH_LOGDIR}/\${timestamp}.ssh.\$\$.log"
|
|
|
|
echo "Executing: ${SSH} \$@" log \${logfile} >>$TEST_REGRESS_LOGFILE
|
|
|
|
echo "Executing: ${SSH} \$@" >>\${logfile}
|
2021-08-08 16:27:28 +08:00
|
|
|
for i in "\$@";do shift;case "\$i" in -q):;; *) set -- "\$@" "\$i";;esac;done
|
2023-03-02 19:10:27 +08:00
|
|
|
rm -f $TEST_SSH_LOGFILE
|
|
|
|
ln -f -s \${logfile} $TEST_SSH_LOGFILE
|
2023-03-01 17:29:32 +08:00
|
|
|
exec ${SSH} -E\${logfile} "\$@"
|
2021-08-08 14:38:33 +08:00
|
|
|
EOD
|
2013-05-17 07:31:39 +08:00
|
|
|
|
|
|
|
chmod a+rx $OBJ/ssh-log-wrapper.sh
|
2016-04-15 10:57:10 +08:00
|
|
|
REAL_SSH="$SSH"
|
2020-02-01 07:25:08 +08:00
|
|
|
REAL_SSHD="$SSHD"
|
2013-05-17 07:31:39 +08:00
|
|
|
SSH="$SSHLOGWRAP"
|
|
|
|
|
2023-03-01 17:29:32 +08:00
|
|
|
SSHDLOGWRAP=$OBJ/sshd-log-wrapper.sh
|
2024-10-22 15:13:28 +08:00
|
|
|
rm -f ${SSHDLOGWRAP}
|
2023-03-01 17:29:32 +08:00
|
|
|
cat >$SSHDLOGWRAP <<EOD
|
|
|
|
#!/bin/sh
|
|
|
|
timestamp="\`$OBJ/timestamp\`"
|
|
|
|
logfile="${TEST_SSH_LOGDIR}/\${timestamp}.sshd.\$\$.log"
|
2023-03-02 19:10:27 +08:00
|
|
|
rm -f $TEST_SSHD_LOGFILE
|
2023-10-31 07:00:25 +08:00
|
|
|
touch \$logfile
|
2023-10-31 12:15:40 +08:00
|
|
|
test -z "$SUDO" || chown $USER \$logfile
|
2023-03-02 19:10:27 +08:00
|
|
|
ln -f -s \${logfile} $TEST_SSHD_LOGFILE
|
2023-03-01 17:29:32 +08:00
|
|
|
echo "Executing: ${SSHD} \$@" log \${logfile} >>$TEST_REGRESS_LOGFILE
|
|
|
|
echo "Executing: ${SSHD} \$@" >>\${logfile}
|
|
|
|
exec ${SSHD} -E\${logfile} "\$@"
|
|
|
|
EOD
|
|
|
|
chmod a+rx $OBJ/sshd-log-wrapper.sh
|
|
|
|
|
|
|
|
ssh_logfile ()
|
|
|
|
{
|
|
|
|
tool="$1"
|
|
|
|
timestamp="`$OBJ/timestamp`"
|
|
|
|
logfile="${TEST_SSH_LOGDIR}/${timestamp}.$tool.$$.log"
|
|
|
|
echo "Logging $tool to log \${logfile}" >>$TEST_REGRESS_LOGFILE
|
|
|
|
echo $logfile
|
|
|
|
}
|
|
|
|
|
2013-05-17 13:32:29 +08:00
|
|
|
# Some test data. We make a copy because some tests will overwrite it.
|
|
|
|
# The tests may assume that $DATA exists and is writable and $COPY does
|
2013-11-09 13:55:03 +08:00
|
|
|
# not exist. Tests requiring larger data files can call increase_datafile_size
|
|
|
|
# [kbytes] to ensure the file is at least that large.
|
2013-07-25 10:11:18 +08:00
|
|
|
DATANAME=data
|
|
|
|
DATA=$OBJ/${DATANAME}
|
2024-04-03 14:01:11 +08:00
|
|
|
cat ${SSH_BIN} >${DATA}
|
2013-05-17 13:32:29 +08:00
|
|
|
chmod u+w ${DATA}
|
|
|
|
COPY=$OBJ/copy
|
|
|
|
rm -f ${COPY}
|
|
|
|
|
2013-11-09 13:55:03 +08:00
|
|
|
increase_datafile_size()
|
|
|
|
{
|
|
|
|
while [ `du -k ${DATA} | cut -f1` -lt $1 ]; do
|
2024-04-03 14:01:11 +08:00
|
|
|
cat ${SSH_BIN} >>${DATA}
|
2013-11-09 13:55:03 +08:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2002-05-01 11:17:33 +08:00
|
|
|
# these should be used in tests
|
2004-06-16 18:15:59 +08:00
|
|
|
export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN SFTP SFTPSERVER SCP
|
2019-11-27 07:43:10 +08:00
|
|
|
export SSH_PKCS11_HELPER SSH_SK_HELPER
|
2004-06-16 18:15:59 +08:00
|
|
|
#echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN $SFTP $SFTPSERVER $SCP
|
2002-05-01 11:17:33 +08:00
|
|
|
|
2013-05-17 17:17:58 +08:00
|
|
|
# Portable specific functions
|
2022-07-23 12:38:22 +08:00
|
|
|
which()
|
2003-09-12 13:32:17 +08:00
|
|
|
{
|
|
|
|
saved_IFS="$IFS"
|
|
|
|
IFS=":"
|
|
|
|
for i in $PATH
|
|
|
|
do
|
|
|
|
if [ -x $i/$1 ]; then
|
|
|
|
IFS="$saved_IFS"
|
2022-07-23 12:38:22 +08:00
|
|
|
echo "$i/$1"
|
2003-09-12 13:32:17 +08:00
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
IFS="$saved_IFS"
|
2022-07-23 12:38:22 +08:00
|
|
|
echo "$i/$1"
|
2003-09-12 13:32:17 +08:00
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
2022-07-23 12:38:22 +08:00
|
|
|
have_prog()
|
|
|
|
{
|
|
|
|
which "$1" >/dev/null 2>&1
|
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
2013-05-17 17:17:58 +08:00
|
|
|
jot() {
|
|
|
|
awk "BEGIN { for (i = $2; i < $2 + $1; i++) { printf \"%d\n\", i } exit }"
|
|
|
|
}
|
2024-03-25 11:05:40 +08:00
|
|
|
|
2022-01-12 15:25:06 +08:00
|
|
|
if [ ! -x "`which rev`" ]; then
|
|
|
|
rev()
|
|
|
|
{
|
|
|
|
awk '{for (i=length; i>0; i--) printf "%s", substr($0, i, 1); print ""}'
|
|
|
|
}
|
|
|
|
fi
|
2013-05-17 17:28:51 +08:00
|
|
|
|
2024-03-25 11:05:40 +08:00
|
|
|
if [ -x "/usr/xpg4/bin/id" ]; then
|
|
|
|
id()
|
|
|
|
{
|
2024-03-26 13:26:14 +08:00
|
|
|
/usr/xpg4/bin/id $@
|
2024-03-25 11:05:40 +08:00
|
|
|
}
|
|
|
|
fi
|
|
|
|
|
2013-05-17 17:28:51 +08:00
|
|
|
# Check whether preprocessor symbols are defined in config.h.
|
|
|
|
config_defined ()
|
|
|
|
{
|
|
|
|
str=$1
|
|
|
|
while test "x$2" != "x" ; do
|
|
|
|
str="$str|$2"
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
egrep "^#define.*($str)" ${BUILDDIR}/config.h >/dev/null 2>&1
|
|
|
|
}
|
2013-05-17 17:53:25 +08:00
|
|
|
|
|
|
|
md5 () {
|
|
|
|
if have_prog md5sum; then
|
|
|
|
md5sum
|
|
|
|
elif have_prog openssl; then
|
|
|
|
openssl md5
|
|
|
|
elif have_prog cksum; then
|
|
|
|
cksum
|
|
|
|
elif have_prog sum; then
|
|
|
|
sum
|
2021-07-25 20:13:03 +08:00
|
|
|
elif [ -x ${OPENSSL_BIN} ]; then
|
|
|
|
${OPENSSL_BIN} md5
|
2013-05-17 17:53:25 +08:00
|
|
|
else
|
|
|
|
wc -c
|
|
|
|
fi
|
|
|
|
}
|
2021-02-06 06:37:01 +08:00
|
|
|
|
|
|
|
# Some platforms don't have hostname at all, but on others uname -n doesn't
|
|
|
|
# provide the fully qualified name we need, so in the former case we create
|
|
|
|
# our own hostname function.
|
|
|
|
if ! have_prog hostname; then
|
|
|
|
hostname() {
|
|
|
|
uname -n
|
|
|
|
}
|
|
|
|
fi
|
2021-04-07 08:18:32 +08:00
|
|
|
|
|
|
|
make_tmpdir ()
|
|
|
|
{
|
|
|
|
SSH_REGRESS_TMP="$($OBJ/mkdtemp openssh-XXXXXXXX)" || \
|
|
|
|
fatal "failed to create temporary directory"
|
|
|
|
}
|
2013-05-17 17:17:58 +08:00
|
|
|
# End of portable specific functions
|
|
|
|
|
2016-12-16 09:06:27 +08:00
|
|
|
stop_sshd ()
|
2002-05-01 11:17:33 +08:00
|
|
|
{
|
2024-06-11 09:58:27 +08:00
|
|
|
[ -z $PIDFILE ] && return
|
2024-06-07 03:47:48 +08:00
|
|
|
[ -f $PIDFILE ] || return
|
|
|
|
pid=`$SUDO cat $PIDFILE`
|
|
|
|
if [ "X$pid" = "X" ]; then
|
|
|
|
echo "no sshd running" 1>&2
|
|
|
|
return
|
|
|
|
elif [ $pid -lt 2 ]; then
|
|
|
|
echo "bad pid for sshd: $pid" 1>&2
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
$SUDO kill $pid
|
|
|
|
trace "wait for sshd to exit"
|
|
|
|
i=0;
|
|
|
|
while [ -f $PIDFILE -a $i -lt 5 ]; do
|
|
|
|
i=`expr $i + 1`
|
|
|
|
sleep $i
|
|
|
|
done
|
|
|
|
if test -f $PIDFILE; then
|
|
|
|
if $SUDO kill -0 $pid; then
|
|
|
|
echo "sshd didn't exit port $PORT pid $pid" 1>&2
|
2002-05-01 11:17:33 +08:00
|
|
|
else
|
2024-06-07 03:47:48 +08:00
|
|
|
echo "sshd died without cleanup" 1>&2
|
2002-05-01 11:17:33 +08:00
|
|
|
fi
|
2024-06-07 03:47:48 +08:00
|
|
|
exit 1
|
2002-05-01 11:17:33 +08:00
|
|
|
fi
|
2024-06-07 03:47:48 +08:00
|
|
|
PIDFILE=""
|
2002-05-01 11:17:33 +08:00
|
|
|
}
|
|
|
|
|
2016-12-16 09:06:27 +08:00
|
|
|
# helper
|
|
|
|
cleanup ()
|
|
|
|
{
|
|
|
|
if [ "x$SSH_PID" != "x" ]; then
|
|
|
|
if [ $SSH_PID -lt 2 ]; then
|
|
|
|
echo bad pid for ssh: $SSH_PID
|
|
|
|
else
|
|
|
|
kill $SSH_PID
|
|
|
|
fi
|
|
|
|
fi
|
2018-07-20 12:53:42 +08:00
|
|
|
if [ "x$SSH_REGRESS_TMP" != "x" ]; then
|
|
|
|
rm -rf "$SSH_REGRESS_TMP"
|
|
|
|
fi
|
2016-12-16 09:06:27 +08:00
|
|
|
stop_sshd
|
2021-04-07 07:57:56 +08:00
|
|
|
if [ ! -z "$TEST_SSH_ELAPSED_TIMES" ]; then
|
|
|
|
now=`date '+%s'`
|
|
|
|
elapsed=$(($now - $STARTTIME))
|
|
|
|
echo elapsed $elapsed `basename $SCRIPT .sh`
|
|
|
|
fi
|
2016-12-16 09:06:27 +08:00
|
|
|
}
|
|
|
|
|
2013-05-17 07:31:39 +08:00
|
|
|
start_debug_log ()
|
|
|
|
{
|
2023-03-01 17:29:32 +08:00
|
|
|
echo "trace: $@" >>$TEST_REGRESS_LOGFILE
|
|
|
|
if [ -d "$TEST_SSH_LOGDIR" ]; then
|
|
|
|
rm -f $TEST_SSH_LOGDIR/*
|
|
|
|
fi
|
2013-05-17 07:31:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
save_debug_log ()
|
|
|
|
{
|
2023-03-02 16:24:41 +08:00
|
|
|
testname=`echo $tid | tr ' ' _`
|
|
|
|
tarname="$OBJ/failed-$testname-logs.tar"
|
|
|
|
|
2023-10-29 14:22:07 +08:00
|
|
|
for logfile in $TEST_SSH_LOGDIR $TEST_REGRESS_LOGFILE \
|
|
|
|
$TEST_SSH_LOGFILE $TEST_SSHD_LOGFILE; do
|
|
|
|
if [ ! -z "$SUDO" ] && [ -f "$logfile" ]; then
|
|
|
|
$SUDO chown -R $USER $logfile
|
|
|
|
fi
|
|
|
|
done
|
2013-05-17 07:31:39 +08:00
|
|
|
echo $@ >>$TEST_REGRESS_LOGFILE
|
|
|
|
echo $@ >>$TEST_SSH_LOGFILE
|
|
|
|
echo $@ >>$TEST_SSHD_LOGFILE
|
2023-03-02 16:24:41 +08:00
|
|
|
echo "Saving debug logs to $tarname" >>$TEST_REGRESS_LOGFILE
|
2013-05-17 07:31:39 +08:00
|
|
|
(cat $TEST_REGRESS_LOGFILE; echo) >>$OBJ/failed-regress.log
|
|
|
|
(cat $TEST_SSH_LOGFILE; echo) >>$OBJ/failed-ssh.log
|
|
|
|
(cat $TEST_SSHD_LOGFILE; echo) >>$OBJ/failed-sshd.log
|
2023-03-01 17:29:32 +08:00
|
|
|
|
|
|
|
# Save all logfiles in a tarball.
|
|
|
|
(cd $OBJ &&
|
|
|
|
logfiles=""
|
|
|
|
for i in $TEST_REGRESS_LOGFILE $TEST_SSH_LOGFILE $TEST_SSHD_LOGFILE \
|
|
|
|
$TEST_SSH_LOGDIR; do
|
|
|
|
if [ -e "`basename $i`" ]; then
|
|
|
|
logfiles="$logfiles `basename $i`"
|
|
|
|
else
|
|
|
|
logfiles="$logfiles $i"
|
|
|
|
fi
|
|
|
|
done
|
2023-03-02 16:24:41 +08:00
|
|
|
tar cf "$tarname" $logfiles)
|
2013-05-17 07:31:39 +08:00
|
|
|
}
|
|
|
|
|
2002-05-01 11:17:33 +08:00
|
|
|
trace ()
|
|
|
|
{
|
2013-05-17 07:31:39 +08:00
|
|
|
start_debug_log $@
|
2002-05-01 11:17:33 +08:00
|
|
|
if [ "X$TEST_SSH_TRACE" = "Xyes" ]; then
|
2007-10-26 13:35:54 +08:00
|
|
|
echo "$@"
|
2002-05-01 11:17:33 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
verbose ()
|
|
|
|
{
|
2013-05-17 07:31:39 +08:00
|
|
|
start_debug_log $@
|
2002-05-01 11:17:33 +08:00
|
|
|
if [ "X$TEST_SSH_QUIET" != "Xyes" ]; then
|
2007-10-26 13:35:54 +08:00
|
|
|
echo "$@"
|
2002-05-01 11:17:33 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
fail ()
|
|
|
|
{
|
2013-05-17 07:31:39 +08:00
|
|
|
save_debug_log "FAIL: $@"
|
2002-05-01 11:17:33 +08:00
|
|
|
RESULT=1
|
2007-10-26 13:35:54 +08:00
|
|
|
echo "$@"
|
2018-05-22 08:22:49 +08:00
|
|
|
if test "x$TEST_SSH_FAIL_FATAL" != "x" ; then
|
|
|
|
cleanup
|
|
|
|
exit $RESULT
|
|
|
|
fi
|
2002-05-01 11:17:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
fatal ()
|
|
|
|
{
|
2013-05-17 07:31:39 +08:00
|
|
|
save_debug_log "FATAL: $@"
|
2013-05-17 11:28:36 +08:00
|
|
|
printf "FATAL: "
|
2002-05-01 11:17:33 +08:00
|
|
|
fail "$@"
|
|
|
|
cleanup
|
|
|
|
exit $RESULT
|
|
|
|
}
|
|
|
|
|
2021-09-01 08:50:27 +08:00
|
|
|
# Skip remaining tests in script.
|
|
|
|
skip ()
|
|
|
|
{
|
|
|
|
echo "SKIPPED: $@"
|
|
|
|
cleanup
|
|
|
|
exit $RESULT
|
|
|
|
}
|
|
|
|
|
2023-01-13 12:47:34 +08:00
|
|
|
maybe_add_scp_path_to_sshd ()
|
|
|
|
{
|
|
|
|
# If we're testing a non-installed scp, add its directory to sshd's
|
|
|
|
# PATH so we can test it. We don't do this for all tests as it
|
|
|
|
# breaks the SetEnv tests.
|
|
|
|
case "$SCP" in
|
|
|
|
/*) PATH_WITH_SCP="`dirname $SCP`:$PATH"
|
|
|
|
echo " SetEnv PATH='$PATH_WITH_SCP'" >>$OBJ/sshd_config
|
|
|
|
echo " SetEnv PATH='$PATH_WITH_SCP'" >>$OBJ/sshd_proxy ;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2002-05-01 11:17:33 +08:00
|
|
|
RESULT=0
|
|
|
|
PIDFILE=$OBJ/pidfile
|
|
|
|
|
|
|
|
trap fatal 3 2
|
|
|
|
|
|
|
|
# create server config
|
|
|
|
cat << EOF > $OBJ/sshd_config
|
2004-06-16 18:36:16 +08:00
|
|
|
StrictModes no
|
2002-05-01 11:17:33 +08:00
|
|
|
Port $PORT
|
2006-01-31 18:59:01 +08:00
|
|
|
AddressFamily inet
|
2002-05-01 11:17:33 +08:00
|
|
|
ListenAddress 127.0.0.1
|
|
|
|
#ListenAddress ::1
|
|
|
|
PidFile $PIDFILE
|
|
|
|
AuthorizedKeysFile $OBJ/authorized_keys_%u
|
2013-05-17 07:31:39 +08:00
|
|
|
LogLevel DEBUG3
|
2004-06-16 18:08:56 +08:00
|
|
|
AcceptEnv _XXX_TEST_*
|
|
|
|
AcceptEnv _XXX_TEST
|
2004-06-16 18:22:22 +08:00
|
|
|
Subsystem sftp $SFTPSERVER
|
2024-05-17 09:45:22 +08:00
|
|
|
SshdSessionPath $SSHD_SESSION
|
2024-10-14 11:02:08 +08:00
|
|
|
SshdAuthPath $SSHD_AUTH
|
2024-06-07 02:48:13 +08:00
|
|
|
PerSourcePenalties no
|
2002-05-01 11:17:33 +08:00
|
|
|
EOF
|
|
|
|
|
2016-04-15 07:21:42 +08:00
|
|
|
# This may be necessary if /usr/src and/or /usr/obj are group-writable,
|
|
|
|
# but if you aren't careful with permissions then the unit tests could
|
|
|
|
# be abused to locally escalate privileges.
|
|
|
|
if [ ! -z "$TEST_SSH_UNSAFE_PERMISSIONS" ]; then
|
2021-03-13 09:52:16 +08:00
|
|
|
echo " StrictModes no" >> $OBJ/sshd_config
|
2020-01-23 11:42:41 +08:00
|
|
|
else
|
|
|
|
# check and warn if excessive permissions are likely to cause failures.
|
|
|
|
unsafe=""
|
|
|
|
dir="${OBJ}"
|
|
|
|
while test ${dir} != "/"; do
|
2020-01-24 09:29:23 +08:00
|
|
|
if test -d "${dir}" && ! test -h "${dir}"; then
|
2020-01-23 18:19:59 +08:00
|
|
|
perms=`ls -ld ${dir}`
|
|
|
|
case "${perms}" in
|
2020-01-23 11:42:41 +08:00
|
|
|
?????w????*|????????w?*) unsafe="${unsafe} ${dir}" ;;
|
2020-01-23 18:19:59 +08:00
|
|
|
esac
|
|
|
|
fi
|
2020-01-23 11:42:41 +08:00
|
|
|
dir=`dirname ${dir}`
|
|
|
|
done
|
|
|
|
if ! test -z "${unsafe}"; then
|
|
|
|
cat <<EOD
|
|
|
|
|
|
|
|
WARNING: Unsafe (group or world writable) directory permissions found:
|
|
|
|
${unsafe}
|
|
|
|
|
|
|
|
These could be abused to locally escalate privileges. If you are
|
|
|
|
sure that this is not a risk (eg there are no other users), you can
|
|
|
|
bypass this check by setting TEST_SSH_UNSAFE_PERMISSIONS=1
|
|
|
|
|
|
|
|
EOD
|
|
|
|
fi
|
2016-04-15 07:21:42 +08:00
|
|
|
fi
|
|
|
|
|
2021-03-13 09:52:16 +08:00
|
|
|
if [ ! -z "$TEST_SSH_MODULI_FILE" ]; then
|
|
|
|
trace "adding modulifile='$TEST_SSH_MODULI_FILE' to sshd_config"
|
|
|
|
echo " ModuliFile '$TEST_SSH_MODULI_FILE'" >> $OBJ/sshd_config
|
|
|
|
fi
|
|
|
|
|
2004-06-23 07:25:02 +08:00
|
|
|
if [ ! -z "$TEST_SSH_SSHD_CONFOPTS" ]; then
|
|
|
|
trace "adding sshd_config option $TEST_SSH_SSHD_CONFOPTS"
|
|
|
|
echo "$TEST_SSH_SSHD_CONFOPTS" >> $OBJ/sshd_config
|
|
|
|
fi
|
|
|
|
|
2002-05-01 11:17:33 +08:00
|
|
|
# server config for proxy connects
|
|
|
|
cp $OBJ/sshd_config $OBJ/sshd_proxy
|
|
|
|
|
|
|
|
# allow group-writable directories in proxy-mode
|
|
|
|
echo 'StrictModes no' >> $OBJ/sshd_proxy
|
|
|
|
|
|
|
|
# create client config
|
|
|
|
cat << EOF > $OBJ/ssh_config
|
|
|
|
Host *
|
|
|
|
Hostname 127.0.0.1
|
|
|
|
HostKeyAlias localhost-with-alias
|
|
|
|
Port $PORT
|
|
|
|
User $USER
|
|
|
|
GlobalKnownHostsFile $OBJ/known_hosts
|
|
|
|
UserKnownHostsFile $OBJ/known_hosts
|
|
|
|
PubkeyAuthentication yes
|
|
|
|
ChallengeResponseAuthentication no
|
|
|
|
PasswordAuthentication no
|
|
|
|
BatchMode yes
|
|
|
|
StrictHostKeyChecking yes
|
2013-05-17 07:31:39 +08:00
|
|
|
LogLevel DEBUG3
|
2002-05-01 11:17:33 +08:00
|
|
|
EOF
|
|
|
|
|
2004-06-23 07:25:02 +08:00
|
|
|
if [ ! -z "$TEST_SSH_SSH_CONFOPTS" ]; then
|
2015-04-07 07:10:00 +08:00
|
|
|
trace "adding ssh_config option $TEST_SSH_SSH_CONFOPTS"
|
2004-06-23 07:25:02 +08:00
|
|
|
echo "$TEST_SSH_SSH_CONFOPTS" >> $OBJ/ssh_config
|
|
|
|
fi
|
|
|
|
|
2002-05-01 11:17:33 +08:00
|
|
|
rm -f $OBJ/known_hosts $OBJ/authorized_keys_$USER
|
|
|
|
|
2019-11-27 07:43:10 +08:00
|
|
|
SSH_SK_PROVIDER=
|
2020-05-05 09:32:43 +08:00
|
|
|
if ! config_defined ENABLE_SK; then
|
|
|
|
trace skipping sk-dummy
|
|
|
|
elif [ -f "${SRC}/misc/sk-dummy/obj/sk-dummy.so" ] ; then
|
2019-11-27 07:43:10 +08:00
|
|
|
SSH_SK_PROVIDER="${SRC}/misc/sk-dummy/obj/sk-dummy.so"
|
2022-02-17 18:15:16 +08:00
|
|
|
elif [ -f "${OBJ}/misc/sk-dummy/sk-dummy.so" ] ; then
|
|
|
|
SSH_SK_PROVIDER="${OBJ}/misc/sk-dummy/sk-dummy.so"
|
2019-11-27 07:43:10 +08:00
|
|
|
elif [ -f "${SRC}/misc/sk-dummy/sk-dummy.so" ] ; then
|
|
|
|
SSH_SK_PROVIDER="${SRC}/misc/sk-dummy/sk-dummy.so"
|
|
|
|
fi
|
|
|
|
export SSH_SK_PROVIDER
|
|
|
|
|
|
|
|
if ! test -z "$SSH_SK_PROVIDER"; then
|
|
|
|
EXTRA_AGENT_ARGS='-P/*' # XXX want realpath(1)...
|
|
|
|
echo "SecurityKeyProvider $SSH_SK_PROVIDER" >> $OBJ/ssh_config
|
2019-12-16 10:39:05 +08:00
|
|
|
echo "SecurityKeyProvider $SSH_SK_PROVIDER" >> $OBJ/sshd_config
|
|
|
|
echo "SecurityKeyProvider $SSH_SK_PROVIDER" >> $OBJ/sshd_proxy
|
2019-11-27 07:43:10 +08:00
|
|
|
fi
|
|
|
|
export EXTRA_AGENT_ARGS
|
|
|
|
|
|
|
|
maybe_filter_sk() {
|
|
|
|
if test -z "$SSH_SK_PROVIDER" ; then
|
2019-12-16 10:39:05 +08:00
|
|
|
grep -v ^sk
|
2019-11-27 07:43:10 +08:00
|
|
|
else
|
|
|
|
cat
|
|
|
|
fi
|
|
|
|
}
|
2017-05-01 07:34:55 +08:00
|
|
|
|
2019-11-27 07:43:10 +08:00
|
|
|
SSH_KEYTYPES=`$SSH -Q key-plain | maybe_filter_sk`
|
2019-12-16 10:39:05 +08:00
|
|
|
SSH_HOSTKEY_TYPES=`$SSH -Q key-plain | maybe_filter_sk`
|
2020-04-05 07:04:41 +08:00
|
|
|
|
2015-03-04 06:35:19 +08:00
|
|
|
for t in ${SSH_KEYTYPES}; do
|
2002-05-01 11:17:33 +08:00
|
|
|
# generate user key
|
2015-02-26 08:58:22 +08:00
|
|
|
if [ ! -f $OBJ/$t ] || [ ${SSHKEYGEN_BIN} -nt $OBJ/$t ]; then
|
2020-04-05 07:04:41 +08:00
|
|
|
trace "generating key type $t"
|
2013-05-17 07:10:20 +08:00
|
|
|
rm -f $OBJ/$t
|
|
|
|
${SSHKEYGEN} -q -N '' -t $t -f $OBJ/$t ||\
|
|
|
|
fail "ssh-keygen for $t failed"
|
2020-04-05 07:04:41 +08:00
|
|
|
else
|
|
|
|
trace "using cached key type $t"
|
2013-05-17 07:10:20 +08:00
|
|
|
fi
|
2002-05-01 11:17:33 +08:00
|
|
|
|
2019-11-27 07:43:10 +08:00
|
|
|
# setup authorized keys
|
|
|
|
cat $OBJ/$t.pub >> $OBJ/authorized_keys_$USER
|
|
|
|
echo IdentityFile $OBJ/$t >> $OBJ/ssh_config
|
|
|
|
done
|
|
|
|
|
|
|
|
for t in ${SSH_HOSTKEY_TYPES}; do
|
2002-05-01 11:17:33 +08:00
|
|
|
# known hosts file for client
|
|
|
|
(
|
2013-05-17 11:28:36 +08:00
|
|
|
printf 'localhost-with-alias,127.0.0.1,::1 '
|
2002-05-01 11:17:33 +08:00
|
|
|
cat $OBJ/$t.pub
|
|
|
|
) >> $OBJ/known_hosts
|
|
|
|
|
|
|
|
# use key as host key, too
|
2021-06-10 17:37:59 +08:00
|
|
|
(umask 077; $SUDO cp $OBJ/$t $OBJ/host.$t)
|
2002-05-01 11:17:33 +08:00
|
|
|
echo HostKey $OBJ/host.$t >> $OBJ/sshd_config
|
|
|
|
|
|
|
|
# don't use SUDO for proxy connect
|
|
|
|
echo HostKey $OBJ/$t >> $OBJ/sshd_proxy
|
|
|
|
done
|
|
|
|
chmod 644 $OBJ/authorized_keys_$USER
|
|
|
|
|
2008-06-30 06:07:56 +08:00
|
|
|
# Activate Twisted Conch tests if the binary is present
|
|
|
|
REGRESS_INTEROP_CONCH=no
|
|
|
|
if test -x "$CONCH" ; then
|
|
|
|
REGRESS_INTEROP_CONCH=yes
|
|
|
|
fi
|
|
|
|
|
2021-02-17 11:59:00 +08:00
|
|
|
# If PuTTY is present, new enough and we are running a PuTTY test, prepare
|
|
|
|
# keys and configuration.
|
2008-03-12 21:17:00 +08:00
|
|
|
REGRESS_INTEROP_PUTTY=no
|
2021-02-17 11:59:00 +08:00
|
|
|
if test -x "$PUTTYGEN" -a -x "$PLINK" &&
|
|
|
|
"$PUTTYGEN" --help 2>&1 | grep -- --new-passphrase >/dev/null; then
|
2008-06-10 23:38:52 +08:00
|
|
|
REGRESS_INTEROP_PUTTY=yes
|
|
|
|
fi
|
|
|
|
case "$SCRIPT" in
|
|
|
|
*putty*) ;;
|
|
|
|
*) REGRESS_INTEROP_PUTTY=no ;;
|
|
|
|
esac
|
|
|
|
|
2024-02-19 17:25:52 +08:00
|
|
|
puttysetup() {
|
2024-02-09 16:47:42 +08:00
|
|
|
if test "x$REGRESS_INTEROP_PUTTY" != "xyes" ; then
|
|
|
|
skip "putty interop tests not enabled"
|
|
|
|
fi
|
|
|
|
|
2008-03-12 21:17:00 +08:00
|
|
|
mkdir -p ${OBJ}/.putty
|
|
|
|
|
|
|
|
# Add a PuTTY key to authorized_keys
|
|
|
|
rm -f ${OBJ}/putty.rsa2
|
2021-02-17 11:59:00 +08:00
|
|
|
if ! "$PUTTYGEN" -t rsa -o ${OBJ}/putty.rsa2 \
|
2018-03-16 17:06:31 +08:00
|
|
|
--random-device=/dev/urandom \
|
2016-11-25 11:02:01 +08:00
|
|
|
--new-passphrase /dev/null < /dev/null > /dev/null; then
|
2021-02-17 11:59:00 +08:00
|
|
|
echo "Your installed version of PuTTY is too old to support --new-passphrase, skipping test" >&2
|
|
|
|
exit 1
|
2016-11-25 11:02:01 +08:00
|
|
|
fi
|
2021-02-17 11:59:00 +08:00
|
|
|
"$PUTTYGEN" -O public-openssh ${OBJ}/putty.rsa2 \
|
2008-03-12 21:17:00 +08:00
|
|
|
>> $OBJ/authorized_keys_$USER
|
|
|
|
|
|
|
|
# Convert rsa2 host key to PuTTY format
|
2019-07-05 12:12:46 +08:00
|
|
|
cp $OBJ/ssh-rsa $OBJ/ssh-rsa_oldfmt
|
|
|
|
${SSHKEYGEN} -p -N '' -m PEM -f $OBJ/ssh-rsa_oldfmt >/dev/null
|
|
|
|
${SRC}/ssh2putty.sh 127.0.0.1 $PORT $OBJ/ssh-rsa_oldfmt > \
|
2008-03-12 21:17:00 +08:00
|
|
|
${OBJ}/.putty/sshhostkeys
|
2019-07-05 12:12:46 +08:00
|
|
|
${SRC}/ssh2putty.sh 127.0.0.1 22 $OBJ/ssh-rsa_oldfmt >> \
|
2008-03-12 21:17:00 +08:00
|
|
|
${OBJ}/.putty/sshhostkeys
|
2019-07-05 12:12:46 +08:00
|
|
|
rm -f $OBJ/ssh-rsa_oldfmt
|
2008-03-12 21:17:00 +08:00
|
|
|
|
|
|
|
# Setup proxied session
|
|
|
|
mkdir -p ${OBJ}/.putty/sessions
|
|
|
|
rm -f ${OBJ}/.putty/sessions/localhost_proxy
|
2016-11-25 11:02:01 +08:00
|
|
|
echo "Protocol=ssh" >> ${OBJ}/.putty/sessions/localhost_proxy
|
|
|
|
echo "HostName=127.0.0.1" >> ${OBJ}/.putty/sessions/localhost_proxy
|
2008-03-12 21:17:00 +08:00
|
|
|
echo "PortNumber=$PORT" >> ${OBJ}/.putty/sessions/localhost_proxy
|
|
|
|
echo "ProxyMethod=5" >> ${OBJ}/.putty/sessions/localhost_proxy
|
2023-03-01 17:29:32 +08:00
|
|
|
echo "ProxyTelnetCommand=${OBJ}/sshd-log-wrapper.sh -i -f $OBJ/sshd_proxy" >> ${OBJ}/.putty/sessions/localhost_proxy
|
2016-11-25 11:02:01 +08:00
|
|
|
echo "ProxyLocalhost=1" >> ${OBJ}/.putty/sessions/localhost_proxy
|
2008-03-12 21:17:00 +08:00
|
|
|
|
2024-02-09 16:47:42 +08:00
|
|
|
PUTTYVER="`${PLINK} --version | awk '/plink: Release/{print $3}'`"
|
2024-03-25 09:28:29 +08:00
|
|
|
PUTTYMAJORVER="`echo ${PUTTYVER} | cut -f1 -d.`"
|
2024-02-09 16:47:42 +08:00
|
|
|
PUTTYMINORVER="`echo ${PUTTYVER} | cut -f2 -d.`"
|
2024-03-25 09:28:29 +08:00
|
|
|
verbose "plink version ${PUTTYVER} major ${PUTTYMAJORVER} minor ${PUTTYMINORVER}"
|
2024-02-09 16:47:42 +08:00
|
|
|
|
|
|
|
# Re-enable ssh-rsa on older PuTTY versions since they don't do newer
|
|
|
|
# key types.
|
2024-03-25 09:28:29 +08:00
|
|
|
if [ "$PUTTYMAJORVER" -eq "0" ] && [ "$PUTTYMINORVER" -lt "76" ]; then
|
2024-02-09 16:47:42 +08:00
|
|
|
echo "HostKeyAlgorithms +ssh-rsa" >> ${OBJ}/sshd_proxy
|
|
|
|
echo "PubkeyAcceptedKeyTypes +ssh-rsa" >> ${OBJ}/sshd_proxy
|
|
|
|
fi
|
|
|
|
|
2024-03-25 09:28:29 +08:00
|
|
|
if [ "$PUTTYMAJORVER" -eq "0" ] && [ "$PUTTYMINORVER" -le "64" ]; then
|
2024-02-09 16:47:42 +08:00
|
|
|
echo "KexAlgorithms +diffie-hellman-group14-sha1" \
|
|
|
|
>>${OBJ}/sshd_proxy
|
|
|
|
fi
|
2018-03-23 10:21:14 +08:00
|
|
|
PUTTYDIR=${OBJ}/.putty
|
|
|
|
export PUTTYDIR
|
2024-02-19 17:25:52 +08:00
|
|
|
}
|
2008-03-12 21:17:00 +08:00
|
|
|
|
2023-10-20 14:56:45 +08:00
|
|
|
REGRESS_INTEROP_DROPBEAR=no
|
|
|
|
if test -x "$DROPBEARKEY" -a -x "$DBCLIENT" -a -x "$DROPBEARCONVERT"; then
|
|
|
|
REGRESS_INTEROP_DROPBEAR=yes
|
|
|
|
fi
|
|
|
|
case "$SCRIPT" in
|
|
|
|
*dropbear*) ;;
|
|
|
|
*) REGRESS_INTEROP_DROPBEAR=no ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if test "$REGRESS_INTEROP_DROPBEAR" = "yes" ; then
|
|
|
|
trace Create dropbear keys and add to authorized_keys
|
|
|
|
mkdir -p $OBJ/.dropbear
|
2024-06-20 16:18:34 +08:00
|
|
|
kt="ed25519"
|
|
|
|
for i in dss rsa ecdsa; do
|
|
|
|
if $SSH -Q key-plain | grep "$i" >/dev/null; then
|
|
|
|
kt="$kt $i"
|
|
|
|
else
|
|
|
|
rm -f "$OBJ/.dropbear/id_$i"
|
|
|
|
fi
|
|
|
|
done
|
2024-06-19 18:08:34 +08:00
|
|
|
for i in $kt; do
|
2023-10-20 14:56:45 +08:00
|
|
|
if [ ! -f "$OBJ/.dropbear/id_$i" ]; then
|
2024-06-19 18:08:34 +08:00
|
|
|
verbose Create dropbear key type $i
|
|
|
|
$DROPBEARKEY -t $i -f $OBJ/.dropbear/id_$i \
|
|
|
|
>/dev/null 2>&1
|
2023-10-20 14:56:45 +08:00
|
|
|
fi
|
2024-06-19 18:08:34 +08:00
|
|
|
$DROPBEARCONVERT dropbear openssh $OBJ/.dropbear/id_$i \
|
|
|
|
$OBJ/.dropbear/ossh.id_$i >/dev/null 2>&1
|
2023-10-20 14:56:45 +08:00
|
|
|
$SSHKEYGEN -y -f $OBJ/.dropbear/ossh.id_$i \
|
|
|
|
>>$OBJ/authorized_keys_$USER
|
2024-06-19 18:08:34 +08:00
|
|
|
rm -f $OBJ/.dropbear/id_$i.pub $OBJ/.dropbear/ossh.id_$i
|
2023-10-20 14:56:45 +08:00
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2002-05-01 11:17:33 +08:00
|
|
|
# create a proxy version of the client config
|
|
|
|
(
|
|
|
|
cat $OBJ/ssh_config
|
2023-03-01 17:29:32 +08:00
|
|
|
echo proxycommand ${SUDO} env SSH_SK_HELPER=\"$SSH_SK_HELPER\" ${OBJ}/sshd-log-wrapper.sh -i -f $OBJ/sshd_proxy
|
2002-05-01 11:17:33 +08:00
|
|
|
) > $OBJ/ssh_proxy
|
|
|
|
|
|
|
|
# check proxy config
|
|
|
|
${SSHD} -t -f $OBJ/sshd_proxy || fatal "sshd_proxy broken"
|
|
|
|
|
2023-10-20 14:56:45 +08:00
|
|
|
# extract proxycommand into separate shell script for use by Dropbear.
|
|
|
|
echo '#!/bin/sh' >$OBJ/ssh_proxy.sh
|
|
|
|
awk '/^proxycommand/' $OBJ/ssh_proxy | sed 's/^proxycommand//' \
|
|
|
|
>>$OBJ/ssh_proxy.sh
|
|
|
|
chmod a+x $OBJ/ssh_proxy.sh
|
|
|
|
|
2002-05-01 11:17:33 +08:00
|
|
|
start_sshd ()
|
|
|
|
{
|
2024-06-11 09:58:27 +08:00
|
|
|
PIDFILE=$OBJ/pidfile
|
2002-05-01 11:17:33 +08:00
|
|
|
# start sshd
|
2023-03-01 17:29:32 +08:00
|
|
|
logfile="${TEST_SSH_LOGDIR}/sshd.`$OBJ/timestamp`.$$.log"
|
2008-03-12 21:17:00 +08:00
|
|
|
$SUDO ${SSHD} -f $OBJ/sshd_config "$@" -t || fatal "sshd_config broken"
|
2020-01-21 16:06:27 +08:00
|
|
|
$SUDO env SSH_SK_HELPER="$SSH_SK_HELPER" \
|
|
|
|
${SSHD} -f $OBJ/sshd_config "$@" -E$TEST_SSHD_LOGFILE
|
2002-05-01 11:17:33 +08:00
|
|
|
|
|
|
|
trace "wait for sshd"
|
|
|
|
i=0;
|
2003-09-04 13:35:48 +08:00
|
|
|
while [ ! -f $PIDFILE -a $i -lt 10 ]; do
|
2002-05-01 11:17:33 +08:00
|
|
|
i=`expr $i + 1`
|
|
|
|
sleep $i
|
|
|
|
done
|
2024-10-22 15:13:28 +08:00
|
|
|
rm -f ${TEST_SSHD_LOGFILE}
|
2024-06-07 03:48:40 +08:00
|
|
|
ln -f -s ${logfile} $TEST_SSHD_LOGFILE
|
2002-05-01 11:17:33 +08:00
|
|
|
|
|
|
|
test -f $PIDFILE || fatal "no sshd running on port $PORT"
|
|
|
|
}
|
|
|
|
|
2023-10-31 07:00:25 +08:00
|
|
|
# Find a PKCS#11 library.
|
|
|
|
p11_find_lib() {
|
|
|
|
TEST_SSH_PKCS11=""
|
|
|
|
for _lib in "$@" ; do
|
|
|
|
if test -f "$_lib" ; then
|
|
|
|
TEST_SSH_PKCS11="$_lib"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
# Perform PKCS#11 setup: prepares a softhsm2 token configuration, generated
|
|
|
|
# keys and loads them into the virtual token.
|
|
|
|
PKCS11_OK=
|
|
|
|
export PKCS11_OK
|
|
|
|
p11_setup() {
|
|
|
|
p11_find_lib \
|
|
|
|
/usr/local/lib/softhsm/libsofthsm2.so \
|
|
|
|
/usr/lib64/pkcs11/libsofthsm2.so \
|
|
|
|
/usr/lib/x86_64-linux-gnu/softhsm/libsofthsm2.so
|
|
|
|
test -z "$TEST_SSH_PKCS11" && return 1
|
|
|
|
verbose "using token library $TEST_SSH_PKCS11"
|
|
|
|
TEST_SSH_PIN=1234
|
|
|
|
TEST_SSH_SOPIN=12345678
|
|
|
|
if [ "x$TEST_SSH_SSHPKCS11HELPER" != "x" ]; then
|
|
|
|
SSH_PKCS11_HELPER="${TEST_SSH_SSHPKCS11HELPER}"
|
|
|
|
export SSH_PKCS11_HELPER
|
|
|
|
fi
|
|
|
|
|
|
|
|
# setup environment for softhsm2 token
|
|
|
|
SSH_SOFTHSM_DIR=$OBJ/SOFTHSM
|
|
|
|
export SSH_SOFTHSM_DIR
|
|
|
|
rm -rf $SSH_SOFTHSM_DIR
|
|
|
|
TOKEN=$SSH_SOFTHSM_DIR/tokendir
|
|
|
|
mkdir -p $TOKEN
|
|
|
|
SOFTHSM2_CONF=$SSH_SOFTHSM_DIR/softhsm2.conf
|
|
|
|
export SOFTHSM2_CONF
|
|
|
|
cat > $SOFTHSM2_CONF << EOF
|
|
|
|
# SoftHSM v2 configuration file
|
|
|
|
directories.tokendir = ${TOKEN}
|
|
|
|
objectstore.backend = file
|
|
|
|
# ERROR, WARNING, INFO, DEBUG
|
|
|
|
log.level = DEBUG
|
|
|
|
# If CKF_REMOVABLE_DEVICE flag should be set
|
|
|
|
slots.removable = false
|
|
|
|
EOF
|
|
|
|
out=$(softhsm2-util --init-token --free --label token-slot-0 --pin "$TEST_SSH_PIN" --so-pin "$TEST_SSH_SOPIN")
|
|
|
|
slot=$(echo -- $out | sed 's/.* //')
|
|
|
|
trace "generating keys"
|
|
|
|
# RSA key
|
|
|
|
RSA=${SSH_SOFTHSM_DIR}/RSA
|
|
|
|
RSAP8=${SSH_SOFTHSM_DIR}/RSAP8
|
|
|
|
$OPENSSL_BIN genpkey -algorithm rsa > $RSA 2>/dev/null || \
|
|
|
|
fatal "genpkey RSA fail"
|
|
|
|
$OPENSSL_BIN pkcs8 -nocrypt -in $RSA > $RSAP8 || fatal "pkcs8 RSA fail"
|
|
|
|
softhsm2-util --slot "$slot" --label 01 --id 01 --pin "$TEST_SSH_PIN" \
|
|
|
|
--import $RSAP8 >/dev/null || fatal "softhsm import RSA fail"
|
|
|
|
chmod 600 $RSA
|
|
|
|
ssh-keygen -y -f $RSA > ${RSA}.pub
|
|
|
|
# ECDSA key
|
|
|
|
ECPARAM=${SSH_SOFTHSM_DIR}/ECPARAM
|
|
|
|
EC=${SSH_SOFTHSM_DIR}/EC
|
|
|
|
ECP8=${SSH_SOFTHSM_DIR}/ECP8
|
|
|
|
$OPENSSL_BIN genpkey -genparam -algorithm ec \
|
|
|
|
-pkeyopt ec_paramgen_curve:prime256v1 > $ECPARAM || \
|
|
|
|
fatal "param EC fail"
|
|
|
|
$OPENSSL_BIN genpkey -paramfile $ECPARAM > $EC || \
|
|
|
|
fatal "genpkey EC fail"
|
|
|
|
$OPENSSL_BIN pkcs8 -nocrypt -in $EC > $ECP8 || fatal "pkcs8 EC fail"
|
|
|
|
softhsm2-util --slot "$slot" --label 02 --id 02 --pin "$TEST_SSH_PIN" \
|
|
|
|
--import $ECP8 >/dev/null || fatal "softhsm import EC fail"
|
|
|
|
chmod 600 $EC
|
|
|
|
ssh-keygen -y -f $EC > ${EC}.pub
|
|
|
|
# Prepare askpass script to load PIN.
|
|
|
|
PIN_SH=$SSH_SOFTHSM_DIR/pin.sh
|
|
|
|
cat > $PIN_SH << EOF
|
|
|
|
#!/bin/sh
|
|
|
|
echo "${TEST_SSH_PIN}"
|
|
|
|
EOF
|
|
|
|
chmod 0700 "$PIN_SH"
|
|
|
|
PKCS11_OK=yes
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
# Peforms ssh-add with the right token PIN.
|
|
|
|
p11_ssh_add() {
|
|
|
|
env SSH_ASKPASS="$PIN_SH" SSH_ASKPASS_REQUIRE=force ${SSHADD} "$@"
|
|
|
|
}
|
|
|
|
|
2002-05-01 11:17:33 +08:00
|
|
|
# source test body
|
|
|
|
. $SCRIPT
|
|
|
|
|
|
|
|
# kill sshd
|
|
|
|
cleanup
|
2019-07-18 09:09:38 +08:00
|
|
|
|
|
|
|
if [ "x$USE_VALGRIND" != "x" ]; then
|
2022-01-19 12:37:39 +08:00
|
|
|
# If there is an EXIT trap handler, invoke it now.
|
|
|
|
# Some tests set these to clean up processes such as ssh-agent. We
|
|
|
|
# need to wait for all valgrind processes to complete so we can check
|
|
|
|
# their logs, but since the EXIT traps are not invoked until
|
|
|
|
# test-exec.sh exits, waiting here will deadlock.
|
|
|
|
# This is not very portable but then neither is valgrind itself.
|
2022-01-20 10:26:27 +08:00
|
|
|
# As a bonus, dash (as used on the runners) has a "trap" that doesn't
|
|
|
|
# work in a pipeline (hence the temp file) or a subshell.
|
|
|
|
exithandler=""
|
|
|
|
trap >/tmp/trap.$$ && exithandler=$(cat /tmp/trap.$$ | \
|
|
|
|
awk -F "'" '/EXIT$/{print $2}')
|
|
|
|
rm -f /tmp/trap.$$
|
2022-01-19 12:37:39 +08:00
|
|
|
if [ "x${exithandler}" != "x" ]; then
|
|
|
|
verbose invoking EXIT trap handler early: ${exithandler}
|
2022-01-20 10:26:27 +08:00
|
|
|
eval "${exithandler}"
|
2022-01-19 12:37:39 +08:00
|
|
|
trap '' EXIT
|
|
|
|
fi
|
|
|
|
|
2019-07-18 09:09:38 +08:00
|
|
|
# wait for any running process to complete
|
|
|
|
wait; sleep 1
|
2019-07-19 05:43:07 +08:00
|
|
|
VG_RESULTS=$(find $OBJ/valgrind-out -type f -print)
|
|
|
|
VG_RESULT_COUNT=0
|
2019-07-23 06:11:22 +08:00
|
|
|
VG_FAIL_COUNT=0
|
2019-07-19 05:43:07 +08:00
|
|
|
for i in $VG_RESULTS; do
|
|
|
|
if grep "ERROR SUMMARY" $i >/dev/null; then
|
|
|
|
VG_RESULT_COUNT=$(($VG_RESULT_COUNT + 1))
|
|
|
|
if ! grep "ERROR SUMMARY: 0 errors" $i >/dev/null; then
|
2019-07-23 06:11:22 +08:00
|
|
|
VG_FAIL_COUNT=$(($VG_FAIL_COUNT + 1))
|
2019-07-19 05:43:07 +08:00
|
|
|
RESULT=1
|
|
|
|
verbose valgrind failure $i
|
|
|
|
cat $i
|
|
|
|
fi
|
2019-07-18 09:09:38 +08:00
|
|
|
fi
|
|
|
|
done
|
2019-07-19 11:16:11 +08:00
|
|
|
if [ x"$VG_SKIP" != "x" ]; then
|
|
|
|
verbose valgrind skipped
|
|
|
|
else
|
2019-07-23 06:11:22 +08:00
|
|
|
verbose valgrind results $VG_RESULT_COUNT failures $VG_FAIL_COUNT
|
2019-07-19 11:16:11 +08:00
|
|
|
fi
|
2019-07-18 09:09:38 +08:00
|
|
|
fi
|
|
|
|
|
2002-05-01 11:17:33 +08:00
|
|
|
if [ $RESULT -eq 0 ]; then
|
|
|
|
verbose ok $tid
|
2022-07-04 17:10:31 +08:00
|
|
|
if [ "x$CACHE" != "x" ]; then
|
|
|
|
touch "$CACHE"
|
|
|
|
fi
|
2002-05-01 11:17:33 +08:00
|
|
|
else
|
|
|
|
echo failed $tid
|
|
|
|
fi
|
|
|
|
exit $RESULT
|