summaryrefslogtreecommitdiffstats
path: root/lib/libfetch/ftp.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix a socket leak in ftp_request() after that a connection is established.attilio2009-11-251-3/+9
| | | | | | | Submitted by: Sandvine Incorporated Reviewed by: des, emaste Sponsored by: Sandvine Incorporated MFC: 1 week
* Use memcpy(3) instead of the BSD-specific bcopy(3).des2008-02-081-4/+4
| | | | | Submitted by: Joerg Sonnenberger <joerg@britannica.bec.de> MFC after: 2 weeks
* Fix a regression introduced in rev 1.99: replace fclose(f) with a commentdes2008-01-231-1/+5
| | | | | | explaining why f cannot possibly be a valid FILE * at this point. MFC after: 1 day
* As several people pointed out, I did all the ctype casts the wrongdes2007-12-191-11/+17
| | | | | | | way (not for the first time...) Noticed by: bde, ru ++ MFC after: 1 week
* Add support for the NO_PROXY / no_proxy environment variable as used bydes2007-12-181-5/+7
| | | | | | | | | lynx, curl etc. Note that this patch differs significantly from that in the PR, as the submitter refined it after submitting the PR. PR: 110388 Submitted by: Alexander Pohoyda <alexander.pohoyda@gmx.net> MFC after: 3 weeks
* Old patch I had lying around: correctly cast the argument to is*().des2007-12-181-10/+10
| | | | | | IWBNI gcc could warn about this the way it warns about printf() abuse. MFC after: 1 week
* Clean up namespace violations.des2007-12-141-116/+116
| | | | MFC after: 1 week
* Add back the original behavior of changing the entire directory path atnjl2007-04-221-1/+23
| | | | | | | | | | once (CWD a/b/c vs. 3 CWDs). If an error occurs, we fall back to the default method of a single CWD per directory element. Since this is technically a violation of the basic FTP RFC, this behavior is under a compile-time option FTP_COMBINE_CWDS and is off by default. It should work with most Unix-based FTP daemons and can save latency. MFC after: 2 weeks
* Respect FETCH_BIND_ADDRESS when opening the data connection.des2006-06-131-0/+5
| | | | PR: misc/98872
* Fix a bug introduced in rev 1.92, where, when changing from one directorydes2006-06-131-0/+2
| | | | | | | | to another, the first CWD after a string of CDUPs would incorrectly include a slash before the directory name. Reported by: obrien PR: bin/83278
* In order to maintain interoperability with certain broken FTP servers,des2006-01-191-2/+18
| | | | | | | ignore a MODE failure if and only if the mode we attempted to set was S (which is supposed to be the default). PR: bin/91973
* Change directory one level at a time, and use CDUP to back out. This is ades2005-08-121-29/+152
| | | | | | | work in progress; it partially fixed bin/83278 and is a prerequisite to fixing bin/83277. PR: bin/83277, bin/83278
* Update copyright years.des2004-09-211-1/+1
|
* Don't close a FILE * which we know is bogus.des2003-08-291-1/+0
|
* Some servers respond to RETR in active mode with 125 (connection alreadydes2003-08-191-1/+1
| | | | | | | | open) rather than 150 (opening connection). There's no reason why we shouldn't accept that. PR: misc/42172 MFC in: 3 days
* The flags passed in to _ftp_get_proxy may be nullmtm2003-03-191-1/+1
| | | | Approved by: des, markm (mentor)(implicit)
* Don't parse the proxy URL unless we're actually going to use it. No realdes2003-03-111-5/+10
| | | | functional difference, but debugging output will be less confusing.
* style(9): add parentheses to sizeof even when not strictly required.des2003-01-281-6/+6
| | | | MFC after: 3 days
* Hook in the .netrc code + don't use pointers as if they were booleans.des2003-01-221-4/+6
|
* The FTP connection caching needs a better interface -- connections arenjl2002-10-251-0/+4
| | | | | | | | | | | | | closed through _fetch_close() which is the only one who knows the connection REALLY was closed (since ref -> 0). However, FTP keeps its own local cached_connection and checks if it is valid by comparing it to NULL. This is bogus since it may have been freed elsewhere by _fetch_close(). This change checks if we are closing the cached_connection and the ref is 1 (soon to be 0). If so, set cached_connection to NULL so we don't accidentally reuse it. The REAL fix should be to move connection caching to the common.c level (_fetch_* functions) and NULL the cache(s) in _fetch_close(). Then all layers could benefit from caching.
* When recycling a cached connection, increment the reference count so thattjr2002-10-201-1/+1
| | | | | the heap block does not get freed and reused. This should fix the pkg_add -r crashes that have been happening for months.
* Make _fetch_connect() always set the error code.fenner2002-09-171-3/+2
| | | | Tell ftp that _fetch_connect() always sets the error code (http already knew)
* Cope with 2292bis-01 getaddrinfo (no NI_WITHSCOPEID, always attachume2002-07-021-0/+1
| | | | | | | scope identifier). Approved by: des MFC after: 3 weeks
* Add a reference count to struct fetchconn so we don't prematurely close anddes2002-06-111-1/+1
| | | | free a cached FTP connection.
* Wrap everything in struct connection, and enforce timeouts everywheredes2002-06-051-15/+17
| | | | | (except for DNS operations). Always use funopen() for HTTP, to support both timeouts and SSL.
* First step towards SSL support: wrap connections in a 'struct connection'des2002-06-051-92/+89
| | | | | | | | | | which contains the socket descriptor, the input buffer and (yet unused) SSL state variables. This has the neat side effect of greatly improving reentrance (though we're not *quite* there yet) and opening the door to HTTP connection caching. This commit is inspired by email conversations with and patches from Henry Whincup <henry@techiebod.com> last fall.
* Modernize my email addressphk2002-03-251-1/+1
|
* Reindent, and add parentheses to return statements. Some functions indes2002-02-051-689/+694
| | | | | ftp.c and http.c now have exceedingly long lines due to deep nesting; this will be corrected by reorganizing the code in a later revision.
* Mark uploads as O_WRONLY, not O_RDONLY.des2002-01-201-2/+6
| | | | | PR: misc/34043 MFC after: 2 weeks
* Remove VT100 escapes from debugging messages now that they're enabled bydes2002-01-011-3/+2
| | | | | | | default. PR: 32988 MFC after: 3 days
* Reorganize to reduce code duplication.des2001-12-041-64/+32
|
* Tons of type, style and warning fixes that have been rotting in my tree fordes2001-10-181-29/+29
| | | | | ages - some of which wouldn't be necessary if gcc wasn't broken or TPTB were willing to do something (-fno-builtin) about it.
* Add __FBSDID()s to libfetchdillon2001-09-301-2/+3
|
* Handle snprintf() returning < 0 (not just -1)brian2001-08-201-1/+1
| | | | MFC after: 2 weeks
* Handle snrintf overflows.brian2001-08-201-0/+2
| | | | Spotted by: bde
* Handle snprintf() returning -1.brian2001-08-201-1/+2
| | | | MFC after: 2 weeks
* Don't call _ftp_closefn() upon EOF in _ftp_readfn(); just return 0. Thisdes2001-06-111-1/+1
| | | | fixes a bug in pkg_add(1) (which nobody noticed because of another bug).
* Add rudimentary support for an authentication callback function.des2001-05-261-41/+45
|
* Plug memory leak.des2001-05-261-6/+3
| | | | PR: 27506
* Apply 'const' liberally.archie2001-04-241-17/+19
| | | | Fix some other minor glitches.
* If the server's reply to the SIZE command is unparseable, reset us->sizedes2001-04-071-0/+1
| | | | to -1 so the caller will know it's invalid. This is an MFC candidate.
* Use high port range by default, and replace the 'h' option with an 'l' optiondes2001-03-241-4/+4
| | | | that forces the ftp code to use the low (default) port range instead.
* Don't remember an EINTR, since the caller may want to restart the call.des2001-03-071-2/+4
|
* Support lower-case versions of the proxy environment variables.des2001-03-071-2/+3
| | | | PR: bin/25494
* Use "anonymous" rather than "ftp" as login name for anonymous ftp.des2001-01-081-3/+2
| | | | | | Rather than have a separate (misnamed) FTP_ANONYMOUS_PASSWORD constant, use FTP_ANONYMOUS_USER (i.e. "anonymous") to construct the anonymous ftp password if getlogin() fails.
* Check the FTP_LOGIN environment variable before falling back ondes2000-12-221-0/+2
| | | | FTP_ANONYMOUS_USER.
* Somewhere along the line, I misunderstood the whole FTP_PASSIVE_MODE debatedes2000-12-061-1/+1
| | | | | | | and had libfetch selecting passive mode even when FTP_PASSIVE_MODE was not set at all, which is really quite surprising unless you know about it. So change it to the agreed default behaviour of selecting passive mode if FTP_PASSIVE_MODE is set, but not "no".
* Fix old-style proxy specs: default to FTP if FTP_PROXY was set; only defaultdes2000-11-271-2/+6
| | | | to HTTP if HTTP_PROXY was used instead.
* Don't go haywire if the server closes the connection in the middle of ades2000-11-221-1/+1
| | | | multiline response (proper fix this time).
* Revert previous commit, it was somewhat hasty.des2000-11-221-5/+1
|
OpenPOWER on IntegriCloud