Deleted Added
full compact
reexec.sh (137015) reexec.sh (146998)
1# $OpenBSD: reexec.sh,v 1.3 2004/06/25 01:32:44 djm Exp $
1# $OpenBSD: reexec.sh,v 1.5 2004/10/08 02:01:50 djm Exp $
2# Placed in the Public Domain.
3
4tid="reexec tests"
5
6DATA=/bin/ls
7COPY=${OBJ}/copy
8SSHD_ORIG=$SSHD
2# Placed in the Public Domain.
3
4tid="reexec tests"
5
6DATA=/bin/ls
7COPY=${OBJ}/copy
8SSHD_ORIG=$SSHD
9SSHD_COPY=$OBJ/sshd.copy
9SSHD_COPY=$OBJ/sshd
10
11# Start a sshd and then delete it
10
11# Start a sshd and then delete it
12start_sshd_copy_zap ()
12start_sshd_copy ()
13{
14 cp $SSHD_ORIG $SSHD_COPY
15 SSHD=$SSHD_COPY
16 start_sshd
13{
14 cp $SSHD_ORIG $SSHD_COPY
15 SSHD=$SSHD_COPY
16 start_sshd
17 rm -f $SSHD_COPY
18 SSHD=$SSHD_ORIG
19}
20
17 SSHD=$SSHD_ORIG
18}
19
20# Do basic copy tests
21copy_tests ()
22{
23 rm -f ${COPY}
24 for p in 1 2; do
25 verbose "$tid: proto $p"
26 ${SSH} -nqo "Protocol=$p" -F $OBJ/ssh_config somehost \
27 cat ${DATA} > ${COPY}
28 if [ $? -ne 0 ]; then
29 fail "ssh cat $DATA failed"
30 fi
31 cmp ${DATA} ${COPY} || fail "corrupted copy"
32 rm -f ${COPY}
33 done
34}
35
21verbose "test config passing"
36verbose "test config passing"
22cp $OBJ/sshd_config $OBJ/sshd_config.orig
23
37
38cp $OBJ/sshd_config $OBJ/sshd_config.orig
24start_sshd
39start_sshd
25
26echo "InvalidXXX=no" >> $OBJ/sshd_config
27
40echo "InvalidXXX=no" >> $OBJ/sshd_config
41
28rm -f ${COPY}
29for p in 1 2; do
30 verbose "$tid: proto $p"
31 ${SSH} -nqo "Protocol=$p" -F $OBJ/ssh_config somehost \
32 cat ${DATA} > ${COPY}
33 if [ $? -ne 0 ]; then
34 fail "ssh cat $DATA failed"
35 fi
36 cmp ${DATA} ${COPY} || fail "corrupted copy"
37 rm -f ${COPY}
38done
42copy_tests
39
40$SUDO kill `cat $PIDFILE`
41rm -f $PIDFILE
42
43cp $OBJ/sshd_config.orig $OBJ/sshd_config
44
45verbose "test reexec fallback"
46
43
44$SUDO kill `cat $PIDFILE`
45rm -f $PIDFILE
46
47cp $OBJ/sshd_config.orig $OBJ/sshd_config
48
49verbose "test reexec fallback"
50
47start_sshd_copy_zap
51start_sshd_copy
52rm -f $SSHD_COPY
48
53
49rm -f ${COPY}
50for p in 1 2; do
51 verbose "$tid: proto $p"
52 ${SSH} -nqo "Protocol=$p" -F $OBJ/ssh_config somehost \
53 cat ${DATA} > ${COPY}
54 if [ $? -ne 0 ]; then
55 fail "ssh cat $DATA failed"
56 fi
57 cmp ${DATA} ${COPY} || fail "corrupted copy"
58 rm -f ${COPY}
59done
54copy_tests
60
61$SUDO kill `cat $PIDFILE`
62rm -f $PIDFILE
63
64verbose "test reexec fallback without privsep"
65
66cp $OBJ/sshd_config.orig $OBJ/sshd_config
67echo "UsePrivilegeSeparation=no" >> $OBJ/sshd_config
68
55
56$SUDO kill `cat $PIDFILE`
57rm -f $PIDFILE
58
59verbose "test reexec fallback without privsep"
60
61cp $OBJ/sshd_config.orig $OBJ/sshd_config
62echo "UsePrivilegeSeparation=no" >> $OBJ/sshd_config
63
69start_sshd_copy_zap
64start_sshd_copy
65rm -f $SSHD_COPY
70
66
71rm -f ${COPY}
72for p in 1 2; do
73 verbose "$tid: proto $p"
74 ${SSH} -nqo "Protocol=$p" -F $OBJ/ssh_config somehost \
75 cat ${DATA} > ${COPY}
76 if [ $? -ne 0 ]; then
77 fail "ssh cat $DATA failed"
78 fi
79 cmp ${DATA} ${COPY} || fail "corrupted copy"
80 rm -f ${COPY}
81done
67copy_tests
82
83$SUDO kill `cat $PIDFILE`
84rm -f $PIDFILE
85
68
69$SUDO kill `cat $PIDFILE`
70rm -f $PIDFILE
71
86cp $OBJ/sshd_config.orig $OBJ/sshd_config
87
72