xref: /freebsd/crypto/openssh/regress/reexec.sh (revision cfd6422a5217410fbd66f7a7a8a64d9d85e61229)
1#	$OpenBSD: reexec.sh,v 1.12 2017/08/07 03:52:55 dtucker Exp $
2#	Placed in the Public Domain.
3
4tid="reexec tests"
5
6SSHD_ORIG=$SSHD
7SSHD_COPY=$OBJ/sshd
8
9# Start a sshd and then delete it
10start_sshd_copy ()
11{
12	cp $SSHD_ORIG $SSHD_COPY
13	SSHD=$SSHD_COPY
14	start_sshd
15	SSHD=$SSHD_ORIG
16}
17
18# Do basic copy tests
19copy_tests ()
20{
21	rm -f ${COPY}
22	${SSH} -nq -F $OBJ/ssh_config somehost \
23	    cat ${DATA} > ${COPY}
24	if [ $? -ne 0 ]; then
25		fail "ssh cat $DATA failed"
26	fi
27	cmp ${DATA} ${COPY}		|| fail "corrupted copy"
28	rm -f ${COPY}
29}
30
31verbose "test config passing"
32
33cp $OBJ/sshd_config $OBJ/sshd_config.orig
34start_sshd
35echo "InvalidXXX=no" >> $OBJ/sshd_config
36
37copy_tests
38
39stop_sshd
40
41cp $OBJ/sshd_config.orig $OBJ/sshd_config
42
43# cygwin can't fork a deleted binary
44if [ "$os" != "cygwin" ]; then
45
46verbose "test reexec fallback"
47
48start_sshd_copy
49rm -f $SSHD_COPY
50
51copy_tests
52
53stop_sshd
54fi
55