freebsd-dev/crypto/openssh/regress/reexec.sh

55 lines
878 B
Bash
Raw Normal View History

2018-05-06 12:24:45 +00:00
# $OpenBSD: reexec.sh,v 1.12 2017/08/07 03:52:55 dtucker Exp $
2004-10-28 16:03:53 +00:00
# Placed in the Public Domain.
tid="reexec tests"
2013-09-18 17:27:38 +00:00
SSHD_ORIG=$SSHD
SSHD_COPY=$OBJ/sshd
2004-10-28 16:03:53 +00:00
# Start a sshd and then delete it
2005-06-05 15:40:50 +00:00
start_sshd_copy ()
2004-10-28 16:03:53 +00:00
{
cp $SSHD_ORIG $SSHD_COPY
SSHD=$SSHD_COPY
start_sshd
SSHD=$SSHD_ORIG
}
2005-06-05 15:40:50 +00:00
# Do basic copy tests
copy_tests ()
{
rm -f ${COPY}
2018-05-06 12:24:45 +00:00
${SSH} -nq -F $OBJ/ssh_config somehost \
cat ${DATA} > ${COPY}
if [ $? -ne 0 ]; then
fail "ssh cat $DATA failed"
fi
cmp ${DATA} ${COPY} || fail "corrupted copy"
rm -f ${COPY}
2005-06-05 15:40:50 +00:00
}
2004-10-28 16:03:53 +00:00
verbose "test config passing"
2005-06-05 15:40:50 +00:00
cp $OBJ/sshd_config $OBJ/sshd_config.orig
2004-10-28 16:03:53 +00:00
start_sshd
echo "InvalidXXX=no" >> $OBJ/sshd_config
2005-06-05 15:40:50 +00:00
copy_tests
2004-10-28 16:03:53 +00:00
2017-01-31 12:33:47 +00:00
stop_sshd
2004-10-28 16:03:53 +00:00
cp $OBJ/sshd_config.orig $OBJ/sshd_config
2012-08-29 15:55:54 +00:00
# cygwin can't fork a deleted binary
if [ "$os" != "cygwin" ]; then
2004-10-28 16:03:53 +00:00
verbose "test reexec fallback"
2005-06-05 15:40:50 +00:00
start_sshd_copy
rm -f $SSHD_COPY
copy_tests
2004-10-28 16:03:53 +00:00
2017-01-31 12:33:47 +00:00
stop_sshd
2012-08-29 15:55:54 +00:00
fi