Commit Graph

35 Commits

Author SHA1 Message Date
Bill Fumerola
17df1e24e6 Put the FTP_PASSIVE_MODE issue to rest once and for all.
Reviewed by:	des
Obtained from:	FreeBSD's src/usr.bin/ftp/main.c
2000-05-05 17:02:32 +00:00
Jordan K. Hubbard
ca94ffbdf8 Make FTP_PASSIVE_MODE check more specific.
Suggested by:	Eric D. Futch <efutch@nyct.net>
2000-04-23 21:23:34 +00:00
Marcel Moolenaar
2dc9a8a9f6 Explicitly use sigemptyset to clear a sigset_t. Explicit
initialization of sa_flags added so that the 'struct sigaction'
can be declared local in both functions that use the global
(static) declaration. Remove the global declaration.
1999-09-28 13:33:13 +00:00
Peter Wemm
7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
Nick Sayer
96d29cd5c2 Cause PORT commands to use the high IP port range. This makes fetch
(and its friends) more firewall friendly.

PR:		10580
Submitted by:	nsayer
1999-03-30 22:06:08 +00:00
Poul-Henning Kamp
b7aac2f990 Correctly figure out that the remove cannot do passive mode.
PR:		6259
Reviewed & slightly modified by:	phk
Submitted by:	Archie Cobbs <archie@whistle.com>
1998-04-11 07:28:53 +00:00
John Birrell
68c887d440 Change errno usage as a field in a structure and as an argument to a
function from 'errno' to 'error' so that there is no conflict with the
thread-safe definition of errno in errno.h.
1997-12-20 04:06:06 +00:00
Bill Fenner
b1cb1b02f1 Teach ftpErrString to format UNIX errnos, since at least ftpLogin()
can return UNIX errnos.  When UNIX errnos catch up with FTP status
codes (e.g. at 100) a new way will have to be found to tell which
is which.

This allows fetch to print errors like
fetch: ftp.fu-berlin.de: No route to host
instead of
fetch: ftp.fu-berlin.de: Unknown error
1997-10-02 23:26:03 +00:00
Jordan K. Hubbard
dcb69d91c2 Correct an ancient bogon which involved trying to read() from a
nuked file descriptor.  This is probably why sysinstall's ftp xfer
occasionally SEGV'd if you left things alone for a long time and
the timeout code got called.  Whoops!
1997-10-01 07:21:41 +00:00
Poul-Henning Kamp
d030d2d2ae Many places in the code NULL is used in integer context, where
plain 0 should be used.  This happens to work because we #define
NULL to 0, but is stylistically wrong and can cause problems
for people trying to port bits of code to other environments.

PR:		2752
Submitted by:	Arne Henrik Juul <arnej@imf.unit.no>
1997-09-18 14:08:40 +00:00
Peter Wemm
7e546392b5 Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
Jordan K. Hubbard
b5b673ff99 Only send QUIT if the last operation didn't time out (otherwise you're
just going to hang forever on the close).
1997-01-21 20:37:59 +00:00
Jordan K. Hubbard
6164d13c71 Yow! Is my face red... I just noticed (duh) that signal() always installs
the handler with SA_RESTART set, so the system calls I wanted to have the
timeout effect will just restart instead (which is NOT what I wanted).
Sheepishly use sigaction() like a good boy and make timeouts actually do
something.

Also pass errors out more effectively so that fetch(1) actually understands
what went wrong.
1997-01-17 12:51:55 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Jordan K. Hubbard
558ad0694d Sanitize and extend SIGALRM timeout handling. 1996-12-17 20:19:35 +00:00
Andrey A. Chernov
dbf96d1210 Oops, back out previous optimization, don't work as I expect
(lack of sleep)
1996-11-14 09:51:47 +00:00
Andrey A. Chernov
bbd3d24b96 Since ftpPutURL not use hostname cache, optimize it by always closing
connection at the end of operation, so it not leave opened
file without a reason.
1996-11-14 09:44:09 +00:00
Andrey A. Chernov
0c663b7771 For functions ftpGetURL, ftpPutURL, ftpLogin it was impossible to know
FTP error return code because
1) They return NULL, it means that ftpErrno can't be used because
it takes file pointer
2) They don't have FILE-type argument as f.e. ftpGet/ftpPut to use
it for ftpErrno instead.

