Jean-Philippe Barrette-LaPierre fixed the CURLOPT_PASSWDFUNCTION to make
NULL set back the internal default function
This commit is contained in:
parent
b86e543a13
commit
017be8a882
18
lib/url.c
18
lib/url.c
@ -765,6 +765,13 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
|
||||
* Password prompt callback
|
||||
*/
|
||||
data->set.fpasswd = va_arg(param, curl_passwd_callback);
|
||||
/*
|
||||
* if the callback provided is null, reset the default callback
|
||||
*/
|
||||
if(!data->set.fpasswd)
|
||||
{
|
||||
data->set.fpasswd = my_getpass;
|
||||
}
|
||||
break;
|
||||
case CURLOPT_PASSWDDATA:
|
||||
/*
|
||||
@ -1460,9 +1467,12 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
||||
data->set.fpasswd(data->set.passwd_client,
|
||||
"password:", data->state.passwd,
|
||||
sizeof(data->state.passwd)))
|
||||
{
|
||||
failf(data, "Bad password from password callback");
|
||||
return CURLE_BAD_PASSWORD_ENTERED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
* Take care of proxy authentication stuff
|
||||
@ -1486,9 +1496,11 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
||||
data->set.fpasswd( data->set.passwd_client,
|
||||
"proxy password:",
|
||||
data->state.proxypasswd,
|
||||
sizeof(data->state.proxypasswd)))
|
||||
sizeof(data->state.proxypasswd))) {
|
||||
failf(data, "Bad password from password callback");
|
||||
return CURLE_BAD_PASSWORD_ENTERED;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1860,9 +1872,11 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
||||
if(!data->set.fpasswd ||
|
||||
data->set.fpasswd(data->set.passwd_client,
|
||||
"password:", data->state.passwd,
|
||||
sizeof(data->state.passwd)))
|
||||
sizeof(data->state.passwd))) {
|
||||
failf(data, "Bad password from password callback");
|
||||
return CURLE_BAD_PASSWORD_ENTERED;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* we have a password found in the URL, decode it! */
|
||||
char *newpasswd=curl_unescape(data->state.passwd, 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user