diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 14:40:04 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 14:40:04 +0000 |
commit | 25505898530a333011f4fd5cbc841ad6b26c089c (patch) | |
tree | 333a33fdd60930bcccc3f177ed9467d535e9bac6 /regress/reexec.sh | |
parent | Initial commit. (diff) | |
download | openssh-b503b34536f98116d1873eb2dc80dddf75554e63.tar.xz openssh-b503b34536f98116d1873eb2dc80dddf75554e63.zip |
Adding upstream version 1:9.2p1.upstream/1%9.2p1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'regress/reexec.sh')
-rw-r--r-- | regress/reexec.sh | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/regress/reexec.sh b/regress/reexec.sh new file mode 100644 index 0000000..3f88d41 --- /dev/null +++ b/regress/reexec.sh @@ -0,0 +1,57 @@ +# $OpenBSD: reexec.sh,v 1.13 2023/01/19 07:53:45 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 +$SUDO rm -f $SSHD_COPY + +copy_tests + +stop_sshd +fi |