Fix previous commit 2427ca4ac0

This commit is contained in:
Tim Rühsen 2017-01-07 15:59:11 +01:00
parent 2427ca4ac0
commit 1a01a6b2d0
2 changed files with 8 additions and 3 deletions

View File

@ -370,6 +370,7 @@ getftp (struct url *u, struct url *original_url,
user = opt.user;
else
user = NULL;
/* Find the password with priority */
if (u->passwd)
passwd = u->passwd;
@ -381,9 +382,11 @@ getftp (struct url *u, struct url *original_url,
passwd = opt.passwd;
else
passwd = NULL;
/* Check for ~/.netrc if none of the above match */
if (opt.netrc && (!user || !passwd))
search_netrc (u->host, (const char **)&user, (const char **)&passwd, 1);
search_netrc (u->host, (const char **) &user, (const char **) &passwd, 1);
if (!user) user = "anonymous";
if (!passwd) passwd = "-wget@";

View File

@ -1886,6 +1886,7 @@ initialize_request (const struct url *u, struct http_stat *hs, int *dt, struct u
*user = opt.user;
else
*user = NULL;
/* Find the password with priority */
if (u->passwd)
*passwd = u->passwd;
@ -1897,9 +1898,10 @@ initialize_request (const struct url *u, struct http_stat *hs, int *dt, struct u
*passwd = opt.passwd;
else
*passwd = NULL;
/* Check for ~/.netrc if none of the above match */
if (opt.netrc && (!(*user) || !(*password)))
search_netrc (u->host, (const char **)user, (const char **)passwd, 0);
if (opt.netrc && (!user || !passwd))
search_netrc (u->host, (const char **) user, (const char **) passwd, 0);
/* We only do "site-wide" authentication with "global" user/password
* values unless --auth-no-challange has been requested; URL user/password