• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#	$OpenBSD: reexec.sh,v 1.10 2016/12/16 01:06:27 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	for p in ${SSH_PROTOCOLS} ; do
23		verbose "$tid: proto $p"
24		${SSH} -nqo "Protocol=$p" -F $OBJ/ssh_config somehost \
25		    cat ${DATA} > ${COPY}
26		if [ $? -ne 0 ]; then
27			fail "ssh cat $DATA failed"
28		fi
29		cmp ${DATA} ${COPY}		|| fail "corrupted copy"
30		rm -f ${COPY}
31	done
32}
33
34verbose "test config passing"
35
36cp $OBJ/sshd_config $OBJ/sshd_config.orig
37start_sshd
38echo "InvalidXXX=no" >> $OBJ/sshd_config
39
40copy_tests
41
42stop_sshd
43
44cp $OBJ/sshd_config.orig $OBJ/sshd_config
45
46# cygwin can't fork a deleted binary
47if [ "$os" != "cygwin" ]; then
48
49verbose "test reexec fallback"
50
51start_sshd_copy
52rm -f $SSHD_COPY
53
54copy_tests
55
56stop_sshd
57
58verbose "test reexec fallback without privsep"
59
60cp $OBJ/sshd_config.orig $OBJ/sshd_config
61echo "UsePrivilegeSeparation=no" >> $OBJ/sshd_config
62
63start_sshd_copy
64rm -f $SSHD_COPY
65
66copy_tests
67
68stop_sshd
69
70fi
71