Index: lib/url.c =================================================================== RCS file: /cvsroot/curl/curl/lib/url.c,v retrieving revision 1.254 retrieving revision 1.255 diff -u -r1.254 -r1.255 --- lib/url.c 16 Jan 2003 21:08:13 -0000 1.254 +++ lib/url.c 20 Jan 2003 12:00:46 -0000 1.255 @@ -2491,9 +2491,6 @@ /* no name given, get the password only */ sscanf(userpass, ":%127[^@]", data->state.passwd); - /* we have set the password */ - data->state.passwdgiven = TRUE; - if(data->state.user[0]) { char *newname=curl_unescape(data->state.user, 0); if(strlen(newname) < sizeof(data->state.user)) { @@ -2510,6 +2507,9 @@ strcpy(data->state.passwd, newpasswd); } free(newpasswd); + + /* we have set the password */ + data->state.passwdgiven = TRUE; } } } @@ -2538,15 +2538,18 @@ sscanf(data->set.userpwd+1, "%127[^\n]", data->state.passwd); } - if (data->set.use_netrc != CURL_NETRC_IGNORED && + if ((data->set.use_netrc != CURL_NETRC_IGNORED) && !data->state.passwdgiven) { /* need passwd */ if(Curl_parsenetrc(conn->hostname, data->state.user, data->state.passwd)) { infof(data, "Couldn't find host %s in the .netrc file, using defaults", conn->hostname); - } else + } + else { conn->bits.user_passwd = 1; /* enable user+password */ + data->state.passwdgiven = TRUE; + } } /* if we have a user but no password, ask for one */