Commit Graph

338 Commits

Author SHA1 Message Date
is 135600f947 More format string cleanup by sommerfeld. 2000-10-11 14:46:00 +00:00
lukem 0aa81b3ec3 explicitly use SOCK_STREAM with socket() instead of res->ai_socktype,
because it appears that linux with glibc doesn't set the latter
correctly after one of getaddrinfo() or getnameinfo().
2000-09-28 12:29:23 +00:00
lukem ddc9ba4e19 clarify that $ftp_proxy only works for full URLs and can't be used for
interactive connections.
2000-09-28 12:26:19 +00:00
lukem bac7eba63f since everything else here uses ANSI C, we might as well replace __STRING()
with the ANSI C stringization stuff...
2000-09-14 13:48:33 +00:00
lukem 52b579665e always include <netdb.h>, not just when INET6 is defined.
resolves PR [bin/10970] by Richard Earnshaw <rearnsha@cambridge.arm.com>>
2000-09-08 11:54:53 +00:00
lukem b8fb63ea1c base64_encode should be static. picked up by hp/ux(!) compiler 2000-08-28 12:06:11 +00:00
lukem a6eda9569f It appears that whilst Apache 1.3.9 incorrectly puts a trailing space
after the chunksize (before the \r\n), Apache 1.3.11 puts *multiple*
trailing spaces after the chunksize. I 'm fairly certain that this is
contrary to RFC 2068 section 3.6, but whatever...
Found by David Brownlee <abs@mono.org>
2000-08-27 06:39:25 +00:00
lukem 872f81b081 - in progressmeter() perform the check for foregroundproc() a little earlier
- removed unused variable `items' in list_vertical()
2000-08-27 06:31:23 +00:00
lukem e3cdb47e47 * implement parseport(), which takes a string and attempts to convert
it to a numeric port number
* use parseport() in parse_url() and hookup()
* don't try and lookup the port number using getaddrinfo(), as it's too hard
  to separate a failed host name lookup from a failed service name lookup.
  this was causing lossage on systems that don't have `http' in services(5)
  (such as solaris), but only crept in when we started using getaddrinfo()
  unconditionally.
2000-08-06 08:51:22 +00:00
lukem 29d497f491 - rename NO_QUAD to NO_LONG_LONG, QUAD* -> LL* and add ULL* (unsigned)
equivalents. name change suggested by Klaus Klein <kjk@netbsd.org>
- change defined(BSD4_4) || HAVE_SIN_LEN tests into HAVE_SOCKADDR_SA_LEN,
  and set the latter if BSD4_4 exists
2000-08-01 22:47:25 +00:00
lukem 8c77deb113 - we can't just rename BSD4_4 -> HAVE_SIN_LEN, since bsd systems define BSD4_4;
change tests to test for either defined(BSD4_4) or HAVE_SIN_LEN
- more KNF
2000-07-31 00:56:07 +00:00
lukem 88fb659da9 * always set (struct sockinet).su_len after getsockname() et al, so
that it's valid on systems which don't have sin_len and need the `compat'
  version
* fix the accept() in dataconn() to use the correct struct elem
2000-07-30 09:32:09 +00:00
lukem fad4243147 * always use getaddrinfo() and getnameinfo() instead of maintaining two code
paths. (lukemftp will provide replacements for these on older systems)
* rename __USE_SELECT to USE_SELECT
* rename BSD4_4 to HAVE_SIN_LEN
* replace union sockunion {} with struct sockinet {}, and modify the code
  accordingly. this is possibly more portable, as it doesn't rely upon the
  structure alignment within the union for our own stuff.
  (XXX: haven't tested the ipv6 stuff)
2000-07-30 06:10:43 +00:00
lukem 241987dc61 clean up NO_QUAD support: create helper #defines and use as appropriate:
#define		NOQUAD		! NOQUAD
	-------		------		- ------
	QUADF		"%ld"		"%lld"
	QUADFP(x)	"%" x "ld"	"%" x "lld"
	QUADT		long		long long
	STRTOL(x,y,z)	strtol(x,y,z)	strtoll(x,y,z)
2000-07-30 04:42:37 +00:00
lukem 6ac5c69c3e rename "opts" to "remopts", so people used to "o host" don't get bitten... 2000-07-28 12:01:40 +00:00
lukem ef0145331b rename "opts" to "remopts", so people used to "o host" don't get bitten... 2000-07-28 11:45:11 +00:00
lukem d49ddf30cd no trailing , on last item in enum 2000-07-28 11:03:13 +00:00
lukem b2a6191c15 add rfc 2389, since that's now supported 2000-07-18 07:18:36 +00:00
lukem 7816d2586e add support for FEAT and OPTS commands with `features' and `opts'.
(from RFC 2389).

add support for MLST & MLSD (machine parseble listings) with 'mlst', 'mlsd'
and 'pmlsd' (mlsd |$PAGER) commands.  (from draft-ietf-ftpext-mlst-11)

rename remotesyst() to getremoteinfo(), and modify to parse the result from
FEAT (if supported), and take into account the support for the various
extensions such as MDTM, SIZE, REST (STREAM), MLSD, and FEAT/OPTS.
put each feature into one of the following categories:
	- known to work (explicit FEAT)
	- unknown but assume works until explicit failure, when it's
	  then tagged as `known not to work'.
	- known not to work (FEAT succeeded but didn't return anything,
	  or was unknown and then explicit failure)
assign results into features[] matrix.

add support to getreply() so that an optional callback will be called
for each line received from the server except for the first and last.
this is used in FEAT (and MLST) parsing.

modify various commands to check if REST (STREAM), MDTM and SIZE are
explicitly or implicitly supported before using.

fix `syst' when verbose is off.

minor knf (indent goto labels by one space, etc).

simply various command usage handlers by assuming that argv != NULL except
for quit() and disconnect().
2000-07-18 07:16:52 +00:00
lukem 6f9c683fe4 minor knf. call setbinary()/setascii() with non-NULL 2nd arg 2000-07-18 06:49:21 +00:00
lukem 144c518689 convert to new knf 2000-07-18 06:45:03 +00:00
itojun bbef2fbaac errx?/warnx? audit. do not pass variable alone, use %s. idea from openbsd 2000-07-07 15:10:32 +00:00
lukem 040253276f * migrate the SYST parsing from setpeer() into a separate remotesyst().
call remotesyst() only when login has been successful
  some servers don't let you run SYST until you've successfully logged in.
* in fetch_ftp(), always call setpeer() with autologin disabled, and use
  the following ftp_login() to DTRT.
  this prevents ftp from trying to login a second time if the first autologin
  fails when connecting to a remote site anonymously using autofetch.
