Commit Graph

484 Commits

Author SHA1 Message Date
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
lukem bed2c16589 Improve method used in fileindir() to determine if `file' is in or under `dir':
realpath(3) on non-NetBSD systems may fail if the target filename doesn't
exist, so instead use realpath(3) on the parent directory of `file'.
Per discussion with Todd Eigenschink.
2005-05-26 02:59:34 +00:00
he d316ef3d77 Printf field widths and size_t don't always mix well, so cast to int.
Fixes build problem for alpha.
2005-05-20 07:26:01 +00:00
jdc 9c9b601a23 Make this compile on sparc64 (size_t != int). 2005-05-20 06:13:23 +00:00
lukem 943e24eb27 tab cleanup 2005-05-19 03:14:52 +00:00
lukem dc6635b518 Use size_t instead of int where appropriate. 2005-05-19 03:05:04 +00:00
lukem 947172fa2b Some const cleanups. 2005-05-19 02:55:37 +00:00
dsl 4ed2a0cea6 Helps if the definition of xconnect() matches its declaration.... 2005-05-14 18:56:45 +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 8b69a0f5ac * Correct the "optlen" argument passed to getsockopt(3) and setsockopt(3)
in various places.  Fixes a problem noted by Allen Briggs.
* Improve warning printed when connect(2) for the data channel fails.
2005-05-13 05:03:49 +00:00
lukem 9ffae1bf46 Use socklen_t instead of int as the 5th argument to getsockopt().
Improve invocation of setsockopt() and associated failure messages.
2005-05-11 02:29:12 +00:00
lukem 9607ad079e Prevent an overly-long input line causing a core dump when editing is enabled.
Issue noted by Ryoji Kanai in FreeBSD Problem Report # 77158.
2005-05-10 22:59:52 +00:00
lukem 1a090f24c2 correct a comment 2005-05-07 16:19:13 +00:00
lukem b7856deff5 typo in previous 2005-04-11 05:47:56 +00:00
lukem a2fc7ddaf6 gratuitous whitespace cleanup (before someone else jumps the gun...) 2005-04-11 01:49:31 +00:00
lukem 50ff8d4548 Implement a timeout on the accept(2) in dataconn() and the
connect(2) in xconnect() by temporarily setting O_NONBLOCK
on the socket and using xpoll() to wait for the operation
to succeed.
The timeout used is the '-q quittime' argument (defaults to
60s for accept(2), and the system default for connect(2)).
Idea inspired by discussion with Chuck Cranor.
This may (indirectly) fix various problems with timeouts
in active mode through broken firewalls.

Implement xpoll() as a wrapper around poll(2), to make it
easier to replace on systems without a functional poll(2).
Unconditionally use xpoll() instead of conditionally using
select(2) or poll(2).
2005-04-11 01:43: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
wiz aa3d6fa3ca If we mark up RFC, then avoid using "command modifier" for it. 2005-02-20 20:54:01 +00:00
jmc 51da0bca2c As dsl points out, sysinst uses the progress bar so put it back on SMALLPROG 2005-02-11 15:13:28 +00:00
simonb 3cebd9325e White space nit- don't put a space before/after increment/decrement
operators.
2005-02-11 06:21:21 +00:00
jmc dc984029fd White space nit 2005-02-10 16:00:38 +00:00
jmc 5f0e6eb14f Fix compilation issues for NO_PROGRESS 2005-02-10 16:00:28 +00:00
jmc c55ede16a2 Add NO_PROGRESS for -DSMALL 2005-02-10 16:00:06 +00:00
christos 199b39279a Factor out common string processing code eliminating static buffers,
making functions that should be static be static, and cleaning up
const usage. Added a guard against buffer overflow, but the domap function
is a bit too complicated for me to tackle right now. I will leave it
to the author; hi luke!
2005-02-09 23:17:27 +00:00