]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - crypto/openssh/regress/reexec.sh
MFV r316083,316094:
[FreeBSD/FreeBSD.git] / crypto / openssh / regress / reexec.sh
1 #       $OpenBSD: reexec.sh,v 1.10 2016/12/16 01:06:27 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 ${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
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 stop_sshd
43
44 cp $OBJ/sshd_config.orig $OBJ/sshd_config
45
46 # cygwin can't fork a deleted binary
47 if [ "$os" != "cygwin" ]; then
48
49 verbose "test reexec fallback"
50
51 start_sshd_copy
52 rm -f $SSHD_COPY
53
54 copy_tests
55
56 stop_sshd
57
58 verbose "test reexec fallback without privsep"
59
60 cp $OBJ/sshd_config.orig $OBJ/sshd_config
61 echo "UsePrivilegeSeparation=no" >> $OBJ/sshd_config
62
63 start_sshd_copy
64 rm -f $SSHD_COPY
65
66 copy_tests
67
68 stop_sshd
69
70 fi