summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authormouring <mouring@cvs.openbsd.org>2003-05-15 04:07:13 +0000
committermouring <mouring@cvs.openbsd.org>2003-05-15 04:07:13 +0000
commit31ea9a21847cf9d8ab8792bc0cc020820adb30bc (patch)
treeb85a5a2bf90ed9c90e4b2f78a51d3b0a1d401602 /regress
parentbc85a79f945c612127e6bef01f2401aa1d86e084 (diff)
Advanced put/get testing for sftp. OK @djm
Diffstat (limited to 'regress')
-rw-r--r--regress/usr.bin/ssh/sftp-badcmds.sh26
-rw-r--r--regress/usr.bin/ssh/sftp-cmds.sh62
2 files changed, 84 insertions, 4 deletions
diff --git a/regress/usr.bin/ssh/sftp-badcmds.sh b/regress/usr.bin/ssh/sftp-badcmds.sh
index b56e87aebff..ca46909c025 100644
--- a/regress/usr.bin/ssh/sftp-badcmds.sh
+++ b/regress/usr.bin/ssh/sftp-badcmds.sh
@@ -1,4 +1,4 @@
-# $OpenBSD: sftp-badcmds.sh,v 1.1 2003/04/04 09:34:22 djm Exp $
+# $OpenBSD: sftp-badcmds.sh,v 1.2 2003/05/15 04:07:12 mouring Exp $
# Placed in the Public Domain.
tid="sftp invalid commands"
@@ -7,6 +7,7 @@ DATA=/bin/ls
DATA2=/bin/cat
NONEXIST=/NONEXIST.$$
COPY=${OBJ}/copy
+GLOBFILES=`(cd /bin;echo l*)`
rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.*
@@ -16,12 +17,28 @@ echo "get $NONEXIST $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
|| fail "get nonexistent failed"
test -f ${COPY} && fail "existing copy after get nonexistent"
+rm -f ${COPY}.dd/*
+verbose "$tid: glob get to nonexistent directory"
+echo "get /bin/l* $NONEXIST" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
+ || fail "get nonexistent failed"
+for x in $GLOBFILES; do
+ test -f ${COPY}.dd/$x && fail "existing copy after get nonexistent"
+done
+
rm -f ${COPY}
verbose "$tid: put nonexistent"
echo "put $NONEXIST $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
|| fail "put nonexistent failed"
test -f ${COPY} && fail "existing copy after put nonexistent"
+rm -f ${COPY}.dd/*
+verbose "$tid: glob put to nonexistent directory"
+echo "put /bin/l* ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
+ || fail "put nonexistent failed"
+for x in $GLOBFILES; do
+ test -f ${COPY}.dd/$x && fail "existing copy after nonexistent"
+done
+
rm -f ${COPY}
verbose "$tid: rename nonexistent"
echo "rename $NONEXIST ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
@@ -49,6 +66,13 @@ test -f ${COPY} || fail "oldname missing after rename target exists (directory)"
test -d ${COPY}.dd || fail "newname missing after rename target exists (directory)"
cmp $DATA ${COPY} >/dev/null 2>&1 || fail "corrupted oldname after rename target exists (directory)"
+rm -f ${COPY}.dd/*
+rm -rf ${COPY}
+cp ${DATA2} ${COPY}
+verbose "$tid: glob put files to local file"
+echo "put /bin/l* $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1
+cmp ${DATA2} ${COPY} || fail "put successed when it should have failed"
+
rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.*
diff --git a/regress/usr.bin/ssh/sftp-cmds.sh b/regress/usr.bin/ssh/sftp-cmds.sh
index 987887ff0bd..b86712f473d 100644
--- a/regress/usr.bin/ssh/sftp-cmds.sh
+++ b/regress/usr.bin/ssh/sftp-cmds.sh
@@ -1,8 +1,7 @@
-# $OpenBSD: sftp-cmds.sh,v 1.3 2003/04/04 09:34:22 djm Exp $
+# $OpenBSD: sftp-cmds.sh,v 1.4 2003/05/15 04:07:12 mouring Exp $
# Placed in the Public Domain.
# XXX - TODO:
-# - globbed operations
# - chmod / chown / chgrp
# - -p flag for get & put
@@ -10,8 +9,10 @@ tid="sftp commands"
DATA=/bin/ls
COPY=${OBJ}/copy
+GLOBFILES=`(cd /bin;echo l*)`
rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${COPY}.dd2 ${BATCH}.*
+mkdir ${COPY}.dd
verbose "$tid: lls"
echo "lls ${OBJ}" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
@@ -54,19 +55,74 @@ echo "get $DATA $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
|| fail "get failed"
cmp $DATA ${COPY} || fail "corrupted copy after get"
+rm -f ${COPY}.dd/*
+verbose "$tid: get to directory"
+echo "get $DATA ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
+ || fail "get failed"
+cmp $DATA ${COPY}.dd/ls || fail "corrupted copy after get"
+
+rm -f ${COPY}.dd/*
+verbose "$tid: glob get to directory"
+echo "get /bin/l* ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
+ || fail "get failed"
+for x in $GLOBFILES; do
+ cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after get"
+done
+
+rm -f ${COPY}.dd/*
+verbose "$tid: get to local dir"
+echo "lcd ${COPY}.dd\nget $DATA" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
+ || fail "get failed"
+cmp $DATA ${COPY}.dd/ls || fail "corrupted copy after get"
+
+rm -f ${COPY}.dd/*
+verbose "$tid: glob get to local dir"
+echo "lcd ${COPY}.dd\nget /bin/l*" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
+ || fail "get failed"
+for x in $GLOBFILES; do
+ cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after get"
+done
+
rm -f ${COPY}
verbose "$tid: put"
echo "put $DATA $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
|| fail "put failed"
cmp $DATA ${COPY} || fail "corrupted copy after put"
+rm -f ${COPY}.dd/*
+verbose "$tid: put to directory"
+echo "put $DATA ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
+ || fail "put failed"
+cmp $DATA ${COPY}.dd/ls || fail "corrupted copy after put"
+
+rm -f ${COPY}.dd/*
+verbose "$tid: glob put to directory"
+echo "put /bin/l* ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
+ || fail "put failed"
+for x in $GLOBFILES; do
+ cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after put"
+done
+
+rm -f ${COPY}.dd/*
+verbose "$tid: put to local dir"
+echo "cd ${COPY}.dd\nput $DATA" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
+ || fail "put failed"
+cmp $DATA ${COPY}.dd/ls || fail "corrupted copy after put"
+
+rm -f ${COPY}.dd/*
+verbose "$tid: glob put to local dir"
+echo "cd ${COPY}.dd\nput /bin/l*" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
+ || fail "put failed"
+for x in $GLOBFILES; do
+ cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after put"
+done
+
verbose "$tid: rename"
echo "rename $COPY ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
|| fail "rename failed"
test -f ${COPY}.1 || fail "missing file after rename"
cmp $DATA ${COPY}.1 >/dev/null 2>&1 || fail "corrupted copy after rename"
-mkdir ${COPY}.dd
verbose "$tid: rename directory"
echo "rename ${COPY}.dd ${COPY}.dd2" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
|| fail "rename directory failed"