summaryrefslogtreecommitdiff
path: root/lib/libfetch/ftp.c
Commit message (Collapse)AuthorAgeFilesLines
* Don't close a FILE * which we know is bogus.Dag-Erling Smørgrav2003-08-291-1/+0
| | | | Notes: svn path=/head/; revision=119557
* Some servers respond to RETR in active mode with 125 (connection alreadyDag-Erling Smørgrav2003-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 Notes: svn path=/head/; revision=119123
* The flags passed in to _ftp_get_proxy may be nullMike Makonnen2003-03-191-1/+1
| | | | | | | Approved by: des, markm (mentor)(implicit) Notes: svn path=/head/; revision=112420
* Don't parse the proxy URL unless we're actually going to use it. No realDag-Erling Smørgrav2003-03-111-5/+10
| | | | | | | functional difference, but debugging output will be less confusing. Notes: svn path=/head/; revision=112081
* style(9): add parentheses to sizeof even when not strictly required.Dag-Erling Smørgrav2003-01-281-6/+6
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=109967
* Hook in the .netrc code + don't use pointers as if they were booleans.Dag-Erling Smørgrav2003-01-221-4/+6
| | | | Notes: svn path=/head/; revision=109697
* The FTP connection caching needs a better interface -- connections areNate Lawson2002-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. Notes: svn path=/head/; revision=105903
* When recycling a cached connection, increment the reference count so thatTim J. Robbins2002-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. Notes: svn path=/head/; revision=105511
* Make _fetch_connect() always set the error code.Bill Fenner2002-09-171-3/+2
| | | | | | | Tell ftp that _fetch_connect() always sets the error code (http already knew) Notes: svn path=/head/; revision=103459
* Cope with 2292bis-01 getaddrinfo (no NI_WITHSCOPEID, always attachHajimu UMEMOTO2002-07-021-0/+1
| | | | | | | | | | scope identifier). Approved by: des MFC after: 3 weeks Notes: svn path=/head/; revision=99253
* Add a reference count to struct fetchconn so we don't prematurely close andDag-Erling Smørgrav2002-06-111-1/+1
| | | | | | | free a cached FTP connection. Notes: svn path=/head/; revision=98117
* Wrap everything in struct connection, and enforce timeouts everywhereDag-Erling Smørgrav2002-06-051-15/+17
| | | | | | | | (except for DNS operations). Always use funopen() for HTTP, to support both timeouts and SSL. Notes: svn path=/head/; revision=97866
* First step towards SSL support: wrap connections in a 'struct connection'Dag-Erling Smørgrav2002-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. Notes: svn path=/head/; revision=97856
* Modernize my email addressPoul-Henning Kamp2002-03-251-1/+1
| | | | Notes: svn path=/head/; revision=93150
* Reindent, and add parentheses to return statements. Some functions inDag-Erling Smørgrav2002-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. Notes: svn path=/head/; revision=90267
* Mark uploads as O_WRONLY, not O_RDONLY.Dag-Erling Smørgrav2002-01-201-2/+6
| | | | | | | | PR: misc/34043 MFC after: 2 weeks Notes: svn path=/head/; revision=89589
* Remove VT100 escapes from debugging messages now that they're enabled byDag-Erling Smørgrav2002-01-011-3/+2
| | | | | | | | | | default. PR: 32988 MFC after: 3 days Notes: svn path=/head/; revision=88769
* Reorganize to reduce code duplication.Dag-Erling Smørgrav2001-12-041-64/+32
| | | | Notes: svn path=/head/; revision=87315
* Tons of type, style and warning fixes that have been rotting in my tree forDag-Erling Smørgrav2001-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. Notes: svn path=/head/; revision=85093
* Add __FBSDID()s to libfetchMatthew Dillon2001-09-301-2/+3
| | | | Notes: svn path=/head/; revision=84203
* Handle snprintf() returning < 0 (not just -1)Brian Somers2001-08-201-1/+1
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=81985
* Handle snrintf overflows.Brian Somers2001-08-201-0/+2
| | | | | | | Spotted by: bde Notes: svn path=/head/; revision=81978
* Handle snprintf() returning -1.Brian Somers2001-08-201-1/+2
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=81972
* Don't call _ftp_closefn() upon EOF in _ftp_readfn(); just return 0. ThisDag-Erling Smørgrav2001-06-111-1/+1
| | | | | | | fixes a bug in pkg_add(1) (which nobody noticed because of another bug). Notes: svn path=/head/; revision=78071
* Add rudimentary support for an authentication callback function.Dag-Erling Smørgrav2001-05-261-41/+45
| | | | Notes: svn path=/head/; revision=77238
* Plug memory leak.Dag-Erling Smørgrav2001-05-261-6/+3
| | | | | | | PR: 27506 Notes: svn path=/head/; revision=77234
* Apply 'const' liberally.Archie Cobbs2001-04-241-17/+19
| | | | | | | Fix some other minor glitches. Notes: svn path=/head/; revision=75891
* If the server's reply to the SIZE command is unparseable, reset us->sizeDag-Erling Smørgrav2001-04-071-0/+1
| | | | | | | to -1 so the caller will know it's invalid. This is an MFC candidate. Notes: svn path=/head/; revision=75292
* Use high port range by default, and replace the 'h' option with an 'l' optionDag-Erling Smørgrav2001-03-241-4/+4
| | | | | | | that forces the ftp code to use the low (default) port range instead. Notes: svn path=/head/; revision=74716
* Don't remember an EINTR, since the caller may want to restart the call.Dag-Erling Smørgrav2001-03-071-2/+4
| | | | Notes: svn path=/head/; revision=73934
* Support lower-case versions of the proxy environment variables.Dag-Erling Smørgrav2001-03-071-2/+3
| | | | | | | PR: bin/25494 Notes: svn path=/head/; revision=73932
* Use "anonymous" rather than "ftp" as login name for anonymous ftp.Dag-Erling Smørgrav2001-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. Notes: svn path=/head/; revision=70795
* Check the FTP_LOGIN environment variable before falling back onDag-Erling Smørgrav2000-12-221-0/+2
| | | | | | | FTP_ANONYMOUS_USER. Notes: svn path=/head/; revision=70273
* Somewhere along the line, I misunderstood the whole FTP_PASSIVE_MODE debateDag-Erling Smørgrav2000-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". Notes: svn path=/head/; revision=69670
* Fix old-style proxy specs: default to FTP if FTP_PROXY was set; only defaultDag-Erling Smørgrav2000-11-271-2/+6
| | | | | | | to HTTP if HTTP_PROXY was used instead. Notes: svn path=/head/; revision=69272
* Don't go haywire if the server closes the connection in the middle of aDag-Erling Smørgrav2000-11-221-1/+1
| | | | | | | multiline response (proper fix this time). Notes: svn path=/head/; revision=69044
* Revert previous commit, it was somewhat hasty.Dag-Erling Smørgrav2000-11-221-5/+1
| | | | Notes: svn path=/head/; revision=69043
* Don't go haywire if the server closes the connection during a multilineDag-Erling Smørgrav2000-11-221-1/+5
| | | | | | | response. Notes: svn path=/head/; revision=69041
* Use the documented (and historical) defaults. Centralize the decision logicDag-Erling Smørgrav2000-11-101-17/+4
| | | | | | | | | in order to avoid this bug in the future. Submitted by: se Notes: svn path=/head/; revision=68551
* Use CHECK_FLAGDag-Erling Smørgrav2000-10-291-11/+11
| | | | Notes: svn path=/head/; revision=67892
* Stricter error checking in the I/O functions.Dag-Erling Smørgrav2000-10-291-1/+25
| | | | Notes: svn path=/head/; revision=67890
* Fix this my way. David had absolutely no call overriding MAINTAINER withoutDag-Erling Smørgrav2000-10-281-3/+3
| | | | | | | even giving me 24 hours to read his mail and find the bug. Notes: svn path=/head/; revision=67810
* Repeat after me, "check to see that a pointer isn't NULL beforeDavid E. O'Brien2000-10-281-3/+3
| | | | | | | dereferenceing it". This fixes ``pkg_add -r''. Notes: svn path=/head/; revision=67807
* MFS: don't expect result code until you close the data connectionDag-Erling Smørgrav2000-10-271-3/+3
| | | | Notes: svn path=/head/; revision=67707
* Use funopen() instead of fdopen(). This fixes three problems:Dag-Erling Smørgrav2000-10-221-4/+118
| | | | | | | | | | | | | | | | | - ftpTimeout was not honored when reading actual data, as opposed to talking protocol - connection caching was broken because _ftp_cached_connect() would see the result of the transfer instead of the result of the NOOP. - if the RETR succeeded, but an error occurred later (as can happen when talking to a proxy), the error would not be detected. There still remains to register an atexit(3) callback to close the cached connection gracefully instead of just dropping it on the floor. Notes: svn path=/head/; revision=67430
* Argh! Fix passive mode selection (again)Dag-Erling Smørgrav2000-10-171-2/+3
| | | | Notes: svn path=/head/; revision=67259
* Use the right user nameDag-Erling Smørgrav2000-10-131-3/+3
| | | | Notes: svn path=/head/; revision=67055
* Rework proxy handling so that proxies can be specified as URLs.Dag-Erling Smørgrav2000-10-121-74/+91
| | | | | | | As a side effect, remove a lot of duplicate and now redundant code. Notes: svn path=/head/; revision=67043
* Grok 125 replies to passive RETR. This fixes an interoperability bug withDag-Erling Smørgrav2000-08-211-1/+2
| | | | | | | | | Microsoft FTP Service. Reported by: asmodai, eivind Notes: svn path=/head/; revision=64883
* Don't fail if _ftp_stat() reports a protocol error, since that most likelyDag-Erling Smørgrav2000-07-271-0/+1
| | | | | | | | | | means that the server doesn't understand SIZE or MDTM, which should not be a hard failure. Submitted by: ume Notes: svn path=/head/; revision=63910