From 43ce902449abc553e570af717a5eafe689150381 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Tue, 12 Jun 2007 23:41:06 +1000 Subject: - djm@cvs.openbsd.org 2007/06/12 08:24:20 [scp.c] make scp try to skip FIFOs rather than blocking when nothing is listening. depends on the platform supporting sane O_NONBLOCK semantics for open on FIFOs (apparently POSIX does not mandate this), which OpenBSD does. bz #856; report by cjwatson AT debian.org; ok markus@ --- scp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'scp.c') diff --git a/scp.c b/scp.c index a52aaeb12..087e64a42 100644 --- a/scp.c +++ b/scp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scp.c,v 1.156 2007/01/22 13:06:21 djm Exp $ */ +/* $OpenBSD: scp.c,v 1.157 2007/06/12 08:24:20 djm Exp $ */ /* * scp - secure remote copy. This is basically patched BSD rcp which * uses ssh to do the data transfer (instead of using rcmd). @@ -596,12 +596,13 @@ source(int argc, char **argv) name); goto next; } - if ((fd = open(name, O_RDONLY, 0)) < 0) + if ((fd = open(name, O_RDONLY|O_NONBLOCK, 0)) < 0) goto syserr; if (fstat(fd, &stb) < 0) { syserr: run_err("%s: %s", name, strerror(errno)); goto next; } + unset_nonblock(fd); switch (stb.st_mode & S_IFMT) { case S_IFREG: break; -- cgit v1.2.3 From bed63112f5a1f52b255f03bc2f457eaab5001e0c Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Wed, 13 Jun 2007 00:02:07 +1000 Subject: - dtucker@cvs.openbsd.org 2007/06/12 13:54:28 [scp.c] Encode filename with strnvis if the name contains a newline (which can't be represented in the scp protocol), from bz #891. ok markus@ --- ChangeLog | 6 +++++- scp.c | 16 +++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'scp.c') diff --git a/ChangeLog b/ChangeLog index a962cfae0..9cbab13e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -43,6 +43,10 @@ - jmc@cvs.openbsd.org 2007/06/12 13:43:55 [ssh.1] add -K to SYNOPSIS; + - dtucker@cvs.openbsd.org 2007/06/12 13:54:28 + [scp.c] + Encode filename with strnvis if the name contains a newline (which can't + be represented in the scp protocol), from bz #891. ok markus@ 20070611 - (djm) Bugzilla #1306: silence spurious error messages from hang-on-exit @@ -3057,4 +3061,4 @@ 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.4698 2007/06/12 14:00:58 dtucker Exp $ +$Id: ChangeLog,v 1.4699 2007/06/12 14:02:07 dtucker Exp $ diff --git a/scp.c b/scp.c index 087e64a42..92a67b733 100644 --- a/scp.c +++ b/scp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scp.c,v 1.157 2007/06/12 08:24:20 djm Exp $ */ +/* $OpenBSD: scp.c,v 1.158 2007/06/12 13:54:28 dtucker Exp $ */ /* * scp - secure remote copy. This is basically patched BSD rcp which * uses ssh to do the data transfer (instead of using rcmd). @@ -96,6 +96,9 @@ #include #include #include +#if defined(HAVE_STRNVIS) && defined(HAVE_VIS_H) +#include +#endif #include "xmalloc.h" #include "atomicio.h" @@ -582,7 +585,7 @@ source(int argc, char **argv) off_t i, amt, statbytes; size_t result; int fd = -1, haderr, indx; - char *last, *name, buf[2048]; + char *last, *name, buf[2048], encname[MAXPATHLEN]; int len; for (indx = 0; indx < argc; ++indx) { @@ -591,13 +594,12 @@ source(int argc, char **argv) len = strlen(name); while (len > 1 && name[len-1] == '/') name[--len] = '\0'; - if (strchr(name, '\n') != NULL) { - run_err("%s: skipping, filename contains a newline", - name); - goto next; - } if ((fd = open(name, O_RDONLY|O_NONBLOCK, 0)) < 0) goto syserr; + if (strchr(name, '\n') != NULL) { + strnvis(encname, name, sizeof(encname), VIS_NL); + name = encname; + } if (fstat(fd, &stb) < 0) { syserr: run_err("%s: %s", name, strerror(errno)); goto next; -- cgit v1.2.3 From 067263e84800c4b35f9bbbfafdd92aea493b6e0b Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Mon, 25 Jun 2007 18:32:33 +1000 Subject: - djm@cvs.openbsd.org 2007/06/13 00:21:27 [scp.c] don't ftruncate() non-regular files; bz#1236 reported by wood AT xmission.com; ok dtucker@ --- ChangeLog | 9 ++++++++- scp.c | 5 +++-- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'scp.c') diff --git a/ChangeLog b/ChangeLog index 08d55cc54..d1a244abf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +20070625 + - (dtucker) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2007/06/13 00:21:27 + [scp.c] + don't ftruncate() non-regular files; bz#1236 reported by wood AT + xmission.com; ok dtucker@ + 20070614 - (dtucker) [cipher-ctr.c umac.c openbsd-compat/openssl-compat.h] Move the USE_BUILTIN_RIJNDAEL compat goop to openssl-compat.h so it can be @@ -3072,4 +3079,4 @@ 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.4702 2007/06/14 13:47:31 dtucker Exp $ +$Id: ChangeLog,v 1.4703 2007/06/25 08:32:33 dtucker Exp $ diff --git a/scp.c b/scp.c index 92a67b733..0206e6f4e 100644 --- a/scp.c +++ b/scp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scp.c,v 1.158 2007/06/12 13:54:28 dtucker Exp $ */ +/* $OpenBSD: scp.c,v 1.159 2007/06/13 00:21:27 djm Exp $ */ /* * scp - secure remote copy. This is basically patched BSD rcp which * uses ssh to do the data transfer (instead of using rcmd). @@ -1024,7 +1024,8 @@ bad: run_err("%s: %s", np, strerror(errno)); wrerr = YES; wrerrno = errno; } - if (wrerr == NO && ftruncate(ofd, size) != 0) { + if (wrerr == NO && (!exists || S_ISREG(stb.st_mode)) && + ftruncate(ofd, size) != 0) { run_err("%s: truncate: %s", np, strerror(errno)); wrerr = DISPLAYED; } -- cgit v1.2.3 From 647d97b1ab1f8ef4dfa6c7a085b409e1c3609c6f Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Wed, 8 Aug 2007 14:29:58 +1000 Subject: - sobrado@cvs.openbsd.org 2007/08/06 19:16:06 [scp.1 scp.c] the ellipsis is not an optional argument; while here, sync the usage and synopsis of commands lots of good ideas by jmc@ ok jmc@ --- ChangeLog | 8 +++++++- scp.1 | 6 +++--- scp.c | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) (limited to 'scp.c') diff --git a/ChangeLog b/ChangeLog index 3c5bfb042..c4a7d1261 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,12 @@ [key.c] Delint: remove some unreachable statements, from Bret Lambert. OK markus@ and dtucker@. + - sobrado@cvs.openbsd.org 2007/08/06 19:16:06 + [scp.1 scp.c] + the ellipsis is not an optional argument; while here, sync the usage + and synopsis of commands + lots of good ideas by jmc@ + ok jmc@ 20070724 - (tim) [openssh.xml.in] make FMRI match what package scripts use. @@ -3123,4 +3129,4 @@ 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.4716 2007/08/08 04:28:26 djm Exp $ +$Id: ChangeLog,v 1.4717 2007/08/08 04:29:58 djm Exp $ diff --git a/scp.1 b/scp.1 index 17140e37a..9b221762b 100644 --- a/scp.1 +++ b/scp.1 @@ -9,9 +9,9 @@ .\" .\" Created: Sun May 7 00:14:37 1995 ylo .\" -.\" $OpenBSD: scp.1,v 1.41 2007/05/31 19:20:16 jmc Exp $ +.\" $OpenBSD: scp.1,v 1.42 2007/08/06 19:16:06 sobrado Exp $ .\" -.Dd $Mdocdate: May 31 2007 $ +.Dd $Mdocdate: August 6 2007 $ .Dt SCP 1 .Os .Sh NAME @@ -34,7 +34,7 @@ .Ar host1 No : .Oc Ns Ar file1 .Sm on -.Op Ar ... +.Ar ... .Sm off .Oo .Op Ar user No @ diff --git a/scp.c b/scp.c index 0206e6f4e..1765a44e6 100644 --- a/scp.c +++ b/scp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scp.c,v 1.159 2007/06/13 00:21:27 djm Exp $ */ +/* $OpenBSD: scp.c,v 1.160 2007/08/06 19:16:06 sobrado Exp $ */ /* * scp - secure remote copy. This is basically patched BSD rcp which * uses ssh to do the data transfer (instead of using rcmd). @@ -1120,7 +1120,7 @@ usage(void) (void) fprintf(stderr, "usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]\n" " [-l limit] [-o ssh_option] [-P port] [-S program]\n" - " [[user@]host1:]file1 [...] [[user@]host2:]file2\n"); + " [[user@]host1:]file1 ... [[user@]host2:]file2\n"); exit(1); } -- cgit v1.2.3