summaryrefslogtreecommitdiff
path: root/usr.bin/ftp
AgeCommit message (Collapse)Author
2020-09-01Fix build with -fno-common (default in clang 11)Jeremie Courreges-Anglas
Input and ok mortimer@
2020-07-06in 2014 I added this annotation: /* XXX floating point printf in signal ↵Theo de Raadt
handler */ our snprintf is reentrant safe except for floating point. Break the double apart into integer.integer notation, to avoid that. ok kettenis millert
2020-07-04Avoid malloc(3) calls in signal handlerkn
Fetch aborts through SIGINT (^C) print a message with fputs(3), but this calls malloc() on its own, which is not supported from interrupt handler context. Fix it by using write(2) which avoids further memory allocations. While here, merge abortfile() into the identical aborthttp() with a more generic "fetch aborted." message for simplicity. Spotted with vm.malloc_conf=SU and ^C on a port's "make fetch" causing ftp(49660) in malloc(): recursive call Abort trap (core dumped) OK jca (who came up with using write(2) independently)
2020-07-04Fix a double free in error pathsJeremie Courreges-Anglas
Consistently disarm the SIGINT handler on error, else a SIGINT can lead to taking twice the cleanup path. Initial report by naddy@, ok tb@
2020-06-20Avoid one uninitialized warning in file_get()Jeremie Courreges-Anglas
2020-02-22Avoid duplication in the code that sends headersJeremie Courreges-Anglas
ok yasuoka@
2020-02-22Respect userinfo even when built with NOSSL (floppy ramdisks)Jeremie Courreges-Anglas
Not handling it is incorrect and can lead to credentials leaks in DNS requests. The resulting growth is reasonable (about 300 bytes on amd64). ok yasuoka@
2020-02-20Backout revision 1.190 partially. That part was an unintended change whichYASUOKA Masahiko
is work in progress.
2020-02-19Fix http (not https) auth combined with proxy auth.Jeremie Courreges-Anglas
First look for userinfo, and overwrite it to make sure it doesn't reappears again later. Then reset the path to fix the fragile mechanism that produces the full request URI for the proxied connection case. ok yazuoka@
2020-02-19Don't put the userinfo in request URI. This also makes accessing aYASUOKA Masahiko
https server with user/password through "http_proxy" environment variable work properly. ok jca
2020-02-13Two longjmp(3) vs volatile fixes and improvementsJeremie Courreges-Anglas
- allocate read buffer before setjmp(3) so that its value is properly defined when longjmp(3) returns - only mark as volatile variables modified after setjmp(3) and used again after a possible return from longjmp(3)
2020-02-13Fixes and tweaks for read/write loop in url_get()Jeremie Courreges-Anglas
Changes already present in file_get() - no need to special case write(2) returning 0 - clearer loop condition - fix read error detection and properly save errno
2020-02-11Simplify and unify wording for the -I sourceaddr option in various places.Theo de Raadt
This is somewhat related to the "-b bind_addr" option some programs have, which should get some cleanup also... input florian claudio jmc
2020-01-21Fix tls_handshake() usage which was added without checking return valuesBob Beck
correctly. This would break ftp when the handshake doesn't complete in one shot. (noticed when making tls 1.3 connections to cloudflare.cdn) ok jsing@
2020-01-16Usually, -width Fl (which is 10n) is too wide and hence ugly.Ingo Schwarze
Change several instances, most of them to the usual -width Ds.
2020-01-15Move local file handling out of url_get()Jeremie Courreges-Anglas
The code is mostly duplicated already, handling local files here just makes for more complex code. Split it out to its own function. This mechanically prevents redirections to local files. Positive feedback from Hiltjo Posthuma
2019-12-19Prevent redirections to file: URLsJeremie Courreges-Anglas
Report and fix from Hiltjo Posthuma, input from and ok deraadt@
2019-12-09Reinstate ftp_printf to log sent HTTP headersJeremie Courreges-Anglas
On SMALL builds ftp_printf is just a #define to avoid a size increase. ok millert@
2019-12-09With NOSSL let url_get() print a nice error message for https urlsJeremie Courreges-Anglas
Input from deraadt@
2019-12-08For chunked transfers always restore the SIGINFO handler (not just on error)Jeremie Courreges-Anglas
Overlooked when shuffling the HTTP/1.1 code.
2019-12-05Fix #ifndef NOSSL vs SMALL inconsistenciesJeremie Courreges-Anglas
from Hiltjo Posthuma
2019-12-02Tweak inaccurate commentJeremie Courreges-Anglas
2019-11-18various knf and whitespace; ok jcaTheo de Raadt
2019-11-14HTTP/1.1 for ftp(1)Jeremie Courreges-Anglas
Some sites in ports start to reject HTTP/1.0 requests. Let's move on and implement HTTP/1.1. Should fit in ramdisks. ok sthen@ tb@
2019-11-04Apply more 'static' to help the compilerJeremie Courreges-Anglas
Results in better code and a size decrease.
2019-11-03Also use stdio for TLS connectionsJeremie Courreges-Anglas
Set up two wrappers around tls_read/write to be used along with the not-very-portable funopen(). This kills a bunch of local code, always a nice thing for an utility which ends up in bsd.rd. "seems legit" deraadt@, ok kn@
2019-10-23list -N before -n in the options list;Jason McIntyre
2019-10-23Add new -N name option, so that calling scripts can change theTheo de Raadt
progname and produce better error messages discussed with aja and jca
2019-10-23change some error reports to include the failing URL (which we vis, inTheo de Raadt
case it came via a redirect) some help from jca, discussed with aja
2019-10-15When setting the modification time on the retrieved file, use utimensat()Philip Guenther
with UTIME_OMIT for the atime, instead of setting the atime to the current time. ok jca@ cheloha@
2019-10-13Also close the server connection before retrying on a 503.Jeremie Courreges-Anglas
Keeping it around uses both local and remote resources for no good reason. ok job@
2019-10-13Factor out socket cleanup codeJeremie Courreges-Anglas
As a side effect this shuts down the TLS connection before closing the underlying socket for redirectionss. ok job@
2019-10-09On a 503, only retry if "Retry-After: 0" is present.Jeremie Courreges-Anglas
We just bail out if the header is absent or if the server tells us to wait. Prodding from job@, ok sthen@ deraadt@
2019-10-05Retry request once when receiving a 503Jeremie Courreges-Anglas
Basic implementation: we just retry once, and make no attempt (yet) to parse any Retry-After header. The idea is to work around cdn.openbsd.org sometimes replying with a 503 for reasons unknown. According to juanfra@ it sets "Retry-After: 0" so this minimal implementation should be enough. Different diff from espie@, test case from sthen@, input from millert@, ok millert@ deraadt@
2019-06-28When system calls indicate an error they return -1, not some arbitraryTheo de Raadt
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.
2019-06-28mkstemp() returns -1 on failureTheo de Raadt
2019-05-16Revert suni'ls ftp rewrite for now.Florian Obser
We are juggling too many things at the moment and we can't deal with the differences in behaviour right now.
2019-05-15Display "bytes received" like the csrg ftp used to when the progressbarFlorian Obser
is disabled. Difference pointed out by deraadt OK kurtm, sunil
2019-05-15Add the -m flag to the ftp.1 man page.kmos
Adjust the usage message of ftp(1) to reflect its two operating modes and list missing flags. OK florian@ jmc@
2019-05-14do not intermingle direct io (write), and potentially buffered io (stdio)Theo de Raadt
against the same outputs ok kmos florian
2019-05-14Document -vFlorian Obser
2019-05-14-v forces verbose mode even if stdin is not a terminalFlorian Obser
Found the hard way by bluhm Debugged with deraadt & bluhm
2019-05-14Enable TLSv1.0 and TLSv1.1Jeremie Courreges-Anglas
Like the old ftp. Discussed with at least with tedu@ "We should match existing behavior at least for now"
2019-05-14Remove an unused and leftover label.Sunil Nimmagadda
2019-05-14tls_write(3): Handle short writes.Sunil Nimmagadda
Ok jca@
2019-05-13ephermal -> ephemeralTheo Buehler
From Hiltjo Posthuma
2019-05-12Fix double free by nulling out pointers after free.Theo Buehler
from florian, ok jca
2019-05-12Make the "xx bytes received in y time" message go to the right placekmos
by using the login_info() function the other messages use. OK florian@
2019-05-12zap confusing unneeded parametersMarc Espie
okay jca@, jasper@
2019-05-12Repair ftp -o - and thus pkg_add: print informational messages on stderrJeremie Courreges-Anglas
ok florian@ espie@