diff options
Diffstat (limited to 'regress')
-rw-r--r-- | regress/reconfigure.sh | 28 | ||||
-rw-r--r-- | regress/rekey.sh | 31 | ||||
-rw-r--r-- | regress/sftp-badcmds.sh | 78 |
3 files changed, 137 insertions, 0 deletions
diff --git a/regress/reconfigure.sh b/regress/reconfigure.sh new file mode 100644 index 000000000..1de846a7e --- /dev/null +++ b/regress/reconfigure.sh | |||
@@ -0,0 +1,28 @@ | |||
1 | # $OpenBSD: reconfigure.sh,v 1.1 2003/06/12 15:43:32 markus Exp $ | ||
2 | # Placed in the Public Domain. | ||
3 | |||
4 | tid="simple connect after reconfigure" | ||
5 | |||
6 | # we need the full path to sshd for -HUP | ||
7 | SSHD=/usr/sbin/sshd | ||
8 | |||
9 | start_sshd | ||
10 | |||
11 | kill -HUP `cat $PIDFILE` | ||
12 | sleep 1 | ||
13 | |||
14 | trace "wait for sshd to restart" | ||
15 | i=0; | ||
16 | while [ ! -f $PIDFILE -a $i -lt 10 ]; do | ||
17 | i=`expr $i + 1` | ||
18 | sleep $i | ||
19 | done | ||
20 | |||
21 | test -f $PIDFILE || fatal "sshd did not restart" | ||
22 | |||
23 | for p in 1 2; do | ||
24 | ${SSH} -o "Protocol=$p" -F $OBJ/ssh_config somehost true | ||
25 | if [ $? -ne 0 ]; then | ||
26 | fail "ssh connect with protocol $p failed after reconfigure" | ||
27 | fi | ||
28 | done | ||
diff --git a/regress/rekey.sh b/regress/rekey.sh new file mode 100644 index 000000000..26848d27b --- /dev/null +++ b/regress/rekey.sh | |||
@@ -0,0 +1,31 @@ | |||
1 | # $OpenBSD: rekey.sh,v 1.1 2003/03/28 13:58:28 markus Exp $ | ||
2 | # Placed in the Public Domain. | ||
3 | |||
4 | tid="rekey during transfer data" | ||
5 | |||
6 | DATA=${OBJ}/data | ||
7 | COPY=${OBJ}/copy | ||
8 | LOG=${OBJ}/log | ||
9 | |||
10 | rm -f ${COPY} ${LOG} ${DATA} | ||
11 | dd if=/dev/zero of=${DATA} bs=1k count=512 > /dev/null 2>&1 | ||
12 | |||
13 | for s in 16 1k 128k 256k; do | ||
14 | trace "rekeylimit ${s}" | ||
15 | rm -f ${COPY} | ||
16 | cat $DATA | \ | ||
17 | ${SSH} -oCompression=no -oRekeyLimit=$s \ | ||
18 | -v -F $OBJ/ssh_proxy somehost "cat > ${COPY}" \ | ||
19 | 2> ${LOG} | ||
20 | if [ $? -ne 0 ]; then | ||
21 | fail "ssh failed" | ||
22 | fi | ||
23 | cmp $DATA ${COPY} || fail "corrupted copy" | ||
24 | n=`grep 'NEWKEYS sent' ${LOG} | wc -l` | ||
25 | n=`expr $n - 1` | ||
26 | trace "$n rekeying(s)" | ||
27 | if [ $n -lt 1 ]; then | ||
28 | fail "no rekeying occured" | ||
29 | fi | ||
30 | done | ||
31 | rm -f ${COPY} ${LOG} ${DATA} | ||
diff --git a/regress/sftp-badcmds.sh b/regress/sftp-badcmds.sh new file mode 100644 index 000000000..ca46909c0 --- /dev/null +++ b/regress/sftp-badcmds.sh | |||
@@ -0,0 +1,78 @@ | |||
1 | # $OpenBSD: sftp-badcmds.sh,v 1.2 2003/05/15 04:07:12 mouring Exp $ | ||
2 | # Placed in the Public Domain. | ||
3 | |||
4 | tid="sftp invalid commands" | ||
5 | |||
6 | DATA=/bin/ls | ||
7 | DATA2=/bin/cat | ||
8 | NONEXIST=/NONEXIST.$$ | ||
9 | COPY=${OBJ}/copy | ||
10 | GLOBFILES=`(cd /bin;echo l*)` | ||
11 | |||
12 | rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.* | ||
13 | |||
14 | rm -f ${COPY} | ||
15 | verbose "$tid: get nonexistent" | ||
16 | echo "get $NONEXIST $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
17 | || fail "get nonexistent failed" | ||
18 | test -f ${COPY} && fail "existing copy after get nonexistent" | ||
19 | |||
20 | rm -f ${COPY}.dd/* | ||
21 | verbose "$tid: glob get to nonexistent directory" | ||
22 | echo "get /bin/l* $NONEXIST" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
23 | || fail "get nonexistent failed" | ||
24 | for x in $GLOBFILES; do | ||
25 | test -f ${COPY}.dd/$x && fail "existing copy after get nonexistent" | ||
26 | done | ||
27 | |||
28 | rm -f ${COPY} | ||
29 | verbose "$tid: put nonexistent" | ||
30 | echo "put $NONEXIST $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
31 | || fail "put nonexistent failed" | ||
32 | test -f ${COPY} && fail "existing copy after put nonexistent" | ||
33 | |||
34 | rm -f ${COPY}.dd/* | ||
35 | verbose "$tid: glob put to nonexistent directory" | ||
36 | echo "put /bin/l* ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
37 | || fail "put nonexistent failed" | ||
38 | for x in $GLOBFILES; do | ||
39 | test -f ${COPY}.dd/$x && fail "existing copy after nonexistent" | ||
40 | done | ||
41 | |||
42 | rm -f ${COPY} | ||
43 | verbose "$tid: rename nonexistent" | ||
44 | echo "rename $NONEXIST ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
45 | || fail "rename nonexist failed" | ||
46 | test -f ${COPY}.1 && fail "file exists after rename nonexistent" | ||
47 | |||
48 | rm -f ${COPY} ${COPY}.1 | ||
49 | cp $DATA $COPY | ||
50 | cp $DATA2 ${COPY}.1 | ||
51 | verbose "$tid: rename target exists" | ||
52 | echo "rename $COPY ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
53 | || fail "rename target exists failed" | ||
54 | test -f ${COPY} || fail "oldname missing after rename target exists" | ||
55 | test -f ${COPY}.1 || fail "newname missing after rename target exists" | ||
56 | cmp $DATA ${COPY} >/dev/null 2>&1 || fail "corrupted oldname after rename target exists" | ||
57 | cmp $DATA2 ${COPY}.1 >/dev/null 2>&1 || fail "corrupted newname after rename target exists" | ||
58 | |||
59 | rm -rf ${COPY} ${COPY}.dd | ||
60 | cp $DATA $COPY | ||
61 | mkdir ${COPY}.dd | ||
62 | verbose "$tid: rename target exists (directory)" | ||
63 | echo "rename $COPY ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
64 | || fail "rename target exists (directory) failed" | ||
65 | test -f ${COPY} || fail "oldname missing after rename target exists (directory)" | ||
66 | test -d ${COPY}.dd || fail "newname missing after rename target exists (directory)" | ||
67 | cmp $DATA ${COPY} >/dev/null 2>&1 || fail "corrupted oldname after rename target exists (directory)" | ||
68 | |||
69 | rm -f ${COPY}.dd/* | ||
70 | rm -rf ${COPY} | ||
71 | cp ${DATA2} ${COPY} | ||
72 | verbose "$tid: glob put files to local file" | ||
73 | echo "put /bin/l* $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 | ||
74 | cmp ${DATA2} ${COPY} || fail "put successed when it should have failed" | ||
75 | |||
76 | rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.* | ||
77 | |||
78 | |||