]> andersk Git - openssh.git/blame - regress/sftp-badcmds.sh
- (dtucker) [regress/test-exec.sh] Bug #912: Set _POSIX2_VERSION for the
[openssh.git] / regress / sftp-badcmds.sh
CommitLineData
1d6c0b69 1# $OpenBSD: sftp-badcmds.sh,v 1.2 2003/05/15 04:07:12 mouring Exp $
2# Placed in the Public Domain.
3
4tid="sftp invalid commands"
5
83d96134 6DATA=/bin/ls${EXEEXT}
006cb311 7DATA2=/bin/sh${EXEEXT}
1d6c0b69 8NONEXIST=/NONEXIST.$$
9COPY=${OBJ}/copy
10GLOBFILES=`(cd /bin;echo l*)`
11
2b1bb684 12rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd
1d6c0b69 13
14rm -f ${COPY}
15verbose "$tid: get nonexistent"
16echo "get $NONEXIST $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
17 || fail "get nonexistent failed"
18test -f ${COPY} && fail "existing copy after get nonexistent"
19
20rm -f ${COPY}.dd/*
21verbose "$tid: glob get to nonexistent directory"
22echo "get /bin/l* $NONEXIST" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
23 || fail "get nonexistent failed"
24for x in $GLOBFILES; do
25 test -f ${COPY}.dd/$x && fail "existing copy after get nonexistent"
26done
27
28rm -f ${COPY}
29verbose "$tid: put nonexistent"
30echo "put $NONEXIST $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
31 || fail "put nonexistent failed"
32test -f ${COPY} && fail "existing copy after put nonexistent"
33
34rm -f ${COPY}.dd/*
35verbose "$tid: glob put to nonexistent directory"
36echo "put /bin/l* ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
37 || fail "put nonexistent failed"
38for x in $GLOBFILES; do
39 test -f ${COPY}.dd/$x && fail "existing copy after nonexistent"
40done
41
42rm -f ${COPY}
43verbose "$tid: rename nonexistent"
44echo "rename $NONEXIST ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
45 || fail "rename nonexist failed"
46test -f ${COPY}.1 && fail "file exists after rename nonexistent"
47
48rm -f ${COPY} ${COPY}.1
49cp $DATA $COPY
50cp $DATA2 ${COPY}.1
51verbose "$tid: rename target exists"
52echo "rename $COPY ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
53 || fail "rename target exists failed"
54test -f ${COPY} || fail "oldname missing after rename target exists"
55test -f ${COPY}.1 || fail "newname missing after rename target exists"
56cmp $DATA ${COPY} >/dev/null 2>&1 || fail "corrupted oldname after rename target exists"
57cmp $DATA2 ${COPY}.1 >/dev/null 2>&1 || fail "corrupted newname after rename target exists"
58
59rm -rf ${COPY} ${COPY}.dd
60cp $DATA $COPY
61mkdir ${COPY}.dd
62verbose "$tid: rename target exists (directory)"
63echo "rename $COPY ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
64 || fail "rename target exists (directory) failed"
65test -f ${COPY} || fail "oldname missing after rename target exists (directory)"
66test -d ${COPY}.dd || fail "newname missing after rename target exists (directory)"
67cmp $DATA ${COPY} >/dev/null 2>&1 || fail "corrupted oldname after rename target exists (directory)"
68
69rm -f ${COPY}.dd/*
70rm -rf ${COPY}
71cp ${DATA2} ${COPY}
72verbose "$tid: glob put files to local file"
73echo "put /bin/l* $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1
74cmp ${DATA2} ${COPY} || fail "put successed when it should have failed"
75
2b1bb684 76rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd
1d6c0b69 77
78
This page took 0.177726 seconds and 5 git commands to generate.