Commit Graph

507 Commits

Author SHA1 Message Date
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 aeb5730de8 Replace references from draft-ietf-ftpext-mlst-NN to RFC 3659. 2007-05-10 05:59:30 +00:00
lukem 2294f71cef Use getline() instead of fparseln() 2007-05-10 05:35:31 +00:00
lukem 82552a7668 Implement copy_bytes() to copy bytes from one fd to another via the
provided buffer, with optional rate-limiting and hash-mark printing,
using one loop and handle short writes.
Refactor sendrequest() and recvrequest() to use copy_data().
Addresses PR 15943.
2007-05-10 05:17:10 +00:00
martin 0c85e08d0f const-as-const-can: make the "suffixes" pointers const, as probably was
intended, but done wrong originally (redundant const was removed
per PR bin/36280)
2007-05-05 18:09:24 +00:00
christos ac6a20066f PR/36280: Christer Folkesson: Remove extra const 2007-05-05 16:57:54 +00:00
lukem bab591a531 fix rev 1.144: initconn() may be called with verbose==-1 (e.g., during remote
completion), so only print out the successful EPSV response if verbose>0.
2007-04-18 01:50:45 +00:00
lukem 036f5d17ed Clean up use of confirm() and mbort() so that the current operation
is always passed in (instead of depending upon the 'mname' global).
For confirm(), if the second argument is NULL print the "Continue with <cmd>"
prompt.  This fixes up the the display of interrupted prompts.
2007-04-18 01:39: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 31835c3a13 Replace a "while" with an "if" since the code path only gets executed once. 2007-04-16 00:43:43 +00:00
lukem 7898b5e0a8 Use the IEC 60027-2 2^n based "KiB", "MiB", "GiB", (etc)
suffixes for byte displays since we're using 2^n scaling,
instead of the SI 10^n based "KB", "MB", "GB" (etc).
2007-04-12 06:13:02 +00:00
lukem 98b66d0b78 Fix using /usr/bin/ftp as a slave process on the end of a pipe by calling
fflush(stdout) before each command.
Taken from FreeBSD's pre-lukemftp version of ftp.
2007-04-12 04:25:00 +00:00
lukem 00e5aa03ea whitespace pedantry 2007-04-12 04:18:22 +00:00
lukem b1e08b00c3 Various fixes from Nicholas Marriott sent to openbsd-tech and in private email:
* Prevent segfault if a .netrc token is too long.
* Prevent segfault when using a macro from an empty macdef.
* Check more return values.
2007-04-12 01:28:13 +00:00
lukem ea73350dac Suppress printing non-COMPLETE reply strings from EPSV and EPRT, as we're
going to fall back to PASV / PORT (respectively) if the former fail,
and this avoids printing a failure reply followed by a success reply.
Should fix a problem with the emacs ftp wrapper.
2007-04-11 05:03:25 +00:00
lukem 7aab13aa67 Revert rename of "debug" command from "ftp_debug" back to "debug". 2007-04-11 04:40:19 +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
lukem 5b87c223c9 Use "see" instead of "c.f.".
Per feedback from Valeriy E. Ushakov.
2006-10-27 01:29:17 +00:00
christos f2640eb139 simplify 421 printing code (jani at xeebioneurope dot de) 2006-10-23 19:53:24 +00:00
elad 3bd9466e80 PR/32855: der Mouse: [dM] ftp -q is broken (or misdocumented)
Patch applied, thanks!
2006-10-07 10:49:14 +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
jnemeth c287edd2a0 Coverity CID 3610: derefencing NULL pointer. 2006-05-23 23:59:48 +00:00
mrg 084c052803 quell GCC 4.1 uninitialised variable warnings.
XXX: we should audit the tree for which old ones are no longer needed
after getting the older compilers out of the tree..
2006-05-10 21:53:14 +00:00
christos 20fe0cf746 Coverity CID 1447: Avoid buffer overflow. 2006-05-01 23:02:03 +00:00
christos 186743bc31 Coverity CID 1448: Avoid static array overflow. 2006-05-01 23:00:33 +00:00
christos 69f8117233 Coverity CID 873: Only align if we printed a string. 2006-04-28 20:07:57 +00:00
christos 61e04d677f Coverity CID 874: Don't check local; it cannot be NULL. 2006-04-28 20:06:50 +00:00
christos fc5177078a Coverity CID 875: local is not allowed to be NULL; don't check for it. 2006-04-28 20:05:43 +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
lukem dccca90900 Revert back to using an int (instead of size_t) for holding a value that may
be negative.
Fixes progressbar display on terminals <43 columns wide.
Bug noted and solution suggested by Gavan Fantom.
2005-07-19 00:41:05 +00:00
wiz fdf8185afa In macdef, point to $ command (from jmc@openbsd), and split paragraph (it was getting a bit big). 2005-07-06 11:21:26 +00:00
wiz ee1fddfe1e Use more macros, and use them more consistently.
Fix a few typos.
2005-07-06 11:18:05 +00:00
lukem 5f450b0c4b Improve the description of the macros.
Patch from David H. Gutteridge in PR 24296.
2005-07-05 09:29:54 +00:00
christos b771909d19 forgot to remove the file pointer from the macro. 2005-06-29 05:00:30 +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
jmc 3f5fc9a18d Need to #ifdef around declaration of ch with NO_EDITCOMPLETE so this compiles
on rescue/miniroot's
2005-06-10 18:24:15 +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 cc5aca9af5 copyright maintenance 2005-06-09 16:38:29 +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 4011dcc7ab formatbuf(): fix %m and %M to use the hostname, not the username. 2005-05-27 14:35:50 +00:00