diff options
Diffstat (limited to 'regress/sftp-cmds.sh')
-rw-r--r-- | regress/sftp-cmds.sh | 109 |
1 files changed, 7 insertions, 102 deletions
diff --git a/regress/sftp-cmds.sh b/regress/sftp-cmds.sh index 1256aeb2d..462c6802f 100644 --- a/regress/sftp-cmds.sh +++ b/regress/sftp-cmds.sh | |||
@@ -1,42 +1,17 @@ | |||
1 | # $OpenBSD: sftp-cmds.sh,v 1.5 2003/07/19 00:46:31 djm Exp $ | 1 | # $OpenBSD: sftp-cmds.sh,v 1.2 2003/01/10 07:52:41 djm Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | # XXX - TODO: | 4 | # XXX - TODO: |
5 | # - globbed operations | ||
5 | # - chmod / chown / chgrp | 6 | # - chmod / chown / chgrp |
6 | # - -p flag for get & put | 7 | # - -p flag for get & put |
7 | 8 | ||
8 | tid="sftp commands" | 9 | tid="sftp commands" |
9 | 10 | ||
10 | DATA=/bin/ls${EXEEXT} | 11 | DATA=/bin/ls |
11 | COPY=${OBJ}/copy | 12 | COPY=${OBJ}/copy |
12 | # test that these files are readable! | 13 | |
13 | for i in `(cd /bin;echo l*)` | 14 | rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.* |
14 | do | ||
15 | if [ -r $i ]; then | ||
16 | GLOBFILES="$GLOBFILES $i" | ||
17 | fi | ||
18 | done | ||
19 | |||
20 | if have_prog uname | ||
21 | then | ||
22 | case `uname` in | ||
23 | CYGWIN*) | ||
24 | os=cygwin | ||
25 | ;; | ||
26 | *) | ||
27 | os=`uname` | ||
28 | ;; | ||
29 | esac | ||
30 | else | ||
31 | os="unknown" | ||
32 | fi | ||
33 | |||
34 | # Path with embedded quote | ||
35 | QUOTECOPY=${COPY}".\"blah\"" | ||
36 | QUOTECOPY_ARG=${COPY}'.\"blah\"' | ||
37 | |||
38 | rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${COPY}.dd2 | ||
39 | mkdir ${COPY}.dd | ||
40 | 15 | ||
41 | verbose "$tid: lls" | 16 | verbose "$tid: lls" |
42 | echo "lls ${OBJ}" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | 17 | echo "lls ${OBJ}" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ |
@@ -79,91 +54,21 @@ echo "get $DATA $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | |||
79 | || fail "get failed" | 54 | || fail "get failed" |
80 | cmp $DATA ${COPY} || fail "corrupted copy after get" | 55 | cmp $DATA ${COPY} || fail "corrupted copy after get" |
81 | 56 | ||
82 | rm -f ${COPY}.dd/* | ||
83 | verbose "$tid: get to directory" | ||
84 | echo "get $DATA ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
85 | || fail "get failed" | ||
86 | cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after get" | ||
87 | |||
88 | rm -f ${COPY}.dd/* | ||
89 | verbose "$tid: glob get to directory" | ||
90 | echo "get /bin/l* ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
91 | || fail "get failed" | ||
92 | for x in $GLOBFILES; do | ||
93 | cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after get" | ||
94 | done | ||
95 | |||
96 | rm -f ${COPY}.dd/* | ||
97 | verbose "$tid: get to local dir" | ||
98 | (echo "lcd ${COPY}.dd"; echo "get $DATA" ) | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
99 | || fail "get failed" | ||
100 | cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after get" | ||
101 | |||
102 | rm -f ${COPY}.dd/* | ||
103 | verbose "$tid: glob get to local dir" | ||
104 | (echo "lcd ${COPY}.dd"; echo "get /bin/l*") | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
105 | || fail "get failed" | ||
106 | for x in $GLOBFILES; do | ||
107 | cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after get" | ||
108 | done | ||
109 | |||
110 | rm -f ${COPY} | 57 | rm -f ${COPY} |
111 | verbose "$tid: put" | 58 | verbose "$tid: put" |
112 | echo "put $DATA $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | 59 | echo "put $DATA $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ |
113 | || fail "put failed" | 60 | || fail "put failed" |
114 | cmp $DATA ${COPY} || fail "corrupted copy after put" | 61 | cmp $DATA ${COPY} || fail "corrupted copy after put" |
115 | 62 | ||
116 | if [ "$os" != "cygwin" ]; then | ||
117 | rm -f ${QUOTECOPY} | ||
118 | verbose "$tid: put filename with quotes" | ||
119 | echo "put $DATA \"$QUOTECOPY_ARG\"" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
120 | || fail "put failed" | ||
121 | cmp $DATA ${QUOTECOPY} || fail "corrupted copy after put with quotes" | ||
122 | fi | ||
123 | |||
124 | rm -f ${COPY}.dd/* | ||
125 | verbose "$tid: put to directory" | ||
126 | echo "put $DATA ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
127 | || fail "put failed" | ||
128 | cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after put" | ||
129 | |||
130 | rm -f ${COPY}.dd/* | ||
131 | verbose "$tid: glob put to directory" | ||
132 | echo "put /bin/l* ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
133 | || fail "put failed" | ||
134 | for x in $GLOBFILES; do | ||
135 | cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after put" | ||
136 | done | ||
137 | |||
138 | rm -f ${COPY}.dd/* | ||
139 | verbose "$tid: put to local dir" | ||
140 | (echo "cd ${COPY}.dd"; echo "put $DATA") | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
141 | || fail "put failed" | ||
142 | cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after put" | ||
143 | |||
144 | rm -f ${COPY}.dd/* | ||
145 | verbose "$tid: glob put to local dir" | ||
146 | (echo "cd ${COPY}.dd"; echo "put /bin/l*") | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
147 | || fail "put failed" | ||
148 | for x in $GLOBFILES; do | ||
149 | cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after put" | ||
150 | done | ||
151 | |||
152 | verbose "$tid: rename" | 63 | verbose "$tid: rename" |
153 | echo "rename $COPY ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | 64 | echo "rename $COPY ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ |
154 | || fail "rename failed" | 65 | || fail "rename failed" |
155 | test -f ${COPY}.1 || fail "missing file after rename" | 66 | test -f ${COPY}.1 || fail "missing file after rename" |
156 | cmp $DATA ${COPY}.1 >/dev/null 2>&1 || fail "corrupted copy after rename" | 67 | cmp $DATA ${COPY}.1 >/dev/null 2>&1 || fail "corrupted copy after rename" |
157 | 68 | ||
158 | verbose "$tid: rename directory" | ||
159 | echo "rename ${COPY}.dd ${COPY}.dd2" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
160 | || fail "rename directory failed" | ||
161 | test -d ${COPY}.dd && fail "oldname exists after rename directory" | ||
162 | test -d ${COPY}.dd2 || fail "missing newname after rename directory" | ||
163 | |||
164 | verbose "$tid: ln" | 69 | verbose "$tid: ln" |
165 | echo "ln ${COPY}.1 ${COPY}.2" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 || fail "ln failed" | 70 | echo "ln ${COPY}.1 ${COPY}.2" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 || fail "ln failed" |
166 | test -h ${COPY}.2 || fail "missing file after ln" | 71 | test -L ${COPY}.2 || fail "missing file after ln" |
167 | 72 | ||
168 | verbose "$tid: mkdir" | 73 | verbose "$tid: mkdir" |
169 | echo "mkdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | 74 | echo "mkdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ |
@@ -190,6 +95,6 @@ verbose "$tid: lchdir" | |||
190 | echo "lchdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | 95 | echo "lchdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ |
191 | || fail "lchdir failed" | 96 | || fail "lchdir failed" |
192 | 97 | ||
193 | rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${COPY}.dd2 | 98 | rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.* |
194 | 99 | ||
195 | 100 | ||