aboutsummaryrefslogtreecommitdiff
path: root/sftp.c
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2015-07-02 13:15:34 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2015-07-02 13:15:34 +0000
commitc1e0861503468de5ae00ed0e532f349ec78bec68 (patch)
tree14de9b5b2b4cbd1116ed28f9b7189c866585b230 /sftp.c
parentc0bbca73c6f7f15d5401332151fc9f9755abaf8f (diff)
downloadsrc-c1e0861503468de5ae00ed0e532f349ec78bec68.tar.gz
src-c1e0861503468de5ae00ed0e532f349ec78bec68.zip
Vendor import of OpenSSH 6.8p1.vendor/openssh/6.8p1
Notes
Notes: svn path=/vendor-crypto/openssh/dist/; revision=285031 svn path=/vendor-crypto/openssh/6.8p1/; revision=285032; tag=vendor/openssh/6.8p1
Diffstat (limited to 'sftp.c')
-rw-r--r--sftp.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/sftp.c b/sftp.c
index ff4d63d5ca6b..cb9b967edc99 100644
--- a/sftp.c
+++ b/sftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp.c,v 1.164 2014/07/09 01:45:10 djm Exp $ */
+/* $OpenBSD: sftp.c,v 1.170 2015/01/20 23:14:00 deraadt Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
*
@@ -17,6 +17,7 @@
#include "includes.h"
+#include <sys/param.h> /* MIN MAX */
#include <sys/types.h>
#include <sys/ioctl.h>
#ifdef HAVE_SYS_STAT_H
@@ -46,6 +47,7 @@
#else
typedef void EditLine;
#endif
+#include <limits.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
@@ -63,7 +65,8 @@ typedef void EditLine;
#include "misc.h"
#include "sftp.h"
-#include "buffer.h"
+#include "ssherr.h"
+#include "sshbuf.h"
#include "sftp-common.h"
#include "sftp-client.h"
@@ -202,7 +205,7 @@ static const struct CMD cmds[] = {
{ "quit", I_QUIT, NOARGS },
{ "reget", I_REGET, REMOTE },
{ "rename", I_RENAME, REMOTE },
- { "reput", I_REPUT, LOCAL },
+ { "reput", I_REPUT, LOCAL },
{ "rm", I_RM, REMOTE },
{ "rmdir", I_RMDIR, REMOTE },
{ "symlink", I_SYMLINK, REMOTE },
@@ -250,9 +253,9 @@ help(void)
"df [-hi] [path] Display statistics for current directory or\n"
" filesystem containing 'path'\n"
"exit Quit sftp\n"
- "get [-Ppr] remote [local] Download file\n"
- "reget remote [local] Resume download file\n"
- "reput [local] remote Resume upload file\n"
+ "get [-afPpRr] remote [local] Download file\n"
+ "reget [-fPpRr] remote [local] Resume download file\n"
+ "reput [-fPpRr] [local] remote Resume upload file\n"
"help Display this help text\n"
"lcd path Change local directory to 'path'\n"
"lls [ls-options [path]] Display local directory listing\n"
@@ -263,7 +266,7 @@ help(void)
"lumask umask Set local umask to 'umask'\n"
"mkdir path Create remote directory\n"
"progress Toggle display of progress meter\n"
- "put [-Ppr] local [remote] Upload file\n"
+ "put [-afPpRr] local [remote] Upload file\n"
"pwd Display remote working directory\n"
"quit Quit sftp\n"
"rename oldpath newpath Rename remote file\n"
@@ -1400,7 +1403,7 @@ parse_dispatch_command(struct sftp_conn *conn, const char *cmd, char **pwd,
int cmdnum, i;
unsigned long n_arg = 0;
Attrib a, *aa;
- char path_buf[MAXPATHLEN];
+ char path_buf[PATH_MAX];
int err = 0;
glob_t g;
@@ -1519,6 +1522,9 @@ parse_dispatch_command(struct sftp_conn *conn, const char *cmd, char **pwd,
err = do_df(conn, path1, hflag, iflag);
break;
case I_LCHDIR:
+ tmp = tilde_expand_filename(path1, getuid());
+ free(path1);
+ path1 = tmp;
if (chdir(path1) == -1) {
error("Couldn't change local directory to "
"\"%s\": %s", path1, strerror(errno));
@@ -2081,8 +2087,8 @@ interactive_loop(struct sftp_conn *conn, char *file1, char *file2)
free(dir);
}
- setlinebuf(stdout);
- setlinebuf(infile);
+ setvbuf(stdout, NULL, _IOLBF, 0);
+ setvbuf(infile, NULL, _IOLBF, 0);
interactive = !batchmode && isatty(STDIN_FILENO);
err = 0;