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