summaryrefslogtreecommitdiffstats
path: root/sftp.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* upstream: save_errno wrappers inside two small signal handlers thatderaadt@openbsd.org2024-06-281-1/+3
| | | | | | | perform system calls, for systems with libc that do perform libc sigtramps. ok djm markus OpenBSD-Commit-ID: 7749b56419a7c9dcfe4c6c04811e429813346c62
* upstream: flush stdout after writing "sftp>" prompt when not usingdjm@openbsd.org2024-04-301-2/+4
| | | | | | | | editline. From Alpine Linux via GHPR480 OpenBSD-Commit-ID: 80bdc7ffe0358dc090eb9b93e6dedb2b087b24cd
* upstream: whitespacedjm@openbsd.org2024-02-011-22/+22
| | | | OpenBSD-Commit-ID: bf9e4a1049562ee4322684fbdce07142f04fdbb7
* upstream: rename remote_glob() -> sftp_glob() to match other APIdjm@openbsd.org2023-09-111-8/+8
| | | | OpenBSD-Commit-ID: d9dfb3708d824ec02970a84d96cf5937e0887229
* upstream: the sftp code was one of my first contributions todjm@openbsd.org2023-09-081-56/+68
| | | | | | | | | | | | OpenSSH and it shows - the function names are terrible. Rename do_blah() to sftp_blah() to make them less so. Completely mechanical except for sftp_stat() and sftp_lstat() which change from returning a pointer to a static variable (error-prone) to taking a pointer to a caller-provided receiver. OpenBSD-Commit-ID: eb54d6a72d0bbba4d623e2175cf5cc4c75dc2ba4
* upstream: fix double words ok dtucker@jsg@openbsd.org2023-04-171-2/+2
| | | | OpenBSD-Commit-ID: 44d3223902fbce5276422bdc8063ab72a4078489
* upstream: don't care about glob() return value here.djm@openbsd.org2023-04-061-2/+2
| | | | OpenBSD-Commit-ID: 85bb82fea90478a482e9f65a1bec0aa24227fd66
* upstream: Explictly ignore return codesdtucker@openbsd.org2023-03-311-2/+2
| | | | | | where we don't check them. OpenBSD-Commit-ID: 1ffb03038ba1b6b72667be50cf5e5e396b5f2740
* upstream: Plug potential mem leak in process_put.dtucker@openbsd.org2023-03-291-1/+3
| | | | | | | It allocates abs_dst inside a loop but only frees it on exit, so free inside the loop if necessary. Coverity CID 291837, ok djm@ OpenBSD-Commit-ID: a01616503a185519b16f00dde25d34ceaf4ae1a3
* upstream: Plug more mem leaks in sftp by makingdtucker@openbsd.org2023-03-281-7/+9
| | | | | | | | | make_absolute_pwd_glob work in the same way as make_absolute: you pass it a dynamically allocated string and it either returns it, or frees it and allocates a new one. Patch from emaste at freebsd.org and https://reviews.freebsd.org/D37253 ok djm@ OpenBSD-Commit-ID: 85f7404e9d47fd28b222fbc412678f3361d2dffc
* upstream: calloc can return NULL but xcalloc can't.dtucker@openbsd.org2023-03-121-2/+2
| | | | | | From Coverity CID 291881, ok djm@ OpenBSD-Commit-ID: 50204b755f66b2ec7ac3cfe379d07d85ca161d2b
* upstream: Plug mem leak. Coverity CID 405196, ok djm@dtucker@openbsd.org2023-03-081-2/+4
| | | | OpenBSD-Commit-ID: 175f09349387c292f626da68f65f334faaa085f2
* upstream: Delete obsolete /* ARGSUSED */ lint comments.guenther@openbsd.org2023-03-081-6/+1
| | | | | | ok miod@ millert@ OpenBSD-Commit-ID: 7be168a570264d59e96a7d2d22e927d45fee0e4c
* upstream: Plug mem leak on globbed ls error path.dtucker@openbsd.org2023-02-281-1/+2
| | | | | | Spotted by Coverity, ok deraadt@ OpenBSD-Commit-ID: de28476025db29820a9a2e56e98b964d8a02861c
* upstream: suppress "Connection closed" message when in quiet modedjm@openbsd.org2023-01-061-2/+3
| | | | OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f
* upstream: add -X to usage();jmc@openbsd.org2023-01-031-2/+2
| | | | OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0
* upstream: add a -X option to both scp(1) and sftp(1) to allowdjm@openbsd.org2023-01-031-3/+28
| | | | | | | | | | | | | | control over some SFTP protocol knobs: the copy buffer length and the number of inflight requests, both of which are used during upload/download. Previously these could be controlled in sftp(1) using the -b/-R options. This makes them available in both SFTP protocol clients using the same option character sequence. ok dtucker@ OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c
* upstream: use users-groups-by-id@openssh.com sftp-server extensiondjm@openbsd.org2022-09-191-4/+12
| | | | | | | (when available) to fill in user/group names for directory listings. Implement a client-side cache of see uid/gid=>user/group names. ok markus@ OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e
* upstream: extend sftp-common.c:extend ls_file() to support supplieddjm@openbsd.org2022-09-191-3/+3
| | | | | | user/group names; ok markus@ OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0
* upstream: sftp: Be a bit more clever about completionsdjm@openbsd.org2022-09-161-46/+69
| | | | | | | | | | | | | | | There are commands (e.g. "get" or "put") that accept two arguments, a local path and a remote path. However, the way current completion is written doesn't take this distinction into account and always completes remote or local paths. By expanding CMD struct and "cmds" array this distinction can be reflected and with small adjustment to completer code the correct path can be completed. By Michal Privoznik, ok dtucker@ OpenBSD-Commit-ID: 1396d921c4eb1befd531f5c4a8ab47e7a74b610b
* upstream: sftp: Don't attempt to complete arguments fordjm@openbsd.org2022-09-161-2/+2
| | | | | | | | | | | | non-existent commands If user entered a non-existent command (e.g. because they made a typo) there is no point in trying to complete its arguments. Skip calling complete_match() if that's the case. From Michal Privoznik OpenBSD-Commit-ID: cf39c811a68cde2aeb98fc85addea4000ef6b07a
* Remove seed_rng calls from scp, sftp, sftp-server.Darren Tucker2022-07-271-2/+0
| | | | | These binaries don't use OpenSSL's random functions. The next step will be to stop linking them against libcrypto. ok djm@
* upstream: reflect the update to -D arg name in usage();jmc@openbsd.org2022-07-011-2/+2
| | | | OpenBSD-Commit-ID: abdcde4f92b1ef094ae44210ee99d3b0155aad9c
* upstream: allow arguments to sftp -D option, e.g. sftp -Ddjm@openbsd.org2022-06-271-7/+9
| | | | | | | | "/usr/libexec/sftp-server -el debug3" ok markus@ OpenBSD-Commit-ID: 5a002b9f3a7aef2731fc0ffa9c921cf15f38ecce
* upstream: arrange for scp, when in sftp mode, to not ftruncate(3) filesdjm@openbsd.org2022-05-131-5/+5
| | | | | | | | | | | | early previous behavious of unconditionally truncating the destination file would cause "scp ~/foo localhost:" and "scp localhost:foo ~/" to delete all the contents of their destination. spotted by solene@ sthen@, also bz3431; ok dtucker@ OpenBSD-Commit-ID: ca39fdd39e0ec1466b9666f15cbcfddea6aaa179
* upstream: When performing operations that glob(3) a remote path, ensuredjm@openbsd.org2022-05-091-11/+38
| | | | | | | | | | | | | that the implicit working directory used to construct that path escapes glob(3) characters. This prevents glob characters from being processed in places they shouldn't, e.g. "cd /tmp/a*/", "get *.txt" should have the get operation treat the path "/tmp/a*" literally and not attempt to expand it. Reported by Lusia Kundel; ok markus@ OpenBSD-Commit-ID: 4f647f58482cbad3d58b1eab7f6a1691433deeef
* upstream: add a sftp client "cp" command that supports server-sidedjm@openbsd.org2022-03-311-1/+15
| | | | | | | copying of files. Useful for this task and for testing the copy-data extension. Patch from Mike Frysinger; ok dtucker@ OpenBSD-Commit-ID: 1bb1b950af0d49f0d5425b1f267e197aa1b57444
* upstream: remove blank linedjm@openbsd.org2022-03-201-2/+1
| | | | OpenBSD-Commit-ID: d5e0182965b2fbfb03ad5f256d1a1ce5706bcddf
* remove sys/param.h in -portable, after upstreamDamien Miller2021-12-211-1/+0
|
* upstream: Do not ignore SIGINT while waiting for input if editline(3)schwarze@openbsd.org2021-09-111-11/+14
| | | | | | | | | | is not used. Instead, in non-interactive mode, exit sftp(1), like for other serious errors. As pointed out by dtucker@, when compiled without editline(3) support in portable OpenSSH, the el == NULL branch is also used for interactive mode. In that case, discard the input line and provide a fresh prompt to the user just like in the case where editline(3) is used. OK djm@ OpenBSD-Commit-ID: 7d06f4d3ebba62115527fafacf38370d09dfb393
* upstream: In the editline(3) branch of the sftp(1) event loop,schwarze@openbsd.org2021-08-121-4/+20
| | | | | | | | | | | | | | handle SIGINT rather than ignoring it, such that the user can use Ctrl-C to discard the currently edited command line and get a fresh prompt, just like in ftp(1), bc(1), and in shells. It is critical to not use ssl_signal() for this particular case because that function unconditionally sets SA_RESTART, but here we need the signal to interrupt the read(2) in the el_gets(3) event loop. OK dtucker@ deraadt@ OpenBSD-Commit-ID: 8025115a773f52e9bb562eaab37ea2e021cc7299
* upstream: make scp(1) in SFTP mode follow symlinks likedjm@openbsd.org2021-08-071-3/+5
| | | | | | traditional scp(1) ok markus@ OpenBSD-Commit-ID: 97255e55be37e8e26605e4ba1e69f9781765d231
* upstream: typos in comments; GHPR#180 from Villdjm@openbsd.org2021-04-031-2/+2
| | | | | | | | | =?UTF-8?q?e=20Skytt=C3=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OpenBSD-Commit-ID: 93c732381ae0e2b680c79e67c40c1814b7ceed2c
* polish whitespace for portable filesDamien Miller2021-04-031-1/+1
|
* upstream: highly polished whitespace, mostly fixing spaces-for-tabdjm@openbsd.org2021-04-031-2/+2
| | | | | | and bad indentation on continuation lines. Prompted by GHPR#185 OpenBSD-Commit-ID: e5c81f0cbdcc6144df1ce468ec1bac366d8ad6e9
* upstream: Use new limits@openssh.com protocol extension to let thedjm@openbsd.org2021-04-011-6/+3
| | | | | | | | | | | | | client select good limits based on what the server supports. Split the download and upload buffer sizes to allow them to be chosen independently. In practice (and assuming upgraded sftp/sftp-server at each end), this increases the download buffer 32->64KiB and the upload buffer 32->255KiB. Patches from Mike Frysinger; ok dtucker@ OpenBSD-Commit-ID: ebd61c80d85b951b794164acc4b2f2fd8e88606c
* upstream: don't try to use timespeccmp(3) directly as a qsort(3)djm@openbsd.org2021-01-081-2/+5
| | | | | | | | | | comparison function - it returns 0/1 and not the -1/0/1 that qsort expectes. fixes sftp "ls -ltr" under some circumstances. Based on patch by Masahiro Matsuya via bz3248. OpenBSD-Commit-ID: 65b5e9f18bb0d10573868c3516de6e5170adb163
* upstream: shuffle a few utility functions into sftp-client.c; fromdjm@openbsd.org2020-12-041-53/+5
| | | | | | Jakub Jelen OpenBSD-Commit-ID: fdeb1aae1f6149b193f12cd2af158f948c514a2a
* upstream: whitespace; no code changedjm@openbsd.org2020-10-291-2/+2
| | | | OpenBSD-Commit-ID: efefc1c47e880887bdee8cd2127ca93177eaad79
* upstream: use the new variant log macros instead of prependingdjm@openbsd.org2020-10-181-2/+2
| | | | | | __func__ and appending ssh_err(r) manually; ok markus@ OpenBSD-Commit-ID: 1f14b80bcfa85414b2a1a6ff714fb5362687ace8
* upstream: Allow full range of UIDs and GIDs for sftp chown anddtucker@openbsd.org2020-10-071-6/+6
| | | | | | | chgrp on 32bit platforms instead of being limited by LONG_MAX. bz#3206, found by booking00 at sina.cn, ok markus@ OpenBSD-Commit-ID: 373b7bbf1f15ae482d39567ce30d18b51c9229b5
* upstream: allow -A to explicitly enable agent forwarding in scp anddjm@openbsd.org2020-08-031-4/+7
| | | | | | | sftp. The default remains to not forward an agent, even when ssh_config enables it. ok jmc dtucker markus OpenBSD-Commit-ID: 36cc526aa3b0f94e4704b8d7b969dd63e8576822
* upstream: sort -N and add it to usage();jmc@openbsd.org2020-04-031-2/+2
| | | | OpenBSD-Commit-ID: 5b00e8db37c2b0a54c7831fed9e5f4db53ada332
* upstream: Add a flag to re-enable verbose output when in batchdjm@openbsd.org2020-04-031-3/+9
| | | | | | mode; requested in bz3135; ok dtucker OpenBSD-Commit-ID: 5ad2ed0e6440562ba9c84b666a5bbddc1afe2e2b
* upstream: Have sftp reject "-1" in the same way as ssh(1) anddtucker@openbsd.org2020-02-261-7/+4
| | | | | | | | scp(1) do instead of accepting and silently ignoring it since protocol 1 support has been removed. Spotted by shivakumar2696 at gmail.com, ok deraadt@ OpenBSD-Commit-ID: b79f95559a1c993214f4ec9ae3c34caa87e9d5de
* upstream: Replace all calls to signal(2) with a wrapper arounddtucker@openbsd.org2020-01-231-13/+13
| | | | | | | | 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
* upstream: fix a race condition in the SIGCHILD handler that could turndjm@openbsd.org2019-11-011-4/+7
| | | | | | in to a kill(-1); bz3084, reported by Gao Rui, ok dtucker@ OpenBSD-Commit-ID: ac2742e04a69d4c34223505b6a32f6d686e18896
* upstream: remove some duplicate #includesdjm@openbsd.org2019-10-021-2/+1
| | | | OpenBSD-Commit-ID: ed6827ab921eff8027669848ef4f70dc1da4098c
* upstream: Fix a typo and make <esc><right> move right to thetb@openbsd.org2019-07-121-2/+2
| | | | | | | | | closest end of a word just like <esc><left> moves left to the closest beginning of a word. ok djm OpenBSD-Commit-ID: 6afe01b05ed52d8b12eb1fda6e9af5afb5e198ee
* upstream: from tim: - for reput, it is remote-path which isjmc@openbsd.org2019-06-211-5/+5
| | | | | | | | | | | | | | | | | | | optional, not local-path - sync help from deraadt: - prefer -R and undocument -r (but add a comment for future editors) from schwarze: - prefer -p and undocument -P (as above. the comment was schwarze's too) more: - add the -f flag to reput and reget - sort help (i can;t remember who suggested this originally) djm and deraadt were ok with earlier versions of this; tim and schwarze ok OpenBSD-Commit-ID: 3c699b53b46111f5c57eed4533f132e7e58bacdd