]>
Commit | Line | Data |
---|---|---|
9c7ea094 | 1 | # $OpenBSD: reexec.sh,v 1.5 2004/10/08 02:01:50 djm Exp $ |
403447b4 | 2 | # Placed in the Public Domain. |
3 | ||
4 | tid="reexec tests" | |
5 | ||
6 | DATA=/bin/ls | |
7 | COPY=${OBJ}/copy | |
8 | SSHD_ORIG=$SSHD | |
67a35538 | 9 | SSHD_COPY=$OBJ/sshd |
403447b4 | 10 | |
11 | # Start a sshd and then delete it | |
9c7ea094 | 12 | start_sshd_copy () |
403447b4 | 13 | { |
14 | cp $SSHD_ORIG $SSHD_COPY | |
15 | SSHD=$SSHD_COPY | |
16 | start_sshd | |
403447b4 | 17 | SSHD=$SSHD_ORIG |
18 | } | |
19 | ||
9c7ea094 | 20 | # Do basic copy tests |
21 | copy_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 | ||
403447b4 | 36 | verbose "test config passing" |
403447b4 | 37 | |
9c7ea094 | 38 | cp $OBJ/sshd_config $OBJ/sshd_config.orig |
403447b4 | 39 | start_sshd |
403447b4 | 40 | echo "InvalidXXX=no" >> $OBJ/sshd_config |
41 | ||
9c7ea094 | 42 | copy_tests |
403447b4 | 43 | |
44 | $SUDO kill `cat $PIDFILE` | |
45 | rm -f $PIDFILE | |
46 | ||
47 | cp $OBJ/sshd_config.orig $OBJ/sshd_config | |
48 | ||
49 | verbose "test reexec fallback" | |
50 | ||
9c7ea094 | 51 | start_sshd_copy |
52 | rm -f $SSHD_COPY | |
53 | ||
54 | copy_tests | |
403447b4 | 55 | |
56 | $SUDO kill `cat $PIDFILE` | |
57 | rm -f $PIDFILE | |
58 | ||
59 | verbose "test reexec fallback without privsep" | |
60 | ||
61 | cp $OBJ/sshd_config.orig $OBJ/sshd_config | |
62 | echo "UsePrivilegeSeparation=no" >> $OBJ/sshd_config | |
63 | ||
9c7ea094 | 64 | start_sshd_copy |
65 | rm -f $SSHD_COPY | |
66 | ||
67 | copy_tests | |
403447b4 | 68 | |
69 | $SUDO kill `cat $PIDFILE` | |
70 | rm -f $PIDFILE | |
71 | ||
403447b4 | 72 |