From 1be2cc44961177897c3380ed7a8ec3641d5fd8ad Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Tue, 9 Dec 2008 14:11:49 +1100 Subject: - djm@cvs.openbsd.org 2008/12/09 02:39:59 [sftp.c] Deal correctly with failures in remote stat() operation in sftp, correcting fail-on-error behaviour in batchmode. bz#1541 report and fix from anedvedicky AT gmail.com; ok markus@ --- sftp.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'sftp.c') diff --git a/sftp.c b/sftp.c index e1aa49d0f..4e3c833f7 100644 --- a/sftp.c +++ b/sftp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sftp.c,v 1.103 2008/07/13 22:16:03 djm Exp $ */ +/* $OpenBSD: sftp.c,v 1.104 2008/12/09 02:39:59 djm Exp $ */ /* * Copyright (c) 2001-2004 Damien Miller * @@ -1386,17 +1386,19 @@ parse_dispatch_command(struct sftp_conn *conn, const char *cmd, char **pwd, remote_glob(conn, path1, GLOB_NOCHECK, NULL, &g); for (i = 0; g.gl_pathv[i] && !interrupted; i++) { if (!(aa = do_stat(conn, g.gl_pathv[i], 0))) { - if (err != 0 && err_abort) + if (err_abort) { + err = -1; break; - else + } else continue; } if (!(aa->flags & SSH2_FILEXFER_ATTR_UIDGID)) { error("Can't get current ownership of " "remote file \"%s\"", g.gl_pathv[i]); - if (err != 0 && err_abort) + if (err_abort) { + err = -1; break; - else + } else continue; } aa->flags &= SSH2_FILEXFER_ATTR_UIDGID; -- cgit v1.2.3 From 7ebfad789f4e739cf5269860722cd44aab2929fb Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Tue, 9 Dec 2008 14:12:33 +1100 Subject: - djm@cvs.openbsd.org 2008/12/09 03:02:37 [sftp.1 sftp.c] correct sftp(1) and corresponding usage syntax; bz#1518 patch from imorgan AT nas.nasa.gov; ok deraadt@ improved diff jmc@ --- ChangeLog | 6 +++++- sftp.1 | 13 ++++++------- sftp.c | 6 +++--- 3 files changed, 14 insertions(+), 11 deletions(-) (limited to 'sftp.c') diff --git a/ChangeLog b/ChangeLog index ab50a006a..93e72b3cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,10 @@ failure; avoids double-free in ~C -L handler when given an invalid forwarding specification; bz#1539 report from adejong AT debian.org via Colin Watson; ok markus@ dtucker@ + - djm@cvs.openbsd.org 2008/12/09 03:02:37 + [sftp.1 sftp.c] + correct sftp(1) and corresponding usage syntax; + bz#1518 patch from imorgan AT nas.nasa.gov; ok deraadt@ improved diff jmc@ 20081208 - (djm) [configure.ac] bz#1538: better test for ProPolice/SSP: actually @@ -4985,5 +4989,5 @@ OpenServer 6 and add osr5bigcrypt support so when someone migrates passwords between UnixWare and OpenServer they will still work. OK dtucker@ -$Id: ChangeLog,v 1.5154 2008/12/09 03:12:05 djm Exp $ +$Id: ChangeLog,v 1.5155 2008/12/09 03:12:33 djm Exp $ diff --git a/sftp.1 b/sftp.1 index b4f9a6884..c44564a29 100644 --- a/sftp.1 +++ b/sftp.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: sftp.1,v 1.67 2008/07/15 02:23:14 djm Exp $ +.\" $OpenBSD: sftp.1,v 1.68 2008/12/09 03:02:37 djm Exp $ .\" .\" Copyright (c) 2001 Damien Miller. All rights reserved. .\" @@ -22,7 +22,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: July 15 2008 $ +.Dd $Mdocdate: December 9 2008 $ .Dt SFTP 1 .Os .Sh NAME @@ -43,13 +43,12 @@ .Ar host .Ek .Nm sftp -.Oo Oo Ar user Ns @ Oc Ns -.Ar host Ns Oo : Ns Ar file Oo -.Ar file Oc Oc Oc +.Oo Ar user Ns @ Oc Ns +.Ar host Ns Op : Ns Ar .Nm sftp -.Oo Oo Ar user Ns @ Oc Ns +.Oo Ar user Ns @ Oc Ns .Ar host Ns Oo : Ns Ar dir Ns -.Oo Ar / Oc Oc Oc +.Oo Ar / Oc Oc .Nm sftp .Fl b Ar batchfile .Oo Ar user Ns @ Oc Ns Ar host diff --git a/sftp.c b/sftp.c index 4e3c833f7..4d37f8569 100644 --- a/sftp.c +++ b/sftp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sftp.c,v 1.104 2008/12/09 02:39:59 djm Exp $ */ +/* $OpenBSD: sftp.c,v 1.105 2008/12/09 03:04:39 djm Exp $ */ /* * Copyright (c) 2001-2004 Damien Miller * @@ -1670,8 +1670,8 @@ usage(void) "usage: %s [-1Cv] [-B buffer_size] [-b batchfile] [-F ssh_config]\n" " [-o ssh_option] [-P sftp_server_path] [-R num_requests]\n" " [-S program] [-s subsystem | sftp_server] host\n" - " %s [[user@]host[:file [file]]]\n" - " %s [[user@]host[:dir[/]]]\n" + " %s [user@]host[:file ...]\n" + " %s [user@]host[:dir[/]]\n" " %s -b batchfile [user@]host\n", __progname, __progname, __progname, __progname); exit(1); } -- cgit v1.2.3 From 62fd18a2b7e840fa3b961dafefae4ffdc5efeba6 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Wed, 28 Jan 2009 16:14:09 +1100 Subject: - sobrado@cvs.openbsd.org 2008/12/09 15:35:00 [sftp.1 sftp.c] update for the synopses displayed by the 'help' command, there are a few missing flags; add 'bye' to the output of 'help'; sorting and spacing. jmc@ suggested replacing .Oo/.Oc with a single .Op macro. ok jmc@ --- ChangeLog | 8 +++++++- sftp.1 | 6 +++--- sftp.c | 63 ++++++++++++++++++++++++++++++++------------------------------- 3 files changed, 42 insertions(+), 35 deletions(-) (limited to 'sftp.c') diff --git a/ChangeLog b/ChangeLog index 066930714..f3a1b0033 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,12 @@ - djm@cvs.openbsd.org 2008/12/09 04:32:22 [auth2-chall.c] replace by-hand string building with xasprinf(); ok deraadt@ + - sobrado@cvs.openbsd.org 2008/12/09 15:35:00 + [sftp.1 sftp.c] + update for the synopses displayed by the 'help' command, there are a + few missing flags; add 'bye' to the output of 'help'; sorting and spacing. + jmc@ suggested replacing .Oo/.Oc with a single .Op macro. + ok jmc@ 20090107 - (djm) [uidswap.c] bz#1412: Support >16 supplemental groups in OS X. @@ -5017,5 +5023,5 @@ OpenServer 6 and add osr5bigcrypt support so when someone migrates passwords between UnixWare and OpenServer they will still work. OK dtucker@ -$Id: ChangeLog,v 1.5162 2009/01/28 05:13:39 djm Exp $ +$Id: ChangeLog,v 1.5163 2009/01/28 05:14:09 djm Exp $ diff --git a/sftp.1 b/sftp.1 index c44564a29..37ccb3a38 100644 --- a/sftp.1 +++ b/sftp.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: sftp.1,v 1.68 2008/12/09 03:02:37 djm Exp $ +.\" $OpenBSD: sftp.1,v 1.69 2008/12/09 15:35:00 sobrado Exp $ .\" .\" Copyright (c) 2001 Damien Miller. All rights reserved. .\" @@ -48,7 +48,7 @@ .Nm sftp .Oo Ar user Ns @ Oc Ns .Ar host Ns Oo : Ns Ar dir Ns -.Oo Ar / Oc Oc +.Op Ar / Oc .Nm sftp .Fl b Ar batchfile .Oo Ar user Ns @ Oc Ns Ar host @@ -441,7 +441,7 @@ to Display the .Nm protocol version. -.It Ic \&! Ar command +.It Ic \&! Ns Ar command Execute .Ar command in local shell. diff --git a/sftp.c b/sftp.c index 4d37f8569..01077a7a7 100644 --- a/sftp.c +++ b/sftp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sftp.c,v 1.105 2008/12/09 03:04:39 djm Exp $ */ +/* $OpenBSD: sftp.c,v 1.106 2008/12/09 15:35:00 sobrado Exp $ */ /* * Copyright (c) 2001-2004 Damien Miller * @@ -207,36 +207,37 @@ cmd_interrupt(int signo) static void help(void) { - printf("Available commands:\n"); - printf("cd path Change remote directory to 'path'\n"); - printf("lcd path Change local directory to 'path'\n"); - printf("chgrp grp path Change group of file 'path' to 'grp'\n"); - printf("chmod mode path Change permissions of file 'path' to 'mode'\n"); - printf("chown own path Change owner of file 'path' to 'own'\n"); - printf("df [path] Display statistics for current directory or\n"); - printf(" filesystem containing 'path'\n"); - printf("help Display this help text\n"); - printf("get remote-path [local-path] Download file\n"); - printf("lls [ls-options [path]] Display local directory listing\n"); - printf("ln oldpath newpath Symlink remote file\n"); - printf("lmkdir path Create local directory\n"); - printf("lpwd Print local working directory\n"); - printf("ls [path] Display remote directory listing\n"); - printf("lumask umask Set local umask to 'umask'\n"); - printf("mkdir path Create remote directory\n"); - printf("progress Toggle display of progress meter\n"); - printf("put local-path [remote-path] Upload file\n"); - printf("pwd Display remote working directory\n"); - printf("exit Quit sftp\n"); - printf("quit Quit sftp\n"); - printf("rename oldpath newpath Rename remote file\n"); - printf("rmdir path Remove remote directory\n"); - printf("rm path Delete remote file\n"); - printf("symlink oldpath newpath Symlink remote file\n"); - printf("version Show SFTP version\n"); - printf("!command Execute 'command' in local shell\n"); - printf("! Escape to local shell\n"); - printf("? Synonym for help\n"); + printf("Available commands:\n" + "bye Quit sftp\n" + "cd path Change remote directory to 'path'\n" + "chgrp grp path Change group of file 'path' to 'grp'\n" + "chmod mode path Change permissions of file 'path' to 'mode'\n" + "chown own path Change owner of file 'path' to 'own'\n" + "df [-hi] [path] Display statistics for current directory or\n" + " filesystem containing 'path'\n" + "exit Quit sftp\n" + "get [-P] remote-path [local-path] Download 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" + "lmkdir path Create local directory\n" + "ln oldpath newpath Symlink remote file\n" + "lpwd Print local working directory\n" + "ls [-1aflnrSt] [path] Display remote directory listing\n" + "lumask umask Set local umask to 'umask'\n" + "mkdir path Create remote directory\n" + "progress Toggle display of progress meter\n" + "put [-P] local-path [remote-path] Upload file\n" + "pwd Display remote working directory\n" + "quit Quit sftp\n" + "rename oldpath newpath Rename remote file\n" + "rm path Delete remote file\n" + "rmdir path Remove remote directory\n" + "symlink oldpath newpath Symlink remote file\n" + "version Show SFTP version\n" + "!command Execute 'command' in local shell\n" + "! Escape to local shell\n" + "? Synonym for help\n"); } static void -- cgit v1.2.3 From fdd66fc750228b5d040c45bc36565299374b72c8 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Sat, 14 Feb 2009 16:26:19 +1100 Subject: - dtucker@cvs.openbsd.org 2009/02/02 11:15:14 [sftp.c] Initialize a few variables to prevent spurious "may be used uninitialized" warnings from newer gcc's. ok djm@ --- ChangeLog | 11 +++++++++-- sftp.c | 6 +++--- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'sftp.c') diff --git a/ChangeLog b/ChangeLog index 124924b71..cdcd1aced 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,11 @@ -20090205 +20090214 + - (djm) OpenBSD CVS Sync + - dtucker@cvs.openbsd.org 2009/02/02 11:15:14 + [sftp.c] + Initialize a few variables to prevent spurious "may be used + uninitialized" warnings from newer gcc's. ok djm@ + +20090212 - (djm) [sshpty.c] bz#1419: OSX uses cloning ptys that automagically set ownership and modes, so avoid explicitly setting them - (djm) [configure.ac loginrec.c] bz#1421: fix lastlog support for OSX. @@ -5123,5 +5130,5 @@ OpenServer 6 and add osr5bigcrypt support so when someone migrates passwords between UnixWare and OpenServer they will still work. OK dtucker@ -$Id: ChangeLog,v 1.5185 2009/02/12 02:12:21 djm Exp $ +$Id: ChangeLog,v 1.5186 2009/02/14 05:26:19 djm Exp $ diff --git a/sftp.c b/sftp.c index 01077a7a7..66bd111b1 100644 --- a/sftp.c +++ b/sftp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sftp.c,v 1.106 2008/12/09 15:35:00 sobrado Exp $ */ +/* $OpenBSD: sftp.c,v 1.107 2009/02/02 11:15:14 dtucker Exp $ */ /* * Copyright (c) 2001-2004 Damien Miller * @@ -1235,8 +1235,8 @@ parse_dispatch_command(struct sftp_conn *conn, const char *cmd, char **pwd, int err_abort) { char *path1, *path2, *tmp; - int pflag, lflag, iflag, hflag, cmdnum, i; - unsigned long n_arg; + int pflag = 0, lflag = 0, iflag = 0, hflag = 0, cmdnum, i; + unsigned long n_arg = 0; Attrib a, *aa; char path_buf[MAXPATHLEN]; int err = 0; -- cgit v1.2.3