summaryrefslogtreecommitdiffstats
path: root/lib/libfetch
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2003-01-22 17:54:49 +0000
committerdes <des@FreeBSD.org>2003-01-22 17:54:49 +0000
commit48ceb170df6373fde1166d862d1dc0e2430ef719 (patch)
tree4097fbf009bacec958788d3465b72dcd7bfee423 /lib/libfetch
parent0e59d6fe5806bbfebf0aa5e60e652ac145f8d59c (diff)
downloadFreeBSD-src-48ceb170df6373fde1166d862d1dc0e2430ef719.zip
FreeBSD-src-48ceb170df6373fde1166d862d1dc0e2430ef719.tar.gz
Hook in the .netrc code + don't use pointers as if they were booleans.
Diffstat (limited to 'lib/libfetch')
-rw-r--r--lib/libfetch/ftp.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/libfetch/ftp.c b/lib/libfetch/ftp.c
index f564592..37878bd 100644
--- a/lib/libfetch/ftp.c
+++ b/lib/libfetch/ftp.c
@@ -730,10 +730,12 @@ _ftp_authenticate(conn_t *conn, struct url *url, struct url *purl)
/* XXX FTP_AUTH, and maybe .netrc */
/* send user name and password */
+ if (url->user[0] == '\0')
+ _fetch_netrc_auth(url);
user = url->user;
- if (!user || !*user)
+ if (*user == '\0')
user = getenv("FTP_LOGIN");
- if (!user || !*user)
+ if (user == NULL || *user == '\0')
user = FTP_ANONYMOUS_USER;
if (purl && url->port == _fetch_default_port(url->scheme))
e = _ftp_cmd(conn, "USER %s@%s", user, url->host);
@@ -745,9 +747,9 @@ _ftp_authenticate(conn_t *conn, struct url *url, struct url *purl)
/* did the server request a password? */
if (e == FTP_NEED_PASSWORD) {
pwd = url->pwd;
- if (!pwd || !*pwd)
+ if (*pwd == '\0')
pwd = getenv("FTP_PASSWORD");
- if (!pwd || !*pwd) {
+ if (pwd == NULL || *pwd == '\0') {
if ((logname = getlogin()) == 0)
logname = FTP_ANONYMOUS_USER;
if ((len = snprintf(pbuf, MAXLOGNAME + 1, "%s@", logname)) < 0)
OpenPOWER on IntegriCloud