2004-12-06 13:05:52 +01:00
|
|
|
# $OpenBSD: reexec.sh,v 1.5 2004/10/08 02:01:50 djm Exp $
|
2004-06-25 05:45:18 +02:00
|
|
|
# Placed in the Public Domain.
|
|
|
|
|
|
|
|
tid="reexec tests"
|
|
|
|
|
|
|
|
DATA=/bin/ls
|
|
|
|
COPY=${OBJ}/copy
|
|
|
|
SSHD_ORIG=$SSHD
|
2004-12-06 13:00:27 +01:00
|
|
|
SSHD_COPY=$OBJ/sshd
|
2004-06-25 05:45:18 +02:00
|
|
|
|
|
|
|
# Start a sshd and then delete it
|
2004-12-06 13:05:52 +01:00
|
|
|
start_sshd_copy ()
|
2004-06-25 05:45:18 +02:00
|
|
|
{
|
|
|
|
cp $SSHD_ORIG $SSHD_COPY
|
|
|
|
SSHD=$SSHD_COPY
|
|
|
|
start_sshd
|
|
|
|
SSHD=$SSHD_ORIG
|
|
|
|
}
|
|
|
|
|
2004-12-06 13:05:52 +01:00
|
|
|
# Do basic copy tests
|
|
|
|
copy_tests ()
|
|
|
|
{
|
|
|
|
rm -f ${COPY}
|
|
|
|
for p in 1 2; do
|
|
|
|
verbose "$tid: proto $p"
|
|
|
|
${SSH} -nqo "Protocol=$p" -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}
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2004-06-25 05:45:18 +02:00
|
|
|
verbose "test config passing"
|
|
|
|
|
2004-12-06 13:05:52 +01:00
|
|
|
cp $OBJ/sshd_config $OBJ/sshd_config.orig
|
2004-06-25 05:45:18 +02:00
|
|
|
start_sshd
|
|
|
|
echo "InvalidXXX=no" >> $OBJ/sshd_config
|
|
|
|
|
2004-12-06 13:05:52 +01:00
|
|
|
copy_tests
|
2004-06-25 05:45:18 +02:00
|
|
|
|
|
|
|
$SUDO kill `cat $PIDFILE`
|
|
|
|
rm -f $PIDFILE
|
|
|
|
|
|
|
|
cp $OBJ/sshd_config.orig $OBJ/sshd_config
|
|
|
|
|
|
|
|
verbose "test reexec fallback"
|
|
|
|
|
2004-12-06 13:05:52 +01:00
|
|
|
start_sshd_copy
|
|
|
|
rm -f $SSHD_COPY
|
|
|
|
|
|
|
|
copy_tests
|
2004-06-25 05:45:18 +02:00
|
|
|
|
|
|
|
$SUDO kill `cat $PIDFILE`
|
|
|
|
rm -f $PIDFILE
|
|
|
|
|
|
|
|
verbose "test reexec fallback without privsep"
|
|
|
|
|
|
|
|
cp $OBJ/sshd_config.orig $OBJ/sshd_config
|
|
|
|
echo "UsePrivilegeSeparation=no" >> $OBJ/sshd_config
|
|
|
|
|
2004-12-06 13:05:52 +01:00
|
|
|
start_sshd_copy
|
|
|
|
rm -f $SSHD_COPY
|
|
|
|
|
|
|
|
copy_tests
|
2004-06-25 05:45:18 +02:00
|
|
|
|
|
|
|
$SUDO kill `cat $PIDFILE`
|
|
|
|
rm -f $PIDFILE
|
|
|
|
|
|
|
|
|