summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2009-10-07 10:43:57 +1100
committerDarren Tucker <dtucker@zip.com.au>2009-10-07 10:43:57 +1100
commited6b0c5fc21807ff771a499fd042a24f963f7291 (patch)
tree872b22ff1070a261ce0e9b036100466609c1da56 /regress
parent287b9329c5fc2e1a177f9608209a35a6c5bf852a (diff)
- djm@cvs.openbsd.org 2009/08/13 01:11:55
[sftp-batch.sh sftp-badcmds.sh sftp.sh sftp-cmds.sh sftp-glob.sh] date: 2009/08/13 01:11:19; author: djm; state: Exp; lines: +10 -7 Swizzle options: "-P sftp_server_path" moves to "-D sftp_server_path", add "-P port" to match scp(1). Fortunately, the -P option is only really used by our regression scripts. part of larger patch from carlosvsilvapt@gmail.com for his Google Summer of Code work; ok deraadt markus
Diffstat (limited to 'regress')
-rw-r--r--regress/sftp-badcmds.sh16
-rw-r--r--regress/sftp-batch.sh10
-rw-r--r--regress/sftp-cmds.sh73
-rw-r--r--regress/sftp-glob.sh4
-rw-r--r--regress/sftp.sh6
5 files changed, 55 insertions, 54 deletions
diff --git a/regress/sftp-badcmds.sh b/regress/sftp-badcmds.sh
index b48b1cb01..08009f26b 100644
--- a/regress/sftp-badcmds.sh
+++ b/regress/sftp-badcmds.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: sftp-badcmds.sh,v 1.3 2008/03/24 21:46:54 djm Exp $ 1# $OpenBSD: sftp-badcmds.sh,v 1.4 2009/08/13 01:11:55 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="sftp invalid commands" 4tid="sftp invalid commands"
@@ -13,13 +13,13 @@ rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd
13 13
14rm -f ${COPY} 14rm -f ${COPY}
15verbose "$tid: get nonexistent" 15verbose "$tid: get nonexistent"
16echo "get $NONEXIST $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 16echo "get $NONEXIST $COPY" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
17 || fail "get nonexistent failed" 17 || fail "get nonexistent failed"
18test -f ${COPY} && fail "existing copy after get nonexistent" 18test -f ${COPY} && fail "existing copy after get nonexistent"
19 19
20rm -f ${COPY}.dd/* 20rm -f ${COPY}.dd/*
21verbose "$tid: glob get to nonexistent directory" 21verbose "$tid: glob get to nonexistent directory"
22echo "get /bin/l* $NONEXIST" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 22echo "get /bin/l* $NONEXIST" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
23 || fail "get nonexistent failed" 23 || fail "get nonexistent failed"
24for x in $GLOBFILES; do 24for x in $GLOBFILES; do
25 test -f ${COPY}.dd/$x && fail "existing copy after get nonexistent" 25 test -f ${COPY}.dd/$x && fail "existing copy after get nonexistent"
@@ -27,13 +27,13 @@ done
27 27
28rm -f ${COPY} 28rm -f ${COPY}
29verbose "$tid: put nonexistent" 29verbose "$tid: put nonexistent"
30echo "put $NONEXIST $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 30echo "put $NONEXIST $COPY" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
31 || fail "put nonexistent failed" 31 || fail "put nonexistent failed"
32test -f ${COPY} && fail "existing copy after put nonexistent" 32test -f ${COPY} && fail "existing copy after put nonexistent"
33 33
34rm -f ${COPY}.dd/* 34rm -f ${COPY}.dd/*
35verbose "$tid: glob put to nonexistent directory" 35verbose "$tid: glob put to nonexistent directory"
36echo "put /bin/l* ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 36echo "put /bin/l* ${COPY}.dd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
37 || fail "put nonexistent failed" 37 || fail "put nonexistent failed"
38for x in $GLOBFILES; do 38for x in $GLOBFILES; do
39 test -f ${COPY}.dd/$x && fail "existing copy after nonexistent" 39 test -f ${COPY}.dd/$x && fail "existing copy after nonexistent"
@@ -41,7 +41,7 @@ done
41 41
42rm -f ${COPY} 42rm -f ${COPY}
43verbose "$tid: rename nonexistent" 43verbose "$tid: rename nonexistent"
44echo "rename $NONEXIST ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 44echo "rename $NONEXIST ${COPY}.1" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
45 || fail "rename nonexist failed" 45 || fail "rename nonexist failed"
46test -f ${COPY}.1 && fail "file exists after rename nonexistent" 46test -f ${COPY}.1 && fail "file exists after rename nonexistent"
47 47
@@ -49,7 +49,7 @@ rm -rf ${COPY} ${COPY}.dd
49cp $DATA $COPY 49cp $DATA $COPY
50mkdir ${COPY}.dd 50mkdir ${COPY}.dd
51verbose "$tid: rename target exists (directory)" 51verbose "$tid: rename target exists (directory)"
52echo "rename $COPY ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 52echo "rename $COPY ${COPY}.dd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
53 || fail "rename target exists (directory) failed" 53 || fail "rename target exists (directory) failed"
54test -f ${COPY} || fail "oldname missing after rename target exists (directory)" 54test -f ${COPY} || fail "oldname missing after rename target exists (directory)"
55test -d ${COPY}.dd || fail "newname missing after rename target exists (directory)" 55test -d ${COPY}.dd || fail "newname missing after rename target exists (directory)"
@@ -59,7 +59,7 @@ rm -f ${COPY}.dd/*
59rm -rf ${COPY} 59rm -rf ${COPY}
60cp ${DATA2} ${COPY} 60cp ${DATA2} ${COPY}
61verbose "$tid: glob put files to local file" 61verbose "$tid: glob put files to local file"
62echo "put /bin/l* $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 62echo "put /bin/l* $COPY" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1
63cmp ${DATA2} ${COPY} || fail "put successed when it should have failed" 63cmp ${DATA2} ${COPY} || fail "put successed when it should have failed"
64 64
65rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd 65rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd
diff --git a/regress/sftp-batch.sh b/regress/sftp-batch.sh
index 365c47cfc..a51ef0782 100644
--- a/regress/sftp-batch.sh
+++ b/regress/sftp-batch.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: sftp-batch.sh,v 1.3 2004/01/13 09:49:06 djm Exp $ 1# $OpenBSD: sftp-batch.sh,v 1.4 2009/08/13 01:11:55 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="sftp batchfile" 4tid="sftp batchfile"
@@ -37,19 +37,19 @@ cat << EOF > ${BATCH}.fail.2
37EOF 37EOF
38 38
39verbose "$tid: good commands" 39verbose "$tid: good commands"
40${SFTP} -b ${BATCH}.pass.1 -P ${SFTPSERVER} >/dev/null 2>&1 \ 40${SFTP} -b ${BATCH}.pass.1 -D ${SFTPSERVER} >/dev/null 2>&1 \
41 || fail "good commands failed" 41 || fail "good commands failed"
42 42
43verbose "$tid: bad commands" 43verbose "$tid: bad commands"
44${SFTP} -b ${BATCH}.fail.1 -P ${SFTPSERVER} >/dev/null 2>&1 \ 44${SFTP} -b ${BATCH}.fail.1 -D ${SFTPSERVER} >/dev/null 2>&1 \
45 && fail "bad commands succeeded" 45 && fail "bad commands succeeded"
46 46
47verbose "$tid: comments and blanks" 47verbose "$tid: comments and blanks"
48${SFTP} -b ${BATCH}.pass.2 -P ${SFTPSERVER} >/dev/null 2>&1 \ 48${SFTP} -b ${BATCH}.pass.2 -D ${SFTPSERVER} >/dev/null 2>&1 \
49 || fail "comments & blanks failed" 49 || fail "comments & blanks failed"
50 50
51verbose "$tid: junk command" 51verbose "$tid: junk command"
52${SFTP} -b ${BATCH}.fail.2 -P ${SFTPSERVER} >/dev/null 2>&1 \ 52${SFTP} -b ${BATCH}.fail.2 -D ${SFTPSERVER} >/dev/null 2>&1 \
53 && fail "junk command succeeded" 53 && fail "junk command succeeded"
54 54
55rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.* 55rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.*
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
diff --git a/regress/sftp-glob.sh b/regress/sftp-glob.sh
index 60116a748..72bb17d75 100644
--- a/regress/sftp-glob.sh
+++ b/regress/sftp-glob.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: sftp-glob.sh,v 1.3 2007/10/26 05:30:01 djm Exp $ 1# $OpenBSD: sftp-glob.sh,v 1.4 2009/08/13 01:11:55 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="sftp glob" 4tid="sftp glob"
@@ -10,7 +10,7 @@ sftp_ls() {
10 unexpected=$4 10 unexpected=$4
11 verbose "$tid: $errtag" 11 verbose "$tid: $errtag"
12 printf "ls -l %s" "${target}" | \ 12 printf "ls -l %s" "${target}" | \
13 ${SFTP} -b - -P ${SFTPSERVER} 2>/dev/null | \ 13 ${SFTP} -b - -D ${SFTPSERVER} 2>/dev/null | \
14 grep -v "^sftp>" > ${RESULTS} 14 grep -v "^sftp>" > ${RESULTS}
15 if [ $? -ne 0 ]; then 15 if [ $? -ne 0 ]; then
16 fail "$errtag failed" 16 fail "$errtag failed"
diff --git a/regress/sftp.sh b/regress/sftp.sh
index 0e22f8f6b..f84fa6f4e 100644
--- a/regress/sftp.sh
+++ b/regress/sftp.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: sftp.sh,v 1.2 2002/03/27 22:39:52 markus Exp $ 1# $OpenBSD: sftp.sh,v 1.3 2009/08/13 01:11:55 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="basic sftp put/get" 4tid="basic sftp put/get"
@@ -19,8 +19,8 @@ REQUESTS="1 2 10"
19for B in ${BUFFERSIZE}; do 19for B in ${BUFFERSIZE}; do
20 for R in ${REQUESTS}; do 20 for R in ${REQUESTS}; do
21 verbose "test $tid: buffer_size $B num_requests $R" 21 verbose "test $tid: buffer_size $B num_requests $R"
22 rm -f ${COPY}.1 ${COPY}.2 22 rm -f ${COPY}.1 ${COPY}.2
23 ${SFTP} -P ${SFTPSERVER} -B $B -R $R -b $SFTPCMDFILE \ 23 ${SFTP} -D ${SFTPSERVER} -B $B -R $R -b $SFTPCMDFILE \
24 > /dev/null 2>&1 24 > /dev/null 2>&1
25 r=$? 25 r=$?
26 if [ $r -ne 0 ]; then 26 if [ $r -ne 0 ]; then