Commit Graph

202 Commits

Author SHA1 Message Date
christos 964e4f5784 fix restart from anon ymous 2013-02-23 13:47:36 +00:00
christos e7e7a9f768 compile without SSL 2012-12-22 16:58:51 +00:00
christos 057b4f79a5 document https support, mentioning certificates are not validated, and obey
https_proxy.
2012-12-22 16:57:09 +00:00
christos f9336fd862 PR/47276: Add https support 2012-12-21 18:07:36 +00:00
is 706521afb9 As discussed on tech-net@: Don't display expected EHOSTUNREACH for all but
the last connect attempts in terse mode.
2012-07-04 06:09:37 +00:00
apb daa17451fe subtracting two pointers yields ptrdiff_t, so cast it to int. 2012-02-24 19:53:31 +00:00
apb bb16246581 When given an URL that contains "://" but is not recognised,
print an error message.  Now "ftp https://foo/bar" prints

    ftp: Unsupported URL scheme `https'

instead of

    ftp: Can't lookup `https:ftp': No address associated with hostname
    ftp: Can't connect or login to host `https:?'
2012-02-24 19:40:49 +00:00
lukem 2c9a7b42f6 Move determination of socket buffer sizes from startup to the first
time a socket is used, as the previous logic assumed AF_INET sockets
were available (which they may not be in an IPv6-only system).
Per discussion with Maxim Konovalov and the FreeBSD problem 162661.
2011-12-10 05:53:58 +00:00
joerg 6818646ac8 Use __dead 2011-09-16 15:39:25 +00:00
lukem 3f853671ff Back to using 'RFC xxxx' instead of 'RFCxxxx' 2010-03-05 07:41:10 +00:00
lukem cbd600cfd6 Parse HTTP 'Date' entries in the `C' locale rather than the user's.
Fix from [bin/42917] (with minor changes), from KAMADA Ken'ichi.
2010-03-04 21:40:53 +00:00
christos 3104786862 back out previous; luke says:
'@' is a reserved URI char per RFC 3986, use %40
2009-08-17 09:08:16 +00:00
christos 3ac3892a2a use strrchr to find the last @ because we might want the username to contain
user@domain.
2009-08-16 02:49:23 +00:00
drochner c2819fbfcf avoid NULL dereference in log output if the command line parser
failed to extract a port number from the URL
2009-08-13 17:55:18 +00:00
roy 7027866a09 Rename internal getline() function to get_line() so it does
conflict with the soon to be added getline(3) libc function.
2009-07-13 19:05:39 +00:00
lukem 3d4efc3511 Fix numerous WARNS=4 issues (-Wcast-qual -Wsign-compare). 2009-04-12 10:18:52 +00:00
lukem d8b47884a2 fix -Wshadow issues 2009-04-12 07:07:41 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
lukem b81e94d02a Use the service name to getaddrinfo() (along with the host name), so that
features such as DNS Service Discovery have a better chance of working.
Suggested by David Young <dyoung>.

Display the service name in various status & error messages.

Don't getservbyname() the :port component of a URL; RFC 3986 says it's
just an unsigned number, not a service name.
2008-04-22 12:59:33 +00:00
lukem 7a69105995 DPRINTF() consistency tweaks 2007-12-05 03:46:33 +00:00
lukem f1fbb660ed Cast the field precision calculation to int.
Should fix the amd64 build problem noticed by Paul Goyette.
2007-08-22 23:47:13 +00:00
lukem 91c7169d78 Improve parsing of chunked transfer chunks per RFC2616:
* more stringent chunk-size parsing
* ignore optional trailing ';chunk-ext' stuff, instead of barfing
* detect EOF before final \r\n.
2007-08-22 06:51:41 +00:00
lukem d5855ca07b Enforce restriction that (http) proxied URL fetchs don't support
being restarted at this time.
PR #28697.
2007-06-05 00:31:20 +00:00
lukem f4f2ed1c79 Display times in RFC2822 form rather than using ctime(3), since
the former is more explicit about the timezone offset.
2007-05-24 05:05:18 +00:00
lukem 3ba7505832 * main: call tzset() to ensure TZ is setup for other <time.h> functions.
* remotemodtime(): use strptime() to parse the reply.
* fetch_url(): ensure struct tm is zeroed before calling strptime().
2007-05-22 05:16:48 +00:00
lukem c007c5280e * Modify parse_url() to consistently strip the leading `/' off ftp URLs.
Fixes PR 17617.
* Use 'RFCnnnn' (with leading 0) instead of 'RFC nnnn', to be
  consistent with the style in the RFC index.
* Refer to RFC3916 instead of 1738 or 2732.
* Expand the list of supported RFCs in ftp(1) to contain the document
  name as well.
2007-05-15 23:54:18 +00:00
lukem 8b1e1fad90 Switch from fparseln() to the internal getline() when parsing HTTP headers.
Makes ftp a bit more portable (not needing fparseln()) at the expense of not
supporting arbitrary long header lines, which I'm not concerned about
because we don't support header line continuation either...
2007-05-10 12:22:04 +00:00
lukem 8a06b9bff0 * Implement -s srcaddr; uses srcaddr as the local IP address for all
connections.
  Based on code in the version of ftp that FreeBSD had before they
  replaced it with lukemftp.
