mirror of
https://github.com/curl/curl.git
synced 2026-08-26 09:53:32 +03:00
creds: hold credentials
Authorizdation credentials are kept in `struct Curl_creds`. This contains: * `user`: the username, maybe the empty string * `passwd`: the password, maybe the empty string * `sasl_authzid`: the SASL authz value, maybe the empty string * `oauth_bearer`: the OAUTH bearer token, maybe the empty string * `source`: where the credentials from from * `refcount`: a reference counter to link/unkink creds A `creds` with all values empty is equivalent to NULL, e.g. no `creds` instance. With reference counting, `creds` can be linked/unlinked in several places. See docs/internals/CREDENTIALS.md for use. Closes #21548
This commit is contained in:
parent
a32a2b0b77
commit
8f71d0fde5
47 changed files with 1138 additions and 962 deletions
|
|
@ -77,8 +77,7 @@ CURLcode Curl_output_digest(struct Curl_easy *data,
|
|||
char **allocuserpwd;
|
||||
|
||||
/* Point to the name and password for this */
|
||||
const char *userp;
|
||||
const char *passwdp;
|
||||
struct Curl_creds *creds = NULL;
|
||||
|
||||
/* Point to the correct struct with this */
|
||||
struct digestdata *digest;
|
||||
|
|
@ -90,28 +89,19 @@ CURLcode Curl_output_digest(struct Curl_easy *data,
|
|||
#else
|
||||
digest = &data->state.proxydigest;
|
||||
allocuserpwd = &data->req.hd_proxy_auth;
|
||||
userp = data->state.aptr.proxyuser;
|
||||
passwdp = data->state.aptr.proxypasswd;
|
||||
creds = data->conn->http_proxy.creds;
|
||||
authp = &data->state.authproxy;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
digest = &data->state.digest;
|
||||
allocuserpwd = &data->req.hd_auth;
|
||||
userp = data->state.aptr.user;
|
||||
passwdp = data->state.aptr.passwd;
|
||||
creds = data->state.creds;
|
||||
authp = &data->state.authhost;
|
||||
}
|
||||
|
||||
curlx_safefree(*allocuserpwd);
|
||||
|
||||
/* not set means empty */
|
||||
if(!userp)
|
||||
userp = "";
|
||||
|
||||
if(!passwdp)
|
||||
passwdp = "";
|
||||
|
||||
#ifdef USE_WINDOWS_SSPI
|
||||
have_chlg = !!digest->input_token;
|
||||
#else
|
||||
|
|
@ -123,8 +113,8 @@ CURLcode Curl_output_digest(struct Curl_easy *data,
|
|||
return CURLE_OK;
|
||||
}
|
||||
|
||||
result = Curl_auth_create_digest_http_message(data, userp, passwdp,
|
||||
request, uripath, digest,
|
||||
result = Curl_auth_create_digest_http_message(data, creds, request,
|
||||
uripath, digest,
|
||||
&response, &len);
|
||||
if(result)
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue