Commit Graph

316 Commits

Author SHA1 Message Date
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
lukem dfee5c0f62 crank version 2000-01-25 07:14:11 +00:00
lukem 61d86056a0 work around bug in apache 1.3.9 which incorrectly puts a trailing
space after the chunksize.
noted by Jun-ichiro itojun Hagino <itojun@itojun.org> in [bin/9096]
2000-01-25 07:13:45 +00:00
lukem ec9eefea83 be harsher about workaround 2000-01-25 06:45:18 +00:00
lukem 852392d00d work around lame ftpd's that don't return a correct post-Y2K date in
the output of `MDTM'.

obviously the programmer of aforementioned lame ftpd's did something like
	"19%02d", tm->tm_year
instead of
	"%04d", tm->tm_year + TM_YEAR_BASE

fixes [bin/9289] by jbernard@mines.edu
2000-01-25 06:11:00 +00:00
lukem b5a4e862d8 complete_ambiguous(): be consistent about completing unambiguous matches; if
the word is already complete then return CC_REFRESH so that the higher layer
may append a suffix if necessary.  Fix from Launey Thomas <ljt@alum.mit.edu>.
2000-01-20 13:19:46 +00:00
lukem 80b66e48af change references from draft-ietf-ipngwg-url-literal-01.txt to RFC 2732 1999-12-21 13:00:18 +00:00
lukem f442e9dbbd add dependency on version.h 1999-12-12 02:14:53 +00:00
lukem eee70cc0f0 crank version 1999-12-12 02:12:29 +00:00
lukem d30bdcd79c separate out the main `data pump' loop into two: one that supports
rate limiting and one that doesn't. simplifies the code, and speeds
up the latter case a bit, at the expense of duplicating a few lines...
1999-12-11 02:02:21 +00:00
lukem 3851d504a7 Fix chunked support; probably broke after rate limiting was added.
Problem noticed/debugging assisted by giles lean <giles@nemeton.com.au>.

XXX: rate limiting with chunked xfers might not limit correctly (i.e,
the limit may be too high or too low); fixing this is non trivial,
and will probably occur if i ever rototill fetch_url()
1999-12-11 00:56:13 +00:00
lukem ef03015b86 move version into separate file to reduce recompilation after version crank. 1999-12-05 22:54:35 +00:00
lukem bcd625e612 crank version 1999-12-05 22:50:06 +00:00
lukem e36391c2c9 * remove unnecessary freeaddrinfo(res), since res0 was changed to be
freed earlier in itojun's last commit. fixes [bin/8948].
* remove `const char *reason'; it was being assigned but not used.
1999-12-05 22:49:27 +00:00
itojun 05e574f6a9 fix memory leak in fetch_url (no freeaddrinfo was there).
sync with recent KAME.
1999-12-03 06:10:01 +00:00
lukem d0090fb777 * implement xsl_init() and xsl_add(); error checking forms of sl_{init,add}()
* fix bug where the second press of <TAB> on an empty word (i.e, list
  all options) may have resulted in an strncmp() against NULL.  (detected
  by _DIAGASSERT())
1999-11-28 06:32:04 +00:00
lukem 21da08ce70 in cleanuppeer(), reset username to NULL after free()ing it.
fixes [bin/8870] by Wolfgang Rupprecht <wolfgang@wsrcc.com>
1999-11-27 01:00:06 +00:00
lukem 7047fe4a36 bump version 1999-11-26 23:26:05 +00:00
lukem f25449279d * complete_remote(): use remglob("", ...) instead of remglob(".", ...),
for listings of the current working directory; some ftp servers don't
  like `NLST .'.
  [noted by Giles Lean <giles@nemeton.com.au>]
* recvrequest(): treat remote=="" as remote==NULL when calling command().
  (to support the above change)
* support `[user@]' in `[user@]host' and `[user@]host[:][path]'.
  [based on idea (and initial code) from David Maxwell <david@fundy.ca>]
* `idle' may be invoked without any args
* reformat some comments
* reformat usage string in program and man page
* call updateremotepwd() after successful login, not after successful connect
* always call setsockopt(, IPPROTO_IP, IP_TOS, ) (et al); using #if
  defined(IPPROTO_IP) doesn't work on certain foreign systems where
  enums instead of #defines are used...
  [noted by Matthias Pfaller <leo@dachau.marco.de>]
1999-11-26 21:41:55 +00:00
lukem ecb8a0755a - implement `set rprompt'; right side version of `set prompt'. depends on
EL_RPROMPT support i added to editline(3).
- allow $FTPPROMPT and $FTPRPROMPT to override defaults for the relevant
  prompts
- move `%' formatting code from prompt() to expandbuf().
- implement `%.' and `%c', similar to the same % codes in tcsh(1)
  (functionality I added to tcsh nearly 6 years ago), except that `%.'
  always does `...trailing' and `%c' always does `/<x>trailing'.
- unknown `%foo' codes get printed as `%foo'
1999-11-12 02:50:38 +00:00
lukem 14fbd5079e - implement updateremotepwd(); update the global variable `remotepwd'
to contain the remote working directory.
- add `set prompt', a user configurable prompt. (defaults to `ftp> ').
  the following escape characters a la tcsh(1) are supported: %/, %m,
  %M, and %n.
- add global var `username'; used by prompt code
- fix a couple of minor memory leaks
- bump version
1999-11-11 02:53:02 +00:00
lukem 2ef6c64e80 whitespace nits 1999-11-11 01:19:11 +00:00
lukem b2edff6b32 - implement restarting file:/// non-proxied http:// URLs (with -R).
- fix a semicolono which stopped file:/// from working
1999-11-10 07:34:41 +00:00