diff options
author | Colin Watson <cjwatson@debian.org> | 2009-12-29 21:34:25 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2009-12-29 21:34:25 +0000 |
commit | fa585019a79ebcb4e0202b1c33f87ff1c5c9ce1c (patch) | |
tree | 28fc9a13eaab935e4de055b561b333d67387a934 /regress/scp.sh | |
parent | 04942aa41fa94ec6f2c3ce1d348f600f31bb7c78 (diff) | |
parent | 3e2e0ac10674d77618c4c7339e18b83ced247492 (diff) |
import openssh-4.3p2-gsskex-20060223.patch
Diffstat (limited to 'regress/scp.sh')
-rw-r--r-- | regress/scp.sh | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/regress/scp.sh b/regress/scp.sh index c3034b6e7..c5d412dd9 100644 --- a/regress/scp.sh +++ b/regress/scp.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: scp.sh,v 1.3 2004/07/08 12:59:35 dtucker Exp $ | 1 | # $OpenBSD: scp.sh,v 1.7 2006/01/31 10:36:33 djm Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | tid="scp" | 4 | tid="scp" |
@@ -28,6 +28,11 @@ scpclean() { | |||
28 | mkdir ${DIR} ${DIR2} | 28 | mkdir ${DIR} ${DIR2} |
29 | } | 29 | } |
30 | 30 | ||
31 | verbose "$tid: simple copy local file to local file" | ||
32 | scpclean | ||
33 | $SCP $scpopts ${DATA} ${COPY} || fail "copy failed" | ||
34 | cmp ${DATA} ${COPY} || fail "corrupted copy" | ||
35 | |||
31 | verbose "$tid: simple copy local file to remote file" | 36 | verbose "$tid: simple copy local file to remote file" |
32 | scpclean | 37 | scpclean |
33 | $SCP $scpopts ${DATA} somehost:${COPY} || fail "copy failed" | 38 | $SCP $scpopts ${DATA} somehost:${COPY} || fail "copy failed" |
@@ -44,6 +49,12 @@ cp ${DATA} ${COPY} | |||
44 | $SCP $scpopts ${COPY} somehost:${DIR} || fail "copy failed" | 49 | $SCP $scpopts ${COPY} somehost:${DIR} || fail "copy failed" |
45 | cmp ${COPY} ${DIR}/copy || fail "corrupted copy" | 50 | cmp ${COPY} ${DIR}/copy || fail "corrupted copy" |
46 | 51 | ||
52 | verbose "$tid: simple copy local file to local dir" | ||
53 | scpclean | ||
54 | cp ${DATA} ${COPY} | ||
55 | $SCP $scpopts ${COPY} ${DIR} || fail "copy failed" | ||
56 | cmp ${COPY} ${DIR}/copy || fail "corrupted copy" | ||
57 | |||
47 | verbose "$tid: simple copy remote file to local dir" | 58 | verbose "$tid: simple copy remote file to local dir" |
48 | scpclean | 59 | scpclean |
49 | cp ${DATA} ${COPY} | 60 | cp ${DATA} ${COPY} |
@@ -57,6 +68,13 @@ cp ${DATA} ${DIR}/copy | |||
57 | $SCP $scpopts -r ${DIR} somehost:${DIR2} || fail "copy failed" | 68 | $SCP $scpopts -r ${DIR} somehost:${DIR2} || fail "copy failed" |
58 | diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy" | 69 | diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy" |
59 | 70 | ||
71 | verbose "$tid: recursive local dir to local dir" | ||
72 | scpclean | ||
73 | rm -rf ${DIR2} | ||
74 | cp ${DATA} ${DIR}/copy | ||
75 | $SCP $scpopts -r ${DIR} ${DIR2} || fail "copy failed" | ||
76 | diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy" | ||
77 | |||
60 | verbose "$tid: recursive remote dir to local dir" | 78 | verbose "$tid: recursive remote dir to local dir" |
61 | scpclean | 79 | scpclean |
62 | rm -rf ${DIR2} | 80 | rm -rf ${DIR2} |
@@ -64,6 +82,13 @@ cp ${DATA} ${DIR}/copy | |||
64 | $SCP $scpopts -r somehost:${DIR} ${DIR2} || fail "copy failed" | 82 | $SCP $scpopts -r somehost:${DIR} ${DIR2} || fail "copy failed" |
65 | diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy" | 83 | diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy" |
66 | 84 | ||
85 | verbose "$tid: shell metacharacters" | ||
86 | scpclean | ||
87 | (cd ${DIR} && \ | ||
88 | touch '`touch metachartest`' && \ | ||
89 | $SCP $scpopts *metachar* ${DIR2} 2>/dev/null; \ | ||
90 | [ ! -f metachartest ] ) || fail "shell metacharacters" | ||
91 | |||
67 | if [ ! -z "$SUDO" ]; then | 92 | if [ ! -z "$SUDO" ]; then |
68 | verbose "$tid: skipped file after scp -p with failed chown+utimes" | 93 | verbose "$tid: skipped file after scp -p with failed chown+utimes" |
69 | scpclean | 94 | scpclean |
@@ -73,7 +98,7 @@ if [ ! -z "$SUDO" ]; then | |||
73 | chmod 660 ${DIR2}/copy | 98 | chmod 660 ${DIR2}/copy |
74 | $SUDO chown root ${DIR2}/copy | 99 | $SUDO chown root ${DIR2}/copy |
75 | $SCP -p $scpopts somehost:${DIR}/\* ${DIR2} >/dev/null 2>&1 | 100 | $SCP -p $scpopts somehost:${DIR}/\* ${DIR2} >/dev/null 2>&1 |
76 | diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy" | 101 | $SUDO diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy" |
77 | $SUDO rm ${DIR2}/copy | 102 | $SUDO rm ${DIR2}/copy |
78 | fi | 103 | fi |
79 | 104 | ||
@@ -91,5 +116,12 @@ for i in 0 1 2 3 4; do | |||
91 | [ -d ${DIR}/dotpathdir ] && fail "allows dir creation outside of subdir" | 116 | [ -d ${DIR}/dotpathdir ] && fail "allows dir creation outside of subdir" |
92 | done | 117 | done |
93 | 118 | ||
119 | verbose "$tid: detect non-directory target" | ||
120 | scpclean | ||
121 | echo a > ${COPY} | ||
122 | echo b > ${COPY2} | ||
123 | $SCP $scpopts ${DATA} ${COPY} ${COPY2} | ||
124 | cmp ${COPY} ${COPY2} >/dev/null && fail "corrupt target" | ||
125 | |||
94 | scpclean | 126 | scpclean |
95 | rm -f ${OBJ}/scp-ssh-wrapper.scp | 127 | rm -f ${OBJ}/scp-ssh-wrapper.scp |