~ubuntu-branches/ubuntu/lucid/openssh/lucid

« back to all changes in this revision

Viewing changes to regress/reexec.sh

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2005-10-10 20:10:01 UTC
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20051010201001-rno2f5bno6e6wo6t
Tags: upstream-4.1p1
ImportĀ upstreamĀ versionĀ 4.1p1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#       $OpenBSD: reexec.sh,v 1.3 2004/06/25 01:32:44 djm Exp $
 
1
#       $OpenBSD: reexec.sh,v 1.5 2004/10/08 02:01:50 djm Exp $
2
2
#       Placed in the Public Domain.
3
3
 
4
4
tid="reexec tests"
6
6
DATA=/bin/ls
7
7
COPY=${OBJ}/copy
8
8
SSHD_ORIG=$SSHD
9
 
SSHD_COPY=$OBJ/sshd.copy
 
9
SSHD_COPY=$OBJ/sshd
10
10
 
11
11
# Start a sshd and then delete it
12
 
start_sshd_copy_zap ()
 
12
start_sshd_copy ()
13
13
{
14
14
        cp $SSHD_ORIG $SSHD_COPY
15
15
        SSHD=$SSHD_COPY
16
16
        start_sshd
17
 
        rm -f $SSHD_COPY
18
17
        SSHD=$SSHD_ORIG
19
18
}
20
19
 
 
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
 
21
36
verbose "test config passing"
 
37
 
22
38
cp $OBJ/sshd_config $OBJ/sshd_config.orig
23
 
 
24
39
start_sshd
25
 
 
26
40
echo "InvalidXXX=no" >> $OBJ/sshd_config
27
41
 
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"
35
 
        fi
36
 
        cmp ${DATA} ${COPY}             || fail "corrupted copy"
37
 
        rm -f ${COPY}
38
 
done
 
42
copy_tests
39
43
 
40
44
$SUDO kill `cat $PIDFILE`
41
45
rm -f $PIDFILE
44
48
 
45
49
verbose "test reexec fallback"
46
50
 
47
 
start_sshd_copy_zap
 
51
start_sshd_copy
 
52
rm -f $SSHD_COPY
48
53
 
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"
56
 
        fi
57
 
        cmp ${DATA} ${COPY}             || fail "corrupted copy"
58
 
        rm -f ${COPY}
59
 
done
 
54
copy_tests
60
55
 
61
56
$SUDO kill `cat $PIDFILE`
62
57
rm -f $PIDFILE
66
61
cp $OBJ/sshd_config.orig $OBJ/sshd_config
67
62
echo "UsePrivilegeSeparation=no" >> $OBJ/sshd_config
68
63
 
69
 
start_sshd_copy_zap
 
64
start_sshd_copy
 
65
rm -f $SSHD_COPY
70
66
 
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"
78
 
        fi
79
 
        cmp ${DATA} ${COPY}             || fail "corrupted copy"
80
 
        rm -f ${COPY}
81
 
done
 
67
copy_tests
82
68
 
83
69
$SUDO kill `cat $PIDFILE`
84
70
rm -f $PIDFILE
85
71
 
86
 
cp $OBJ/sshd_config.orig $OBJ/sshd_config
87
72