* Move error message handling into ftp_connect() rather than in the
  caller, so that more specific error reporting can occur.
* Improve consistency of various warning and error messages.
2007-04-17 05:52:03 +00:00
lukem 06cab527ea getpass() can return NULL upon error in some implementations
(as documented in older standards documents, before the API was obsoleted).
Problem observed in tnftp on Solaris by Emil Mikulic.
2007-04-11 00:52:38 +00:00
christos 748af04e26 gcc4 does not care about &foo; use volatile instead. From Anon Ymous 2006-12-13 18:04:08 +00:00
christos c0179c282a spell precede; from Zafer 2006-11-25 16:48:31 +00:00
elad fb85339a04 PR/34540: b1ff at fr33 dot b33r dot net: bogus free() in ftp(1)
Applied patch, thanks!
2006-09-22 22:29:25 +00:00
lukem af2c479f62 If a file upload (via -u) fails, return an non-zero exit value based on the
index of the file that caused the problem (a la auto-fetch retrieval).
Problem noted by A P Garcia in private email.
2006-07-26 14:28:11 +00:00
christos 32d85d8f66 Coverity CID 2194: Don't forget to free port. 2006-04-28 20:02:07 +00:00
christos 5c8a52b0f1 Coverity CID 2195: Free path in all code paths, not some. 2006-04-28 19:59:44 +00:00
christos 76fc0d5b65 rename debug to ftp_debug. grr libssh. 2006-01-31 20:05:35 +00:00
christos e22794108e Rename xfoo() to ftp_foo() to avoid collisions with libssh. Don't ask. 2006-01-31 20:01:23 +00:00
christos 13d27fec78 recognize 307 redirect code. 2006-01-02 12:30:01 +00:00
lukem c114b2eb28 Don't clear the trailing character on the auth_url() username;
we now use getline() and that newline strips for us.
Problem found & fixed by Mark Davies.
2005-08-21 16:16:33 +00:00
christos b232679f19 Add NO_USAGE and NO_DEBUG so that we can fit in the floppies again. 2005-06-29 02:31:19 +00:00
lukem ddc3d4ca5a Implement:
int getline(FILE *stream, char *buf, size_t buflen, const char **errormsg)
	Read a line from the FILE stream into buf/buflen using fgets(), so up
	to buflen-1 chars will be read and the result will be NUL terminated.
	If the line has a trailing newline it will be removed.
	If the line is too long, excess characters will be read until
	newline/EOF/error.
	Various -ve return values indicate different errors, and errormsg
	will be changed to an error description if it's not NULL.

Convert to use getline() instead of fgets() whenever reading user input
to ensure that an overly long input line doesn't leave excess characters
for the next input operation to accidentally use as input.

Zero out the password & account after we've finished with it.

Consistently use getpass(3) (i.e, character echo suppressed) when
reading the account data.  For some reason, historically the "login"
code suppressed echo for Account: yet the "user" command did not!

Display the hostname in the "getaddrinfo failed" warning.

Appease some -Wcast-qual warnings.  Fixing all of these requires
significant code refactoring.  (mmm, legacy code).
2005-06-10 00:18:46 +00:00
lukem c7115c2b93 * Only print the "Trying <address>..." message if verbose and
there's more than one struct addrinfo in the getaddrinfo() result.
* Don't use non-standard "u_int".
2005-06-01 12:10:14 +00:00
lukem e2240cac60 * fetch_ftp(): preserve 'anonftp' across a disconnect() so that multiple
ftp auto-fetches on the same command line login automatically.
* auto_fetch(): use an initialized volatile int to appease IRIX cc.
2005-05-29 05:56:56 +00:00
lukem dc6635b518 Use size_t instead of int where appropriate. 2005-05-19 03:05:04 +00:00
lukem 7f321b8850 Fix some cast issues highlighted by Scott Reynolds using gcc 4 on OSX.4 2005-05-14 15:26:43 +00:00
lukem a2fc7ddaf6 gratuitous whitespace cleanup (before someone else jumps the gun...) 2005-04-11 01:49:31 +00:00
lukem ec95ee57f7 In fetch_url(), don't call freeaddrinfo(res0) too early, as we use pointers
to its contents later in the function.
Problem found by Onno van der Linden.
2005-04-10 03:13:23 +00:00
lukem f851795088 Fix ftp url reget when globs are being used.
Provided by Mathieu Arnold <mat@FreeBSD.org>.
2005-01-12 22:37:41 +00:00
lukem a76c6e6173 * Always decode %xx in a url's user & pass components.
* Only remember {WWW,Proxy}-Authenticate "Basic" challenges; no point
  in tracking any others since ftp doesn't support them.
* Improve the parsing of HTTP responses.
2004-12-10 06:44:15 +00:00
dsl e833833eb1 Add (unsigned char) cast to ctype functions 2004-10-30 17:29:47 +00:00