aboutsummaryrefslogtreecommitdiff
path: root/lib/libfetch/ftp.c
Commit message (Collapse)AuthorAgeFilesLines
* Improve URL parsing. In particular, convert scheme and host to lowercase.Dag-Erling Smørgrav2018-11-271-4/+4
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=341013
* Support proxying FTP over HTTPS, not just HTTP.Dag-Erling Smørgrav2018-11-271-1/+2
| | | | | | | | | | | There is probably a PR for this, but I can't find this, or remember who submitted it. The patch got lost in the noise of another that wasn't ready to commit. MFC after: 3 days Notes: svn path=/head/; revision=341011
* Fix an inverted conditional in the netrc code, which would ignore theDag-Erling Smørgrav2018-05-291-2/+4
| | | | | | | | | | | | value of $HOME and always use the home directory from the passwd database, unless $HOME was unset, in which case it would use (null). While there, clean up handling of netrcfd and add debugging aids. MFC after: 3 weeks Notes: svn path=/head/; revision=334326
* Use __VA_ARGS__ to simplify the DEBUG macro.Dag-Erling Smørgrav2018-05-291-8/+7
| | | | | | | MFC after: 3 weeks Notes: svn path=/head/; revision=334317
* SPDX: use the Beerware identifier.Pedro F. Giffuni2017-11-301-1/+1
| | | | Notes: svn path=/head/; revision=326408
* lib: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-261-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using mis-identified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326219
* Refactor fetch_connect() and fetch_bind() to improve readability and avoidDag-Erling Smørgrav2016-11-221-2/+2
| | | | | | | | | repeating the same DNS lookups. MFC after: 3 weeks Notes: svn path=/head/; revision=308996
* libfetch: replace 0 with NULL for pointers.Pedro F. Giffuni2016-04-091-1/+1
| | | | | | | | | Found with devel/coccinelle. Reviewed by: des Notes: svn path=/head/; revision=297754
* latin1 -> utf8Dag-Erling Smørgrav2011-10-191-2/+2
| | | | Notes: svn path=/head/; revision=226537
* Update copyright dates and strip my middle name.Dag-Erling Smørgrav2011-09-271-1/+1
| | | | Notes: svn path=/head/; revision=225814
* Think first, commit second.Dag-Erling Smørgrav2011-09-271-4/+3
| | | | | | | | | 1. Allow the caller to select active mode. 2. Fix the envar logic so it *always* overrides the caller's flags. 3. Document the change from active to passive. Notes: svn path=/head/; revision=225812
* Long overdue: make passive mode the default for ftp.Dag-Erling Smørgrav2011-09-271-2/+2
| | | | Notes: svn path=/head/; revision=225810
* Increase WARNS to 4.Dag-Erling Smørgrav2011-05-121-1/+1
| | | | Notes: svn path=/head/; revision=221822
* Fix a bug related to connection caching which could cause a crash afterDag-Erling Smørgrav2011-01-171-0/+1
| | | | | | | | | | | a STAT command. PR: kern/153748 (different patch) Submitted by: Mark Johnston <markjdb@gmail.com> MFC after: 2 weeks Notes: svn path=/head/; revision=217505
* Fix a socket leak in ftp_request() after that a connection is established.Attilio Rao2009-11-251-3/+9
| | | | | | | | | | Submitted by: Sandvine Incorporated Reviewed by: des, emaste Sponsored by: Sandvine Incorporated MFC: 1 week Notes: svn path=/head/; revision=199801
* Use memcpy(3) instead of the BSD-specific bcopy(3).Dag-Erling Smørgrav2008-02-081-4/+4
| | | | | | | | Submitted by: Joerg Sonnenberger <joerg@britannica.bec.de> MFC after: 2 weeks Notes: svn path=/head/; revision=176105
* Fix a regression introduced in rev 1.99: replace fclose(f) with a commentDag-Erling Smørgrav2008-01-231-1/+5
| | | | | | | | | explaining why f cannot possibly be a valid FILE * at this point. MFC after: 1 day Notes: svn path=/head/; revision=175611
* As several people pointed out, I did all the ctype casts the wrongDag-Erling Smørgrav2007-12-191-11/+17
| | | | | | | | | | way (not for the first time...) Noticed by: bde, ru ++ MFC after: 1 week Notes: svn path=/head/; revision=174761
* Add support for the NO_PROXY / no_proxy environment variable as used byDag-Erling Smørgrav2007-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 Notes: svn path=/head/; revision=174752
* Old patch I had lying around: correctly cast the argument to is*().Dag-Erling Smørgrav2007-12-181-10/+10
| | | | | | | | | IWBNI gcc could warn about this the way it warns about printf() abuse. MFC after: 1 week Notes: svn path=/head/; revision=174751
* Clean up namespace violations.Dag-Erling Smørgrav2007-12-141-116/+116
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=174588
* Add back the original behavior of changing the entire directory path atNate Lawson2007-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 Notes: svn path=/head/; revision=168960
* Respect FETCH_BIND_ADDRESS when opening the data connection.Dag-Erling Smørgrav2006-06-131-0/+5
| | | | | | | PR: misc/98872 Notes: svn path=/head/; revision=159566
* Fix a bug introduced in rev 1.92, where, when changing from one directoryDag-Erling Smørgrav2006-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 Notes: svn path=/head/; revision=159565
* In order to maintain interoperability with certain broken FTP servers,Dag-Erling Smørgrav2006-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 Notes: svn path=/head/; revision=154550
* Change directory one level at a time, and use CDUP to back out. This is aDag-Erling Smørgrav2005-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 Notes: svn path=/head/; revision=148986
* Update copyright years.Dag-Erling Smørgrav2004-09-211-1/+1
| | | | Notes: svn path=/head/; revision=135546
* 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-665/+670
| | | | | | | | 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