summaryrefslogtreecommitdiff
path: root/regress/reexec.sh
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2004-06-25 13:45:18 +1000
committerDarren Tucker <dtucker@zip.com.au>2004-06-25 13:45:18 +1000
commit977a9d21c885d9da6f6ac3c8d16f70765b0934ce (patch)
treeccdac8766d6c12f71cdf414545775b92e01163d7 /regress/reexec.sh
parent586b0b98bf9fe8a1d551a9706aed60851ff0e014 (diff)
- djm@cvs.openbsd.org 2004/06/24 19:32:00
[regress/Makefile regress/test-exec.sh, added regress/reexec.sh] regress test for re-exec corner cases
Diffstat (limited to 'regress/reexec.sh')
-rw-r--r--regress/reexec.sh87
1 files changed, 87 insertions, 0 deletions
diff --git a/regress/reexec.sh b/regress/reexec.sh
new file mode 100644
index 000000000..39fffefbc
--- /dev/null
+++ b/regress/reexec.sh
@@ -0,0 +1,87 @@
1# $OpenBSD: reexec.sh,v 1.3 2004/06/25 01:32:44 djm Exp $
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
10
11# Start a sshd and then delete it
12start_sshd_copy_zap ()
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
21verbose "test config passing"
22cp $OBJ/sshd_config $OBJ/sshd_config.orig
23
24start_sshd
25
26echo "InvalidXXX=no" >> $OBJ/sshd_config
27
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
39
40$SUDO kill `cat $PIDFILE`
41rm -f $PIDFILE
42
43cp $OBJ/sshd_config.orig $OBJ/sshd_config
44
45verbose "test reexec fallback"
46
47start_sshd_copy_zap
48
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
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
69start_sshd_copy_zap
70
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
82
83$SUDO kill `cat $PIDFILE`
84rm -f $PIDFILE
85
86cp $OBJ/sshd_config.orig $OBJ/sshd_config
87