diff options
Diffstat (limited to 'regress/scp.sh')
-rw-r--r-- | regress/scp.sh | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/regress/scp.sh b/regress/scp.sh new file mode 100644 index 000000000..2d722c70c --- /dev/null +++ b/regress/scp.sh | |||
@@ -0,0 +1,73 @@ | |||
1 | # $OpenBSD: scp.sh,v 1.1 2004/06/13 13:51:02 dtucker Exp $ | ||
2 | # Placed in the Public Domain. | ||
3 | |||
4 | tid="scp" | ||
5 | |||
6 | #set -x | ||
7 | |||
8 | DATA=/bin/ls | ||
9 | COPY=${OBJ}/copy | ||
10 | COPY2=${OBJ}/copy2 | ||
11 | DIR=${COPY}.dd | ||
12 | DIR2=${COPY}.dd2 | ||
13 | |||
14 | SRC=`dirname ${SCRIPT}` | ||
15 | cp ${SRC}/scp-ssh-wrapper.sh ${OBJ}/scp-ssh-wrapper.exe | ||
16 | chmod 755 ${OBJ}/scp-ssh-wrapper.exe | ||
17 | scpopts="-q -S ${OBJ}/scp-ssh-wrapper.exe" | ||
18 | |||
19 | scpclean() { | ||
20 | rm -rf ${COPY} ${COPY2} ${DIR} ${DIR2} | ||
21 | mkdir ${DIR} ${DIR2} | ||
22 | } | ||
23 | |||
24 | verbose "$tid: simple copy local file to remote file" | ||
25 | scpclean | ||
26 | $SCP $scpopts ${DATA} somehost:${COPY} || fail "copy failed" | ||
27 | cmp ${DATA} ${COPY} || fail "corrupted copy" | ||
28 | |||
29 | verbose "$tid: simple copy remote file to local file" | ||
30 | scpclean | ||
31 | $SCP $scpopts somehost:${DATA} ${COPY} || fail "copy failed" | ||
32 | cmp ${DATA} ${COPY} || fail "corrupted copy" | ||
33 | |||
34 | verbose "$tid: simple copy local file to remote dir" | ||
35 | scpclean | ||
36 | cp ${DATA} ${COPY} | ||
37 | $SCP $scpopts ${COPY} somehost:${DIR} || fail "copy failed" | ||
38 | cmp ${COPY} ${DIR}/copy || fail "corrupted copy" | ||
39 | |||
40 | verbose "$tid: simple copy remote file to local dir" | ||
41 | scpclean | ||
42 | cp ${DATA} ${COPY} | ||
43 | $SCP $scpopts somehost:${COPY} ${DIR} || fail "copy failed" | ||
44 | cmp ${COPY} ${DIR}/copy || fail "corrupted copy" | ||
45 | |||
46 | verbose "$tid: recursive local dir to remote dir" | ||
47 | scpclean | ||
48 | cp ${DATA} ${DIR}/copy | ||
49 | $SCP $scpopts -r ${DIR} somehost:${DIR2} || fail "copy failed" | ||
50 | cmp ${DIR} ${DIR2} || fail "corrupted copy" | ||
51 | |||
52 | verbose "$tid: recursive remote dir to local dir" | ||
53 | scpclean | ||
54 | cp ${DATA} ${DIR}/copy | ||
55 | $SCP $scpopts -r somehost:${DIR} ${DIR2} || fail "copy failed" | ||
56 | cmp ${DIR} ${DIR2} || fail "corrupted copy" | ||
57 | |||
58 | for i in 0 1 2 3 4; do | ||
59 | verbose "$tid: disallow bad server #$i" | ||
60 | SCPTESTMODE=badserver_$i | ||
61 | export DIR SCPTESTMODE | ||
62 | scpclean | ||
63 | $SCP $scpopts somehost:${DATA} ${DIR} >/dev/null 2>/dev/null | ||
64 | [ -d {$DIR}/rootpathdir ] && fail "allows dir relative to root dir" | ||
65 | [ -d ${DIR}/dotpathdir ] && fail "allows dir creation in non-recursive mode" | ||
66 | |||
67 | scpclean | ||
68 | $SCP -r $scpopts somehost:${DATA} ${DIR2} >/dev/null 2>/dev/null | ||
69 | [ -d ${DIR}/dotpathdir ] && fail "allows dir creation outside of subdir" | ||
70 | done | ||
71 | |||
72 | scpclean | ||
73 | rm -f ${OBJ}/scp-ssh-wrapper.exe | ||