summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2007-12-12 05:04:04 +0000
committerDamien Miller <djm@cvs.openbsd.org>2007-12-12 05:04:04 +0000
commit7d6a02d621e2c4a5834c8a691f726cc4731be772 (patch)
treeb22d5f8ca11342251c24bf779b212b2b7bbb2c7d
parentf7124ff7ff0ecddc526f55e537660e9ed319dbee (diff)
unbreak lls command and add a regress test that would have caught the
breakage; spotted by mouring@
-rw-r--r--regress/usr.bin/ssh/sftp-cmds.sh11
-rw-r--r--usr.bin/ssh/sftp.c4
2 files changed, 10 insertions, 5 deletions
diff --git a/regress/usr.bin/ssh/sftp-cmds.sh b/regress/usr.bin/ssh/sftp-cmds.sh
index 9414573e60c..152553799a6 100644
--- a/regress/usr.bin/ssh/sftp-cmds.sh
+++ b/regress/usr.bin/ssh/sftp-cmds.sh
@@ -1,4 +1,4 @@
-# $OpenBSD: sftp-cmds.sh,v 1.8 2007/10/24 03:32:35 djm Exp $
+# $OpenBSD: sftp-cmds.sh,v 1.9 2007/12/12 05:04:03 djm Exp $
# Placed in the Public Domain.
# XXX - TODO:
@@ -24,9 +24,12 @@ 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 \
- || fail "lls failed"
-# XXX always successful
+echo "cd ${OBJ}\nlls" | ${SFTP} -P ${SFTPSERVER} 2>&1 | \
+ grep -q copy.dd || fail "lls failed"
+
+verbose "$tid: lls w/path"
+echo "lls ${OBJ}" | ${SFTP} -P ${SFTPSERVER} 2>&1 | \
+ grep -q copy.dd || fail "lls w/path failed"
verbose "$tid: ls"
echo "ls ${OBJ}" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
diff --git a/usr.bin/ssh/sftp.c b/usr.bin/ssh/sftp.c
index 942b85ca613..7f31ebcffea 100644
--- a/usr.bin/ssh/sftp.c
+++ b/usr.bin/ssh/sftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp.c,v 1.97 2007/10/24 03:30:02 djm Exp $ */
+/* $OpenBSD: sftp.c,v 1.98 2007/12/12 05:04:03 djm Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
*
@@ -1068,6 +1068,8 @@ parse_args(const char **cpp, int *pflag, int *lflag, int *iflag,
*path1 = xstrdup(argv[optidx]);
break;
case I_LLS:
+ /* Skip ls command and following whitespace */
+ cp = cp + strlen(cmd) + strspn(cp, WHITESPACE);
case I_SHELL:
/* Uses the rest of the line */
break;