For that functions I add yet one int* type argument to store
FTP error return code. It is impossible to add some global variable
for that reason, because user can have multiply FTP connections
opened at the same time.

So, interface changed, major number bumped.
Userland changes will follows.

Minor bugfixes, the code:
Forget to close file in few places, when failure occurse
Forget to NULL cached host name, multiply free is possible
1996-11-14 06:59:41 +00:00
Andrey A. Chernov
9e05df0992 Oops, forget the fact that several ftp connections can be active
at the same time, so add new con_state to avoid QUIT recursion

Still should go to 2.2
1996-11-14 05:22:12 +00:00
Andrey A. Chernov
b92fd90719 1) Don't allow endless recursion in ftp_close when it attempts to
send QUIT to closed connection.
2) Preserve login failure code, don't overwrite it with ftp_close
code

Should go to 2.2
1996-11-14 05:05:26 +00:00
Jordan K. Hubbard
3643c5565c Send PASV instead of PASSIVE.
Submitted-By: Archie Cobbs <archie@whistle.com>
1996-10-10 08:34:27 +00:00
Peter Wemm
ce44402a40 Make libftpio 64-bit clean.
Major version bumped (by me) since the ftpGet() public interface has
changed (an "int *" becomes and "off_t *")

Submitted by: Jason Thorpe <thorpej@nas.nasa.gov>, PR#1640
1996-09-19 17:28:34 +00:00
Jordan K. Hubbard
55158625b4 Intelligently cache previous connection to host if we can still
use it.

Correct a typo bogon that had REST mistyped as RETR.  No wonder fetch's
restart command didn't work! :-(
1996-08-31 22:02:18 +00:00
Jordan K. Hubbard
50525d70d9 D'oh! verbose output should go to stderr. 1996-08-24 09:51:59 +00:00
Jordan K. Hubbard
92d084569b Implement a change suggested by Archie Cobbs - the seekto argument should
be zero'd only if the operation *fails*, indicating that the file
starting offset is effectively zero.  This makes more sense.
1996-08-21 01:23:33 +00:00
Jordan K. Hubbard
6f828b77f3 Add an ftpErrString() function for returning human readable failure
codes.
Submitted-By: Archie Cobbs <archie@whistle.com>
1996-08-21 01:12:11 +00:00
Jordan K. Hubbard
ccdae53c9a 1. Add verbose flag to ftp_login()
2. Remove pkg_* support - tcl7.5's channel interface has rendered this
   almost entirely unsupportable (at least in the way it currently stands).
Submitted-By: jmz & jkh
1996-08-03 11:58:54 +00:00
Jordan K. Hubbard
89689cf8c9 Implement an ftpVerbose() hook.
Submitted by: jmz
1996-07-04 00:55:21 +00:00
Jordan K. Hubbard
a2df3c3345 Fix a bug in the way binary/ascii settings were being done. New
ftpAscii() call sets connection to ascii as counterpart to ftpBinary().
1996-06-22 21:43:56 +00:00
Jordan K. Hubbard
2379c52210 Manage control connections a little better for the URL routines.
This will do as a stop-gap until I figure out a more fault-tolerant
way of having deferred closes against the control connection work
without blocking.
1996-06-17 23:16:04 +00:00
Jordan K. Hubbard
42e35dc30b Make binary mode the default. 1996-06-17 22:10:15 +00:00
Jordan K. Hubbard
386e7f9af0 Stamp out a potential memory leak.
Make ftpChdir return the server status again - it was more convenient.
1996-06-17 20:36:57 +00:00
Jordan K. Hubbard
92f6d79189 Rethink and reimpliment the way RESTARTS are handled. The method I inheirited
from jmz was a hopeless kludge (sorry Jean-Marc :) and handled the problem
in the wrong way.  ftpRestart() has now gone away and ftpGet() has grown a
new parameter.
1996-06-17 15:28:08 +00:00
Jordan K. Hubbard
1d2387de61 Add a feature: If the environment variable FTP_PASSIVE_MODE is defined
(the convention as established by pkg_install(1)), select passive mode
FTP automatically.
1996-06-17 12:42:33 +00:00
Jordan K. Hubbard
31caf7f20f Bring in a new library `libftpio', so named to avoid clashes with older
packages and also sort of give the (correct) impression that this basically
sits on top of stdio and deals with stream pointers (FILE*).
1996-06-17 12:26:06 +00:00