]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - crypto/openssh/regress/reexec.sh
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / crypto / openssh / regress / reexec.sh
1 #       $OpenBSD: reexec.sh,v 1.7 2013/05/17 10:23:52 dtucker Exp $
2 #       Placed in the Public Domain.
3
4 tid="reexec tests"
5
6 SSHD_ORIG=$SSHD
7 SSHD_COPY=$OBJ/sshd
8
9 # Start a sshd and then delete it
10 start_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
19 copy_tests ()
20 {
21         rm -f ${COPY}
22         for p in 1 2; 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
34 verbose "test config passing"
35
36 cp $OBJ/sshd_config $OBJ/sshd_config.orig
37 start_sshd
38 echo "InvalidXXX=no" >> $OBJ/sshd_config
39
40 copy_tests
41
42 $SUDO kill `$SUDO cat $PIDFILE`
43 rm -f $PIDFILE
44
45 cp $OBJ/sshd_config.orig $OBJ/sshd_config
46
47 # cygwin can't fork a deleted binary
48 if [ "$os" != "cygwin" ]; then
49
50 verbose "test reexec fallback"
51
52 start_sshd_copy
53 rm -f $SSHD_COPY
54
55 copy_tests
56
57 $SUDO kill `$SUDO cat $PIDFILE`
58 rm -f $PIDFILE
59
60 verbose "test reexec fallback without privsep"
61
62 cp $OBJ/sshd_config.orig $OBJ/sshd_config
63 echo "UsePrivilegeSeparation=no" >> $OBJ/sshd_config
64
65 start_sshd_copy
66 rm -f $SSHD_COPY
67
68 copy_tests
69
70 $SUDO kill `$SUDO cat $PIDFILE`
71 rm -f $PIDFILE
72
73 fi