* reset unix_proxy and unix_server in cleanuppeer()
* missed a function conversion in the KNF sweep...
2000-06-15 13:08:23 +00:00
lukem f970de1382 from itojun: better fix for previous (doesn't need in_addr_t or u_int32_t) 2000-06-11 15:15:52 +00:00
lukem f48d57e2d2 portability fixes for lukemftp:
* initconn(): use in_addr_t instead of u_int32_t when manipulating IPv6
  addresses (and assume anything with ipv6 has in_addr_t; if not, i'll
  add an autoconf test for it)
* ai_unmapped(): not all systems have sin_len; so only set #ifdef BSD4_4
* fix some lint
2000-06-11 02:12:05 +00:00
lukem 71c4464e3e - fix ai_unmapped() to be a no-op in the !def INET6 case
- display `(-INET6)' at the end of the version string if !def INET6
- clarify in the man page that IPv6 support may not be present (for lukemftp :)
2000-06-05 09:22:52 +00:00
itojun b347bd9b87 updated comment on IPv4 mapped address. sync with kame. 2000-06-01 04:26:38 +00:00
lukem 413a4004df Add support for 'ftp -u url file ...', to upload a list of files to given url.
Mostly based on [bin/10019] by Scott Aaron Bamford <sab@ansic.net>
2000-05-31 14:23:57 +00:00
lukem 04b8305c9e Fix examples on using pipes in local filenames. AFAICT, ftp has always
required `dir . |more' not as `dir |more' treats `|more' as the remote
filename. Resolves [bin/9922] by Geoff Wing <mason@primenet.com.au>
2000-05-31 10:25:15 +00:00
itojun 6fc49112e9 document IPv4 mapped address twists.
- ftp(1): treats IPv4 mapped destination as IPv4 peer, not native IPv6 peer.
  this does not support network with SIIT translator.
- rshd(8)/rlogind(8): rejects accesses from IPv4 mapped peer, to avoid
  possible abuse of IPv4 mapped addr (rshd/rlogind use source address-based
  auth so it is important to check the condition).
2000-05-30 05:21:46 +00:00
itojun b8cb7f6356 more comment on IPv4 mapped address handling. 2000-05-30 02:11:42 +00:00
itojun 288fc74e2e convert IPv4 mapped address (::ffff:10.1.1.1) into real IPv4 address
before touching it.  IPv4 mapped address complicates too many things
in FTP protocol handling.
2000-05-29 14:57:27 +00:00
lukem bd22f3362b Change `ls' to use the `LIST' and not `NLST' FTP protocol command.
Now that after many years on not caring we find certain popular
ftp servers are starting to obey RFC959 to the letter of the law
and will only return a list of filenames (not directories or
other filetypes) in the output of `NLST', then `LIST' is more useful
in this case. (Note that the aforementioned pedanticness means that
filename completion isn't as useful as it could be...)
Fixes [bin/8937] by David A. Gatwood <dgatwood@deepspace.mklinux.org>
2000-05-28 07:53:30 +00:00
itojun b4f15c3bf0 do not pass scoped IPv6 address notation on Host: directive, since
scope identifier is local to the originating node.
do not allow scoped IPv6 address notation in URL, if it is via proxy.
2000-05-25 15:35:51 +00:00
lukem 2c9a4cf5d0 convert to ANSI KNF 2000-05-01 10:35:16 +00:00
lukem d16e624b57 * Add support for `fget localfile', which reads a list of filenames to
retrieve from localfile.  Based on work by Darren Reed.
* Crank version.
* Update copyright dates.
2000-05-01 09:44:53 +00:00
itojun f70ccb3744 allow IPv6 extended numeric address in host part.
(draft-ietf-ipngwg-scopedaddr-format-01.txt)
fixes PR 9616.
2000-04-24 05:59:39 +00:00
lukem 16ca0f7009 crank version 2000-04-13 08:23:52 +00:00
lukem d54eded2a0 fixes from cgd:
* sanity check a length (otherwise certain bogus responses can crash ftp)
* allow a transfer encoding type of `binary'; certain firewall vendors
  return this bogus type...
2000-04-13 08:17:56 +00:00
lukem 031f2ed4b1 s/strtoq/strtoll/ (the latter is standardised) 2000-04-13 08:13:30 +00:00
itojun 46169e86bf inhibit too-noisy message for scoped address data transfer
(will be enabled in "debug" mode).
2000-03-14 16:36:05 +00:00
itojun 4a340575cc make debugging output unambiguous on IPv6 numeric addrs (don't use host:port) 2000-03-09 22:07:59 +00:00
itojun 3c079a0744 http://[::1]:8080/ is legal.
send Host: directive with RFC2732 bracket notation for IPv6 numeric,
otherwise "host:port" is ambiguous to servers (clarification will be submitted
as update to RFC2732).
2000-03-09 22:01:26 +00:00
lukem 8575d2f491 only use IPTOS_ setsockopt()s if they're defined (e.g, SunOS doesn't).
from Havard.Eidnes@runit.sintef.no
2000-02-28 10:12:27 +00:00
lukem b5df4bcc84 only use getaddrinfo() et al if both NI_NUMERICHOST *and* INET6 are defined...
(allows --disable-ipv6 in lukemftp's configure script to disable this as
well, which is good for testing when it appears getaddrinfo() is borken)
2000-02-14 21:46:26 +00:00
lukem 0f9b481624 crank 2000-01-31 22:01:52 +00:00
lukem 7044ee274b define private type `sigfunc' as
typedef void (*sigfunc) __P((int));
and replace use of sig_t and void (*)(int).

certain other OSes define sig_t differently to that (they add extra arguments),
and it causes problems due to function mismatches, etc...
2000-01-31 22:01:03 +00:00
lukem be8fac301a crank version 2000-01-26 11:37:12 +00:00
lukem 0ac52b3131 roll back to using sscanf() instead of strptime() to parse `yyyymmddhhmmss'
strings, since the latter technically can't parse dates without non
alphanumerics between the elements (even though netbsd's strptime() copes).
2000-01-26 11:31:55 +00:00
lukem d2196602e3 put spaces between the % specifiers in the strptime format string 2000-01-26 10:15:40 +00:00