mirror of
git://anongit.mindrot.org/openssh.git
synced 2024-12-22 01:50:16 +00:00
3ab6fccc39
I saw failures on the reexec fallback test on Darwin 19.4 where fork()ed children of a process that had it's executable removed would instantly fail. Using ln to preserve the inode avoids this.
58 lines
1.0 KiB
Bash
58 lines
1.0 KiB
Bash
# $OpenBSD: reexec.sh,v 1.12 2017/08/07 03:52:55 dtucker Exp $
|
|
# Placed in the Public Domain.
|
|
|
|
tid="reexec tests"
|
|
|
|
SSHD_ORIG=$SSHD
|
|
SSHD_COPY=$OBJ/sshd
|
|
|
|
# Start a sshd and then delete it
|
|
start_sshd_copy ()
|
|
{
|
|
# NB. prefer ln to cp here. On some OSX 19.4 configurations,
|
|
# djm has seen failure after fork() when the executable image
|
|
# has been removed from the filesystem.
|
|
ln $SSHD_ORIG $SSHD_COPY || cp $SSHD_ORIG $SSHD_COPY
|
|
SSHD=$SSHD_COPY
|
|
start_sshd
|
|
SSHD=$SSHD_ORIG
|
|
}
|
|
|
|
# Do basic copy tests
|
|
copy_tests ()
|
|
{
|
|
rm -f ${COPY}
|
|
${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}
|
|
}
|
|
|
|
verbose "test config passing"
|
|
|
|
cp $OBJ/sshd_config $OBJ/sshd_config.orig
|
|
start_sshd
|
|
echo "InvalidXXX=no" >> $OBJ/sshd_config
|
|
|
|
copy_tests
|
|
|
|
stop_sshd
|
|
|
|
cp $OBJ/sshd_config.orig $OBJ/sshd_config
|
|
|
|
# cygwin can't fork a deleted binary
|
|
if [ "$os" != "cygwin" ]; then
|
|
|
|
verbose "test reexec fallback"
|
|
|
|
start_sshd_copy
|
|
rm -f $SSHD_COPY
|
|
|
|
copy_tests
|
|
|
|
stop_sshd
|
|
fi
|