summaryrefslogtreecommitdiff
path: root/regress/sftp-cmds.sh
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2010-03-31 10:46:28 +0100
committerColin Watson <cjwatson@debian.org>2010-03-31 10:46:28 +0100
commitefd3d4522636ae029488c2e9730b60c88e257d2e (patch)
tree31e02ac3f16090ce8c53448677356b2b7f423683 /regress/sftp-cmds.sh
parentbbec4db36d464ea1d464a707625125f9fd5c7b5e (diff)
parentd1a87e462e1db89f19cd960588d0c6b287cb5ccc (diff)
* New upstream release (LP: #535029).
- After a transition period of about 10 years, this release disables SSH protocol 1 by default. Clients and servers that need to use the legacy protocol must explicitly enable it in ssh_config / sshd_config or on the command-line. - Remove the libsectok/OpenSC-based smartcard code and add support for PKCS#11 tokens. This support is enabled by default in the Debian packaging, since it now doesn't involve additional library dependencies (closes: #231472, LP: #16918). - Add support for certificate authentication of users and hosts using a new, minimal OpenSSH certificate format (closes: #482806). - Added a 'netcat mode' to ssh(1): "ssh -W host:port ...". - Add the ability to revoke keys in sshd(8) and ssh(1). (For the Debian package, this overlaps with the key blacklisting facility added in openssh 1:4.7p1-9, but with different file formats and slightly different scopes; for the moment, I've roughly merged the two.) - Various multiplexing improvements, including support for requesting port-forwardings via the multiplex protocol (closes: #360151). - Allow setting an explicit umask on the sftp-server(8) commandline to override whatever default the user has (closes: #496843). - Many sftp client improvements, including tab-completion, more options, and recursive transfer support for get/put (LP: #33378). The old mget/mput commands never worked properly and have been removed (closes: #270399, #428082). - Do not prompt for a passphrase if we fail to open a keyfile, and log the reason why the open failed to debug (closes: #431538). - Prevent sftp from crashing when given a "-" without a command. Also, allow whitespace to follow a "-" (closes: #531561).
Diffstat (limited to 'regress/sftp-cmds.sh')
-rw-r--r--regress/sftp-cmds.sh73
1 files changed, 37 insertions, 36 deletions
diff --git a/regress/sftp-cmds.sh b/regress/sftp-cmds.sh
index 3b453c5e8..c4d6ae2de 100644
--- a/regress/sftp-cmds.sh
+++ b/regress/sftp-cmds.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: sftp-cmds.sh,v 1.9 2007/12/12 05:04:03 djm Exp $ 1# $OpenBSD: sftp-cmds.sh,v 1.10 2009/08/13 01:11:55 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4# XXX - TODO: 4# XXX - TODO:
@@ -40,56 +40,56 @@ SPACECOPY_ARG="${COPY}\ this\ has\ spaces.txt"
40# File with glob metacharacters 40# File with glob metacharacters
41GLOBMETACOPY="${COPY} [metachar].txt" 41GLOBMETACOPY="${COPY} [metachar].txt"
42 42
43rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${COPY}.dd2 43rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${COPY}.dd2 ${BATCH}.*
44mkdir ${COPY}.dd 44mkdir ${COPY}.dd
45 45
46verbose "$tid: lls" 46verbose "$tid: lls"
47(echo "lcd ${OBJ}" ; echo "lls") | ${SFTP} -P ${SFTPSERVER} 2>&1 | \ 47(echo "lcd ${OBJ}" ; echo "lls") | ${SFTP} -D ${SFTPSERVER} 2>&1 | \
48 grep copy.dd >/dev/null 2>&1 || fail "lls failed" 48 grep copy.dd >/dev/null 2>&1 || fail "lls failed"
49 49
50verbose "$tid: lls w/path" 50verbose "$tid: lls w/path"
51echo "lls ${OBJ}" | ${SFTP} -P ${SFTPSERVER} 2>&1 | \ 51echo "lls ${OBJ}" | ${SFTP} -D ${SFTPSERVER} 2>&1 | \
52 grep copy.dd >/dev/null 2>&1 || fail "lls w/path failed" 52 grep copy.dd >/dev/null 2>&1 || fail "lls w/path failed"
53 53
54verbose "$tid: ls" 54verbose "$tid: ls"
55echo "ls ${OBJ}" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 55echo "ls ${OBJ}" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
56 || fail "ls failed" 56 || fail "ls failed"
57# XXX always successful 57# XXX always successful
58 58
59verbose "$tid: shell" 59verbose "$tid: shell"
60echo "!echo hi there" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 60echo "!echo hi there" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
61 || fail "shell failed" 61 || fail "shell failed"
62# XXX always successful 62# XXX always successful
63 63
64verbose "$tid: pwd" 64verbose "$tid: pwd"
65echo "pwd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 65echo "pwd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
66 || fail "pwd failed" 66 || fail "pwd failed"
67# XXX always successful 67# XXX always successful
68 68
69verbose "$tid: lpwd" 69verbose "$tid: lpwd"
70echo "lpwd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 70echo "lpwd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
71 || fail "lpwd failed" 71 || fail "lpwd failed"
72# XXX always successful 72# XXX always successful
73 73
74verbose "$tid: quit" 74verbose "$tid: quit"
75echo "quit" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 75echo "quit" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
76 || fail "quit failed" 76 || fail "quit failed"
77# XXX always successful 77# XXX always successful
78 78
79verbose "$tid: help" 79verbose "$tid: help"
80echo "help" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 80echo "help" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
81 || fail "help failed" 81 || fail "help failed"
82# XXX always successful 82# XXX always successful
83 83
84rm -f ${COPY} 84rm -f ${COPY}
85verbose "$tid: get" 85verbose "$tid: get"
86echo "get $DATA $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 86echo "get $DATA $COPY" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
87 || fail "get failed" 87 || fail "get failed"
88cmp $DATA ${COPY} || fail "corrupted copy after get" 88cmp $DATA ${COPY} || fail "corrupted copy after get"
89 89
90rm -f ${COPY} 90rm -f ${COPY}
91verbose "$tid: get quoted" 91verbose "$tid: get quoted"
92echo "get \"$DATA\" $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 92echo "get \"$DATA\" $COPY" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
93 || fail "get failed" 93 || fail "get failed"
94cmp $DATA ${COPY} || fail "corrupted copy after get" 94cmp $DATA ${COPY} || fail "corrupted copy after get"
95 95
@@ -97,8 +97,8 @@ if [ "$os" != "cygwin" ]; then
97rm -f ${QUOTECOPY} 97rm -f ${QUOTECOPY}
98cp $DATA ${QUOTECOPY} 98cp $DATA ${QUOTECOPY}
99verbose "$tid: get filename with quotes" 99verbose "$tid: get filename with quotes"
100echo "get \"$QUOTECOPY_ARG\" ${COPY}" | \ 100echo "get \"$QUOTECOPY_ARG\" ${COPY}" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
101 ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ || fail "get failed" 101 || fail "get failed"
102cmp ${COPY} ${QUOTECOPY} || fail "corrupted copy after get with quotes" 102cmp ${COPY} ${QUOTECOPY} || fail "corrupted copy after get with quotes"
103rm -f ${QUOTECOPY} ${COPY} 103rm -f ${QUOTECOPY} ${COPY}
104fi 104fi
@@ -106,7 +106,7 @@ fi
106rm -f "$SPACECOPY" ${COPY} 106rm -f "$SPACECOPY" ${COPY}
107cp $DATA "$SPACECOPY" 107cp $DATA "$SPACECOPY"
108verbose "$tid: get filename with spaces" 108verbose "$tid: get filename with spaces"
109echo "get ${SPACECOPY_ARG} ${COPY}" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 109echo "get ${SPACECOPY_ARG} ${COPY}" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
110 || fail "get failed" 110 || fail "get failed"
111cmp ${COPY} "$SPACECOPY" || fail "corrupted copy after get with spaces" 111cmp ${COPY} "$SPACECOPY" || fail "corrupted copy after get with spaces"
112 112
@@ -114,19 +114,19 @@ rm -f "$GLOBMETACOPY" ${COPY}
114cp $DATA "$GLOBMETACOPY" 114cp $DATA "$GLOBMETACOPY"
115verbose "$tid: get filename with glob metacharacters" 115verbose "$tid: get filename with glob metacharacters"
116echo "get \"${GLOBMETACOPY}\" ${COPY}" | \ 116echo "get \"${GLOBMETACOPY}\" ${COPY}" | \
117 ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 || fail "get failed" 117 ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 || fail "get failed"
118cmp ${COPY} "$GLOBMETACOPY" || \ 118cmp ${COPY} "$GLOBMETACOPY" || \
119 fail "corrupted copy after get with glob metacharacters" 119 fail "corrupted copy after get with glob metacharacters"
120 120
121rm -f ${COPY}.dd/* 121rm -f ${COPY}.dd/*
122verbose "$tid: get to directory" 122verbose "$tid: get to directory"
123echo "get $DATA ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 123echo "get $DATA ${COPY}.dd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
124 || fail "get failed" 124 || fail "get failed"
125cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after get" 125cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after get"
126 126
127rm -f ${COPY}.dd/* 127rm -f ${COPY}.dd/*
128verbose "$tid: glob get to directory" 128verbose "$tid: glob get to directory"
129echo "get /bin/l* ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 129echo "get /bin/l* ${COPY}.dd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
130 || fail "get failed" 130 || fail "get failed"
131for x in $GLOBFILES; do 131for x in $GLOBFILES; do
132 cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after get" 132 cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after get"
@@ -134,13 +134,13 @@ done
134 134
135rm -f ${COPY}.dd/* 135rm -f ${COPY}.dd/*
136verbose "$tid: get to local dir" 136verbose "$tid: get to local dir"
137(echo "lcd ${COPY}.dd"; echo "get $DATA" ) | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 137(echo "lcd ${COPY}.dd"; echo "get $DATA" ) | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
138 || fail "get failed" 138 || fail "get failed"
139cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after get" 139cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after get"
140 140
141rm -f ${COPY}.dd/* 141rm -f ${COPY}.dd/*
142verbose "$tid: glob get to local dir" 142verbose "$tid: glob get to local dir"
143(echo "lcd ${COPY}.dd"; echo "get /bin/l*") | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 143(echo "lcd ${COPY}.dd"; echo "get /bin/l*") | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
144 || fail "get failed" 144 || fail "get failed"
145for x in $GLOBFILES; do 145for x in $GLOBFILES; do
146 cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after get" 146 cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after get"
@@ -149,32 +149,32 @@ done
149rm -f ${COPY} 149rm -f ${COPY}
150verbose "$tid: put" 150verbose "$tid: put"
151echo "put $DATA $COPY" | \ 151echo "put $DATA $COPY" | \
152 ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 || fail "put failed" 152 ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 || fail "put failed"
153cmp $DATA ${COPY} || fail "corrupted copy after put" 153cmp $DATA ${COPY} || fail "corrupted copy after put"
154 154
155if [ "$os" != "cygwin" ]; then 155if [ "$os" != "cygwin" ]; then
156rm -f ${QUOTECOPY} 156rm -f ${QUOTECOPY}
157verbose "$tid: put filename with quotes" 157verbose "$tid: put filename with quotes"
158echo "put $DATA \"$QUOTECOPY_ARG\"" | \ 158echo "put $DATA \"$QUOTECOPY_ARG\"" | \
159 ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 || fail "put failed" 159 ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 || fail "put failed"
160cmp $DATA ${QUOTECOPY} || fail "corrupted copy after put with quotes" 160cmp $DATA ${QUOTECOPY} || fail "corrupted copy after put with quotes"
161fi 161fi
162 162
163rm -f "$SPACECOPY" 163rm -f "$SPACECOPY"
164verbose "$tid: put filename with spaces" 164verbose "$tid: put filename with spaces"
165echo "put $DATA ${SPACECOPY_ARG}" | \ 165echo "put $DATA ${SPACECOPY_ARG}" | \
166 ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 || fail "put failed" 166 ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 || fail "put failed"
167cmp $DATA "$SPACECOPY" || fail "corrupted copy after put with spaces" 167cmp $DATA "$SPACECOPY" || fail "corrupted copy after put with spaces"
168 168
169rm -f ${COPY}.dd/* 169rm -f ${COPY}.dd/*
170verbose "$tid: put to directory" 170verbose "$tid: put to directory"
171echo "put $DATA ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 171echo "put $DATA ${COPY}.dd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
172 || fail "put failed" 172 || fail "put failed"
173cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after put" 173cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after put"
174 174
175rm -f ${COPY}.dd/* 175rm -f ${COPY}.dd/*
176verbose "$tid: glob put to directory" 176verbose "$tid: glob put to directory"
177echo "put /bin/l? ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 177echo "put /bin/l? ${COPY}.dd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
178 || fail "put failed" 178 || fail "put failed"
179for x in $GLOBFILES; do 179for x in $GLOBFILES; do
180 cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after put" 180 cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after put"
@@ -182,60 +182,61 @@ done
182 182
183rm -f ${COPY}.dd/* 183rm -f ${COPY}.dd/*
184verbose "$tid: put to local dir" 184verbose "$tid: put to local dir"
185(echo "cd ${COPY}.dd"; echo "put $DATA") | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 185(echo "cd ${COPY}.dd"; echo "put $DATA") | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
186 || fail "put failed" 186 || fail "put failed"
187cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after put" 187cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after put"
188 188
189rm -f ${COPY}.dd/* 189rm -f ${COPY}.dd/*
190verbose "$tid: glob put to local dir" 190verbose "$tid: glob put to local dir"
191(echo "cd ${COPY}.dd"; echo "put /bin/l?") | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 191(echo "cd ${COPY}.dd"; echo "put /bin/l?") | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
192 || fail "put failed" 192 || fail "put failed"
193for x in $GLOBFILES; do 193for x in $GLOBFILES; do
194 cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after put" 194 cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after put"
195done 195done
196 196
197verbose "$tid: rename" 197verbose "$tid: rename"
198echo "rename $COPY ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 198echo "rename $COPY ${COPY}.1" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
199 || fail "rename failed" 199 || fail "rename failed"
200test -f ${COPY}.1 || fail "missing file after rename" 200test -f ${COPY}.1 || fail "missing file after rename"
201cmp $DATA ${COPY}.1 >/dev/null 2>&1 || fail "corrupted copy after rename" 201cmp $DATA ${COPY}.1 >/dev/null 2>&1 || fail "corrupted copy after rename"
202 202
203verbose "$tid: rename directory" 203verbose "$tid: rename directory"
204echo "rename ${COPY}.dd ${COPY}.dd2" | \ 204echo "rename ${COPY}.dd ${COPY}.dd2" | \
205 ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 || \ 205 ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 || \
206 fail "rename directory failed" 206 fail "rename directory failed"
207test -d ${COPY}.dd && fail "oldname exists after rename directory" 207test -d ${COPY}.dd && fail "oldname exists after rename directory"
208test -d ${COPY}.dd2 || fail "missing newname after rename directory" 208test -d ${COPY}.dd2 || fail "missing newname after rename directory"
209 209
210verbose "$tid: ln" 210verbose "$tid: ln"
211echo "ln ${COPY}.1 ${COPY}.2" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 || fail "ln failed" 211echo "ln ${COPY}.1 ${COPY}.2" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 || fail "ln failed"
212test -h ${COPY}.2 || fail "missing file after ln" 212test -h ${COPY}.2 || fail "missing file after ln"
213 213
214verbose "$tid: mkdir" 214verbose "$tid: mkdir"
215echo "mkdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 215echo "mkdir ${COPY}.dd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
216 || fail "mkdir failed" 216 || fail "mkdir failed"
217test -d ${COPY}.dd || fail "missing directory after mkdir" 217test -d ${COPY}.dd || fail "missing directory after mkdir"
218 218
219# XXX do more here 219# XXX do more here
220verbose "$tid: chdir" 220verbose "$tid: chdir"
221echo "chdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 221echo "chdir ${COPY}.dd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
222 || fail "chdir failed" 222 || fail "chdir failed"
223 223
224verbose "$tid: rmdir" 224verbose "$tid: rmdir"
225echo "rmdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 225echo "rmdir ${COPY}.dd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
226 || fail "rmdir failed" 226 || fail "rmdir failed"
227test -d ${COPY}.1 && fail "present directory after rmdir" 227test -d ${COPY}.1 && fail "present directory after rmdir"
228 228
229verbose "$tid: lmkdir" 229verbose "$tid: lmkdir"
230echo "lmkdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 230echo "lmkdir ${COPY}.dd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
231 || fail "lmkdir failed" 231 || fail "lmkdir failed"
232test -d ${COPY}.dd || fail "missing directory after lmkdir" 232test -d ${COPY}.dd || fail "missing directory after lmkdir"
233 233
234# XXX do more here 234# XXX do more here
235verbose "$tid: lchdir" 235verbose "$tid: lchdir"
236echo "lchdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 236echo "lchdir ${COPY}.dd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
237 || fail "lchdir failed" 237 || fail "lchdir failed"
238 238
239rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${COPY}.dd2 239rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${COPY}.dd2 ${BATCH}.*
240rm -rf ${QUOTECOPY} "$SPACECOPY" "$GLOBMETACOPY" 240rm -rf ${QUOTECOPY} "$SPACECOPY" "$GLOBMETACOPY"
241 241
242