diff options
author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2003-01-22 17:54:49 +0000 |
---|---|---|
committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2003-01-22 17:54:49 +0000 |
commit | 9f808a4dd09d10191d25692ed072e53978ebe7f5 (patch) | |
tree | 4097fbf009bacec958788d3465b72dcd7bfee423 /lib/libfetch/ftp.c | |
parent | caf319763628ab3d926ab14266d60cceff2bedb2 (diff) |
Notes
Diffstat (limited to 'lib/libfetch/ftp.c')
-rw-r--r-- | lib/libfetch/ftp.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/libfetch/ftp.c b/lib/libfetch/ftp.c index f56459270e60..37878bd0c0af 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) |