Import OpenSSH-5.1p1.
[dragonfly.git] / crypto / openssh-3.9p1 / regress / reexec.sh
blob39fffefbc35640c35bc4b0eb4ec3e50c643ab90c
1 # $OpenBSD: reexec.sh,v 1.3 2004/06/25 01:32:44 djm Exp $
2 # Placed in the Public Domain.
4 tid="reexec tests"
6 DATA=/bin/ls
7 COPY=${OBJ}/copy
8 SSHD_ORIG=$SSHD
9 SSHD_COPY=$OBJ/sshd.copy
11 # Start a sshd and then delete it
12 start_sshd_copy_zap ()
14 cp $SSHD_ORIG $SSHD_COPY
15 SSHD=$SSHD_COPY
16 start_sshd
17 rm -f $SSHD_COPY
18 SSHD=$SSHD_ORIG
21 verbose "test config passing"
22 cp $OBJ/sshd_config $OBJ/sshd_config.orig
24 start_sshd
26 echo "InvalidXXX=no" >> $OBJ/sshd_config
28 rm -f ${COPY}
29 for 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"
36 cmp ${DATA} ${COPY} || fail "corrupted copy"
37 rm -f ${COPY}
38 done
40 $SUDO kill `cat $PIDFILE`
41 rm -f $PIDFILE
43 cp $OBJ/sshd_config.orig $OBJ/sshd_config
45 verbose "test reexec fallback"
47 start_sshd_copy_zap
49 rm -f ${COPY}
50 for 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"
57 cmp ${DATA} ${COPY} || fail "corrupted copy"
58 rm -f ${COPY}
59 done
61 $SUDO kill `cat $PIDFILE`
62 rm -f $PIDFILE
64 verbose "test reexec fallback without privsep"
66 cp $OBJ/sshd_config.orig $OBJ/sshd_config
67 echo "UsePrivilegeSeparation=no" >> $OBJ/sshd_config
69 start_sshd_copy_zap
71 rm -f ${COPY}
72 for 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"
79 cmp ${DATA} ${COPY} || fail "corrupted copy"
80 rm -f ${COPY}
81 done
83 $SUDO kill `cat $PIDFILE`
84 rm -f $PIDFILE
86 cp $OBJ/sshd_config.orig $OBJ/sshd_config