diff options
author | Colin Watson <cjwatson@debian.org> | 2007-12-24 10:29:57 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2007-12-24 10:29:57 +0000 |
commit | c3e531b12b2335b7fa5a6bcc9a309d3c523ff64b (patch) | |
tree | b72c0867348e7e7914d64af6fc5e25c728922e03 /scp.c | |
parent | 6b222fdf3cb54c11a446df38e027fe7acf2220cb (diff) | |
parent | 70847d299887abb96f8703ca99db6d817b78960e (diff) |
* New upstream release (closes: #453367).
- CVE-2007-4752: Prevent ssh(1) from using a trusted X11 cookie if
creation of an untrusted cookie fails; found and fixed by Jan Pechanec
(closes: #444738).
- sshd(8) in new installations defaults to SSH Protocol 2 only. Existing
installations are unchanged.
- The SSH channel window size has been increased, and both ssh(1)
sshd(8) now send window updates more aggressively. These improves
performance on high-BDP (Bandwidth Delay Product) networks.
- ssh(1) and sshd(8) now preserve MAC contexts between packets, which
saves 2 hash calls per packet and results in 12-16% speedup for
arcfour256/hmac-md5.
- A new MAC algorithm has been added, UMAC-64 (RFC4418) as
"umac-64@openssh.com". UMAC-64 has been measured to be approximately
20% faster than HMAC-MD5.
- Failure to establish a ssh(1) TunnelForward is now treated as a fatal
error when the ExitOnForwardFailure option is set.
- ssh(1) returns a sensible exit status if the control master goes away
without passing the full exit status.
- When using a ProxyCommand in ssh(1), set the outgoing hostname with
gethostname(2), allowing hostbased authentication to work.
- Make scp(1) skip FIFOs rather than hanging (closes: #246774).
- Encode non-printing characters in scp(1) filenames. These could cause
copies to be aborted with a "protocol error".
- Handle SIGINT in sshd(8) privilege separation child process to ensure
that wtmp and lastlog records are correctly updated.
- Report GSSAPI mechanism in errors, for libraries that support multiple
mechanisms.
- Improve documentation for ssh-add(1)'s -d option.
- Rearrange and tidy GSSAPI code, removing server-only code being linked
into the client.
- Delay execution of ssh(1)'s LocalCommand until after all forwardings
have been established.
- In scp(1), do not truncate non-regular files.
- Improve exit message from ControlMaster clients.
- Prevent sftp-server(8) from reading until it runs out of buffer space,
whereupon it would exit with a fatal error (closes: #365541).
- pam_end() was not being called if authentication failed
(closes: #405041).
- Manual page datestamps updated (closes: #433181).
Diffstat (limited to 'scp.c')
-rw-r--r-- | scp.c | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: scp.c,v 1.156 2007/01/22 13:06:21 djm Exp $ */ | 1 | /* $OpenBSD: scp.c,v 1.160 2007/08/06 19:16:06 sobrado Exp $ */ |
2 | /* | 2 | /* |
3 | * scp - secure remote copy. This is basically patched BSD rcp which | 3 | * scp - secure remote copy. This is basically patched BSD rcp which |
4 | * uses ssh to do the data transfer (instead of using rcmd). | 4 | * uses ssh to do the data transfer (instead of using rcmd). |
@@ -96,6 +96,9 @@ | |||
96 | #include <string.h> | 96 | #include <string.h> |
97 | #include <time.h> | 97 | #include <time.h> |
98 | #include <unistd.h> | 98 | #include <unistd.h> |
99 | #if defined(HAVE_STRNVIS) && defined(HAVE_VIS_H) | ||
100 | #include <vis.h> | ||
101 | #endif | ||
99 | 102 | ||
100 | #include "xmalloc.h" | 103 | #include "xmalloc.h" |
101 | #include "atomicio.h" | 104 | #include "atomicio.h" |
@@ -582,7 +585,7 @@ source(int argc, char **argv) | |||
582 | off_t i, amt, statbytes; | 585 | off_t i, amt, statbytes; |
583 | size_t result; | 586 | size_t result; |
584 | int fd = -1, haderr, indx; | 587 | int fd = -1, haderr, indx; |
585 | char *last, *name, buf[2048]; | 588 | char *last, *name, buf[2048], encname[MAXPATHLEN]; |
586 | int len; | 589 | int len; |
587 | 590 | ||
588 | for (indx = 0; indx < argc; ++indx) { | 591 | for (indx = 0; indx < argc; ++indx) { |
@@ -591,17 +594,17 @@ source(int argc, char **argv) | |||
591 | len = strlen(name); | 594 | len = strlen(name); |
592 | while (len > 1 && name[len-1] == '/') | 595 | while (len > 1 && name[len-1] == '/') |
593 | name[--len] = '\0'; | 596 | name[--len] = '\0'; |
597 | if ((fd = open(name, O_RDONLY|O_NONBLOCK, 0)) < 0) | ||
598 | goto syserr; | ||
594 | if (strchr(name, '\n') != NULL) { | 599 | if (strchr(name, '\n') != NULL) { |
595 | run_err("%s: skipping, filename contains a newline", | 600 | strnvis(encname, name, sizeof(encname), VIS_NL); |
596 | name); | 601 | name = encname; |
597 | goto next; | ||
598 | } | 602 | } |
599 | if ((fd = open(name, O_RDONLY, 0)) < 0) | ||
600 | goto syserr; | ||
601 | if (fstat(fd, &stb) < 0) { | 603 | if (fstat(fd, &stb) < 0) { |
602 | syserr: run_err("%s: %s", name, strerror(errno)); | 604 | syserr: run_err("%s: %s", name, strerror(errno)); |
603 | goto next; | 605 | goto next; |
604 | } | 606 | } |
607 | unset_nonblock(fd); | ||
605 | switch (stb.st_mode & S_IFMT) { | 608 | switch (stb.st_mode & S_IFMT) { |
606 | case S_IFREG: | 609 | case S_IFREG: |
607 | break; | 610 | break; |
@@ -1021,7 +1024,8 @@ bad: run_err("%s: %s", np, strerror(errno)); | |||
1021 | wrerr = YES; | 1024 | wrerr = YES; |
1022 | wrerrno = errno; | 1025 | wrerrno = errno; |
1023 | } | 1026 | } |
1024 | if (wrerr == NO && ftruncate(ofd, size) != 0) { | 1027 | if (wrerr == NO && (!exists || S_ISREG(stb.st_mode)) && |
1028 | ftruncate(ofd, size) != 0) { | ||
1025 | run_err("%s: truncate: %s", np, strerror(errno)); | 1029 | run_err("%s: truncate: %s", np, strerror(errno)); |
1026 | wrerr = DISPLAYED; | 1030 | wrerr = DISPLAYED; |
1027 | } | 1031 | } |
@@ -1116,7 +1120,7 @@ usage(void) | |||
1116 | (void) fprintf(stderr, | 1120 | (void) fprintf(stderr, |
1117 | "usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]\n" | 1121 | "usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]\n" |
1118 | " [-l limit] [-o ssh_option] [-P port] [-S program]\n" | 1122 | " [-l limit] [-o ssh_option] [-P port] [-S program]\n" |
1119 | " [[user@]host1:]file1 [...] [[user@]host2:]file2\n"); | 1123 | " [[user@]host1:]file1 ... [[user@]host2:]file2\n"); |
1120 | exit(1); | 1124 | exit(1); |
1121 | } | 1125 | } |
1122 | 1126 | ||