summaryrefslogtreecommitdiff
path: root/scp.c
Commit message (Collapse)AuthorAgeFilesLines
...
* upstream: Fix error message on close(2) and add printf formatmillert@openbsd.org2020-05-301-4/+7
| | | | | | attributes. From Christos Zoulas, OK markus@ OpenBSD-Commit-ID: 41523c999a9e3561fcc7082fd38ea2e0629ee07e
* upstream: another case where a utimes() failure could make scp senddjm@openbsd.org2020-05-071-4/+2
| | | | | | a desynchronising error; reminded by Aymeric Vincent ok deraadt markus OpenBSD-Commit-ID: 2ea611d34d8ff6d703a7a8bf858aa5dbfbfa7381
* upstream: when receving a file in sink(), be careful to send atdjm@openbsd.org2020-05-011-37/+59
| | | | | | | | | | most a single error response after the file has been opened. Otherwise the source() and sink() can become desyncronised. Reported by Daniel Goujot, Georges-Axel Jaloyan, Ryan Lahfa, and David Naccache. ok deraadt@ markus@ OpenBSD-Commit-ID: 6c14d233c97349cb811a8f7921ded3ae7d9e0035
* upstream: run the 2nd ssh with BatchMode for scp -3markus@openbsd.org2020-05-011-1/+2
| | | | OpenBSD-Commit-ID: 77994fc8c7ca02d88e6d0d06d0f0fe842a935748
* upstream: Replace all calls to signal(2) with a wrapper arounddtucker@openbsd.org2020-01-231-11/+11
| | | | | | | | sigaction(2). This wrapper blocks all other signals during the handler preventing races between handlers, and sets SA_RESTART which should reduce the potential for short read/write operations. OpenBSD-Commit-ID: 5e047663fd77a40d7b07bdabe68529df51fd2519
* Hook up fnmatch for platforms that don't have it.Darren Tucker2019-11-011-0/+2
|
* wrap stdint.h include in HAVE_STDINT_HDamien Miller2019-10-091-1/+1
| | | | | | make the indenting a little more consistent too.. Fixes Solaris 2.6; reported by Tom G. Christensen
* upstream: Fix potential truncation warning. ok deraadt.dtucker@openbsd.org2019-09-131-2/+2
| | | | OpenBSD-Commit-ID: d87b7e3a94ec935e8194e7fce41815e22804c3ff
* upstream: When system calls indicate an error they return -1, notderaadt@openbsd.org2019-07-051-12/+12
| | | | | | | | some arbitrary value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future. OpenBSD-Commit-ID: 48081f00db7518e3b712a49dca06efc2a5428075
* upstream: when checking that filenames sent by the server sidedjm@openbsd.org2019-02-101-12/+270
| | | | | | | | | | match what the client requested, be prepared to handle shell-style brace alternations, e.g. "{foo,bar}". "looks good to me" millert@ + in snaps for the last week courtesy deraadt@ OpenBSD-Commit-ID: 3b1ce7639b0b25b2248e3a30f561a548f6815f3e
* upstream: add -T to usage();jmc@openbsd.org2019-02-011-2/+2
| | | | OpenBSD-Commit-ID: a7ae14d9436c64e1bd05022329187ea3a0ce1899
* upstream: check in scp client that filenames sent duringdjm@openbsd.org2019-01-271-9/+30
| | | | | | | | | | | | | | | | remote->local directory copies satisfy the wildcard specified by the user. This checking provides some protection against a malicious server sending unexpected filenames, but it comes at a risk of rejecting wanted files due to differences between client and server wildcard expansion rules. For this reason, this also adds a new -T flag to disable the check. reported by Harry Sintonen fix approach suggested by markus@; has been in snaps for ~1wk courtesy deraadt@ OpenBSD-Commit-ID: 00f44b50d2be8e321973f3c6d014260f8f7a8eda
* upstream: Have progressmeter force an update at the beginning anddtucker@openbsd.org2019-01-251-2/+2
| | | | | | | end of each transfer. Fixes the problem recently introduces where very quick transfers do not display the progressmeter at all. Spotted by naddy@ OpenBSD-Commit-ID: 68dc46c259e8fdd4f5db3ec2a130f8e4590a7a9a
* upstream: Sanitize scp filenames via snmprintf. To do this we movedtucker@openbsd.org2019-01-241-1/+2
| | | | | | | | the progressmeter formatting outside of signal handler context and have the atomicio callback called for EINTR too. bz#2434 with contributions from djm and jjelen at redhat.com, ok djm@ OpenBSD-Commit-ID: 1af61c1f70e4f3bd8ab140b9f1fa699481db57d8
* upstream: Add a -J option as a shortcut for -o Proxyjump= to scp(1)tb@openbsd.org2019-01-221-3/+5
| | | | | | | | and sftp(1) to match ssh(1)'s interface. ok djm OpenBSD-Commit-ID: a75bc2d5f329caa7229a7e9fe346c4f41c2663fc
* refactor libcrypto initialisationDamien Miller2018-11-231-0/+2
| | | | | | | | | | Don't call OpenSSL_add_all_algorithms() unless OpenSSL actually supports it. Move all libcrypto initialisation to a single function, and call that from seed_rng() that is called early in each tool's main(). Prompted by patch from Rosen Penev
* upstream: disallow empty incoming filename or ones that refer to thedjm@openbsd.org2018-11-161-2/+3
| | | | | | current directory; based on report/patch from Harry Sintonen OpenBSD-Commit-ID: f27651b30eaee2df49540ab68d030865c04f6de9
* upstream: Apply umask to all incoming files and directories notdtucker@openbsd.org2018-06-041-1/+3
| | | | | | | just files. This makes sure it gets applied to directories too, and prevents a race where files get chmodded after creation. bz#2839, ok djm@ OpenBSD-Commit-ID: 3168ee6c7c39093adac4fd71039600cfa296203b
* upstream: lots of typos in comments/docs. Patch from Karsten Weissdjm@openbsd.org2018-04-101-2/+2
| | | | | | | after checking with codespell tool (https://github.com/lucasdemarchi/codespell) OpenBSD-Commit-ID: 373222f12d7ab606598a2d36840c60be93568528
* upstream commitdjm@openbsd.org2018-02-101-1/+3
| | | | | | | | Disable RemoteCommand and RequestTTY in the ssh session started by scp. sftp is already doing this. From Camden Narzt via github; ok dtucker OpenBSD-Commit-ID: 59e2611141c0b2ee579c6866e8eb9d7d8217bc6b
* upstream commitmillert@openbsd.org2017-12-191-11/+36
| | | | | | | | Add helper function for uri handing in scp where a missing path simply means ".". Also fix exit code and add warnings when an invalid uri is encountered. OK otto@ OpenBSD-Commit-ID: 47dcf872380586dabf7fcc6e7baf5f8ad508ae1a
* upstream commitmillert@openbsd.org2017-10-231-94/+105
| | | | | | | | | | Add URI support to ssh, sftp and scp. For example ssh://user@host or sftp://user@host/path. The connection parameters described in draft-ietf-secsh-scp-sftp-ssh-uri-04 are not implemented since the ssh fingerprint format in the draft uses md5 with no way to specify the hash function type. OK djm@ Upstream-ID: 4ba3768b662d6722de59e6ecb00abf2d4bf9cacc
* upstream commitderaadt@openbsd.org2017-06-011-6/+2
| | | | | | | | | Switch to recallocarray() for a few operations. Both growth and shrinkage are handled safely, and there also is no need for preallocation dances. Future changes in this area will be less error prone. Review and one bug found by markus Upstream-ID: 822d664d6a5a1d10eccb23acdd53578a679d5065
* upstream commitjmc@openbsd.org2017-05-081-2/+2
| | | | | | remove options -12 from usage(); Upstream-ID: db7ceef25132e63b50ed05289bf447fece1d1270
* Wrap stdint.h in HAVE_STDINT_HDarren Tucker2017-05-011-0/+2
|
* upstream commitdjm@openbsd.org2017-05-011-1/+5
| | | | | | | | exterminate the -1 flag from scp ok markus@ Upstream-ID: 26d247f7065da15056b209cef5f594ff591b89db
* upstream commitmillert@openbsd.org2017-04-281-6/+13
| | | | | | | | Avoid relying on implementation-specific behavior when detecting whether the timestamp or file size overflowed. If time_t and off_t are not either 32-bit or 64-bit scp will exit with an error. OK djm@ Upstream-ID: f31caae73ddab6df496b7bbbf7da431e267ad135
* upstream commitmillert@openbsd.org2017-04-281-4/+9
| | | | | | | Avoid potential signed int overflow when parsing the file size. Use strtoul() instead of parsing manually. OK djm@ Upstream-ID: 1f82640861c7d905bbb05e7d935d46b0419ced02
* Force Turkish locales back to C/POSIX; bz#2643Damien Miller2016-12-121-1/+1
| | | | | | | | | | Turkish locales are unique in their handling of the letters 'i' and 'I' (yes, they are different letters) and OpenSSH isn't remotely prepared to deal with that. For now, the best we can do is to force OpenSSH to use the C/POSIX locale and try to preserve the UTF-8 encoding if possible. ok dtucker@
* upstream commitderaadt@openbsd.org2016-09-121-4/+3
| | | | | | | | Add MAXIMUM(), MINIMUM(), and ROUNDUP() to misc.h, then use those definitions rather than pulling <sys/param.h> and unknown namespace pollution. ok djm markus dtucker Upstream-ID: 712cafa816c9f012a61628b66b9fbd5687223fb8
* upstream commitschwarze@openbsd.org2016-06-061-17/+28
| | | | | | | | | | | | | | | | | | | | | | | To prevent screwing up terminal settings when printing to the terminal, for ASCII and UTF-8, escape bytes not forming characters and bytes forming non-printable characters with vis(3) VIS_OCTAL. For other character sets, abort printing of the current string in these cases. In particular, * let scp(1) respect the local user's LC_CTYPE locale(1); * sanitize data received from the remote host; * sanitize filenames, usernames, and similar data even locally; * take character display widths into account for the progressmeter. This is believed to be sufficient to keep the local terminal safe on OpenBSD, but bad things can still happen on other systems with state-dependent locales because many places in the code print unencoded ASCII characters into the output stream. Using feedback from djm@ and martijn@, various aspects discussed with many others. deraadt@ says it should go in now, i probably already hesitated too long Upstream-ID: e66afbc94ee396ddcaffd433b9a3b80f387647e0
* upstream commitdtucker@openbsd.org2016-03-041-5/+5
| | | | | | | Improve accuracy of reported transfer speeds by waiting for the ack from the other end. Pointed out by mmcc@, ok deraadt@ markus@ Upstream-ID: 99f1cf15c9a8f161086b814d414d862795ae153d
* upstream commitderaadt@openbsd.org2015-11-281-1/+11
| | | | | | | | pledge "stdio rpath wpath cpath fattr tty proc exec" except for the -p option (which sadly has insane semantics...) ok semarie dtucker Upstream-ID: 8854bbd58279abe00f6c33f8094bdc02c8c65059
* upstream commitmmcc@openbsd.org2015-10-171-2/+2
| | | | | | | | 0 -> NULL when comparing with a char*. ok dtucker@, djm@. Upstream-ID: a928e9c21c0a9020727d99738ff64027c1272300
* upstream commitderaadt@openbsd.org2015-04-291-2/+2
| | | | | rename xrealloc() to xreallocarray() since it follows that form. ok djm
* upstream commitderaadt@openbsd.org2015-01-161-3/+4
| | | | | | | | | | Replace <sys/param.h> with <limits.h> and other less dirty headers where possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
* - djm@cvs.openbsd.org 2014/06/24 02:21:01Damien Miller2014-07-021-3/+7
| | | | | | [scp.c] when copying local->remote fails during read, don't send uninitialised heap to the remote end. Reported by Jann Horn
* - deraadt@cvs.openbsd.org 2013/11/20 20:53:10Damien Miller2013-11-211-3/+3
| | | | | | [scp.c] unsigned casts for ctype macros where neccessary ok guenther millert markus
* - djm@cvs.openbsd.org 2013/06/22 06:31:57Damien Miller2013-07-181-3/+5
| | | | | [scp.c] improved time_t overflow check suggested by guenther@
* - djm@cvs.openbsd.org 2013/06/21 05:43:10Damien Miller2013-07-181-3/+3
| | | | | [scp.c] make this -Wsign-compare clean after time_t conversion
* - guenther@cvs.openbsd.org 2013/06/17 04:48:42Damien Miller2013-07-181-25/+38
| | | | | | | | | [scp.c] Handle time_t values as long long's when formatting them and when parsing them from remote servers. Improve error checking in parsing of 'T' lines. ok dtucker@ deraadt@
* - dtucker@cvs.openbsd.org 2013/06/04 19:12:23Darren Tucker2013-06-061-2/+2
| | | | | [scp.c] use MAXPATHLEN for buffer size instead of fixed value. ok markus
* - dtucker@cvs.openbsd.org 2013/06/01 20:59:25Darren Tucker2013-06-021-2/+2
| | | | | | | | [scp.c sftp-client.c] Replace S_IWRITE, which isn't standardized, with S_IWUSR, which is. Patch from Nathan Osman via bz#2113. ok deraadt. (note: corrected bug number from 2085)
* - djm@cvs.openbsd.org 2013/05/17 00:13:13Darren Tucker2013-06-021-12/+10
| | | | | | | | | | | | | | | | | | [xmalloc.h cipher.c sftp-glob.c ssh-keyscan.c ssh.c sftp-common.c ssh-ecdsa.c auth2-chall.c compat.c readconf.c kexgexs.c monitor.c gss-genr.c cipher-3des1.c kex.c monitor_wrap.c ssh-pkcs11-client.c auth-options.c rsa.c auth2-pubkey.c sftp.c hostfile.c auth2.c servconf.c auth.c authfile.c xmalloc.c uuencode.c sftp-client.c auth2-gss.c sftp-server.c bufaux.c mac.c session.c jpake.c kexgexc.c sshconnect.c auth-chall.c auth2-passwd.c sshconnect1.c buffer.c kexecdhs.c kexdhs.c ssh-rsa.c auth1.c ssh-pkcs11.c auth2-kbdint.c kexdhc.c sshd.c umac.c ssh-dss.c auth2-jpake.c bufbn.c clientloop.c monitor_mm.c scp.c roaming_client.c serverloop.c key.c auth-rsa.c ssh-pkcs11-helper.c ssh-keysign.c ssh-keygen.c match.c channels.c sshconnect2.c addrmatch.c mux.c canohost.c kexecdhc.c schnorr.c ssh-add.c misc.c auth2-hostbased.c ssh-agent.c bufec.c groupaccess.c dns.c packet.c readpass.c authfd.c moduli.c] bye, bye xfree(); ok markus@
* - dtucker@cvs.openbsd.org 2013/05/16 09:08:41Darren Tucker2013-05-161-2/+2
| | | | | | [log.c scp.c sshd.c serverloop.c schnorr.c sftp.c] Fix some "unused result" warnings found via clang and -portable. ok markus@
* - (djm) [configure.ac log.c scp.c sshconnect2.c openbsd-compat/vis.c]Damien Miller2013-03-201-1/+1
| | | | | [openbsd-compat/vis.h] FreeBSD's strnvis isn't compatible with OpenBSD's so mark it as broken. Patch from des AT des.no
* - djm@cvs.openbsd.org 2011/09/09 22:37:01Damien Miller2011-09-221-5/+9
| | | | | | | [scp.c] suppress adding '--' to remote commandlines when the first argument does not start with '-'. saves breakage on some difficult-to-upgrade embedded/router platforms; feedback & ok dtucker ok markus
* - jmc@cvs.openbsd.org 2010/12/09 14:13:33Damien Miller2011-01-061-2/+2
| | | | | | [scp.1 scp.c] scp.1: grammer fix scp.c: add -3 to usage()
* - markus@cvs.openbsd.org 2010/12/08 22:46:03Damien Miller2011-01-061-3/+86
| | | | | | | [scp.1 scp.c] add a new -3 option to scp: Copies between two remote hosts are transferred through the local host. Without this option the data is copied directly between the two remote hosts. ok djm@ (bugzilla #1837)
* - djm@cvs.openbsd.org 2010/11/26 05:52:49Damien Miller2010-12-011-10/+22
| | | | | | | [scp.c] Pass through ssh command-line flags and options when doing remote-remote transfers, e.g. to enable agent forwarding which is particularly useful in this case; bz#1837 ok dtucker@