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.sh62
1 files changed, 59 insertions, 3 deletions
diff --git a/regress/sftp-cmds.sh b/regress/sftp-cmds.sh
index 987887ff0..b86712f47 100644
--- a/regress/sftp-cmds.sh
+++ b/regress/sftp-cmds.sh
@@ -1,8 +1,7 @@
1# $OpenBSD: sftp-cmds.sh,v 1.3 2003/04/04 09:34:22 djm Exp $ 1# $OpenBSD: sftp-cmds.sh,v 1.4 2003/05/15 04:07:12 mouring Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4# XXX - TODO: 4# XXX - TODO:
5# - globbed operations
6# - chmod / chown / chgrp 5# - chmod / chown / chgrp
7# - -p flag for get & put 6# - -p flag for get & put
8 7
@@ -10,8 +9,10 @@ tid="sftp commands"
10 9
11DATA=/bin/ls 10DATA=/bin/ls
12COPY=${OBJ}/copy 11COPY=${OBJ}/copy
12GLOBFILES=`(cd /bin;echo l*)`
13 13
14rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${COPY}.dd2 ${BATCH}.* 14rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${COPY}.dd2 ${BATCH}.*
15mkdir ${COPY}.dd
15 16
16verbose "$tid: lls" 17verbose "$tid: lls"
17echo "lls ${OBJ}" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 18echo "lls ${OBJ}" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
@@ -54,19 +55,74 @@ echo "get $DATA $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
54 || fail "get failed" 55 || fail "get failed"
55cmp $DATA ${COPY} || fail "corrupted copy after get" 56cmp $DATA ${COPY} || fail "corrupted copy after get"
56 57
58rm -f ${COPY}.dd/*
59verbose "$tid: get to directory"
60echo "get $DATA ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
61 || fail "get failed"
62cmp $DATA ${COPY}.dd/ls || fail "corrupted copy after get"
63
64rm -f ${COPY}.dd/*
65verbose "$tid: glob get to directory"
66echo "get /bin/l* ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
67 || fail "get failed"
68for x in $GLOBFILES; do
69 cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after get"
70done
71
72rm -f ${COPY}.dd/*
73verbose "$tid: get to local dir"
74echo "lcd ${COPY}.dd\nget $DATA" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
75 || fail "get failed"
76cmp $DATA ${COPY}.dd/ls || fail "corrupted copy after get"
77
78rm -f ${COPY}.dd/*
79verbose "$tid: glob get to local dir"
80echo "lcd ${COPY}.dd\nget /bin/l*" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
81 || fail "get failed"
82for x in $GLOBFILES; do
83 cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after get"
84done
85
57rm -f ${COPY} 86rm -f ${COPY}
58verbose "$tid: put" 87verbose "$tid: put"
59echo "put $DATA $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 88echo "put $DATA $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
60 || fail "put failed" 89 || fail "put failed"
61cmp $DATA ${COPY} || fail "corrupted copy after put" 90cmp $DATA ${COPY} || fail "corrupted copy after put"
62 91
92rm -f ${COPY}.dd/*
93verbose "$tid: put to directory"
94echo "put $DATA ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
95 || fail "put failed"
96cmp $DATA ${COPY}.dd/ls || fail "corrupted copy after put"
97
98rm -f ${COPY}.dd/*
99verbose "$tid: glob put to directory"
100echo "put /bin/l* ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
101 || fail "put failed"
102for x in $GLOBFILES; do
103 cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after put"
104done
105
106rm -f ${COPY}.dd/*
107verbose "$tid: put to local dir"
108echo "cd ${COPY}.dd\nput $DATA" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
109 || fail "put failed"
110cmp $DATA ${COPY}.dd/ls || fail "corrupted copy after put"
111
112rm -f ${COPY}.dd/*
113verbose "$tid: glob put to local dir"
114echo "cd ${COPY}.dd\nput /bin/l*" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
115 || fail "put failed"
116for x in $GLOBFILES; do
117 cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after put"
118done
119
63verbose "$tid: rename" 120verbose "$tid: rename"
64echo "rename $COPY ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 121echo "rename $COPY ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
65 || fail "rename failed" 122 || fail "rename failed"
66test -f ${COPY}.1 || fail "missing file after rename" 123test -f ${COPY}.1 || fail "missing file after rename"
67cmp $DATA ${COPY}.1 >/dev/null 2>&1 || fail "corrupted copy after rename" 124cmp $DATA ${COPY}.1 >/dev/null 2>&1 || fail "corrupted copy after rename"
68 125
69mkdir ${COPY}.dd
70verbose "$tid: rename directory" 126verbose "$tid: rename directory"
71echo "rename ${COPY}.dd ${COPY}.dd2" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 127echo "rename ${COPY}.dd ${COPY}.dd2" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
72 || fail "rename directory failed" 128 || fail "rename directory failed"