xref: /openbsd-src/regress/usr.bin/ssh/reexec.sh (revision f2da64fbbbf1b03f09f390ab01267c93dfd77c4c)
1#	$OpenBSD: reexec.sh,v 1.8 2015/03/03 22:35:19 markus 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
42$SUDO kill `$SUDO cat $PIDFILE`
43rm -f $PIDFILE
44
45cp $OBJ/sshd_config.orig $OBJ/sshd_config
46
47verbose "test reexec fallback"
48
49start_sshd_copy
50rm -f $SSHD_COPY
51
52copy_tests
53
54$SUDO kill `cat $PIDFILE`
55rm -f $PIDFILE
56
57verbose "test reexec fallback without privsep"
58
59cp $OBJ/sshd_config.orig $OBJ/sshd_config
60echo "UsePrivilegeSeparation=no" >> $OBJ/sshd_config
61
62start_sshd_copy
63rm -f $SSHD_COPY
64
65copy_tests
66
67$SUDO kill `cat $PIDFILE`
68rm -f $PIDFILE
69
70
71