oauth2: Don't use XOAUTH2 in OAuth 2.0 variables
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
* RFC4422 Simple Authentication and Security Layer (SASL)
|
* RFC4422 Simple Authentication and Security Layer (SASL)
|
||||||
* RFC4616 PLAIN authentication
|
* RFC4616 PLAIN authentication
|
||||||
* RFC6749 OAuth 2.0 Authorization Framework
|
* RFC6749 OAuth 2.0 Authorization Framework
|
||||||
|
* RFC7628 A Set of SASL Mechanisms for OAuth
|
||||||
* Draft LOGIN SASL Mechanism <draft-murchison-sasl-login-00.txt>
|
* Draft LOGIN SASL Mechanism <draft-murchison-sasl-login-00.txt>
|
||||||
*
|
*
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
@@ -1443,14 +1444,14 @@ CURLcode Curl_sasl_start(struct SASL *sasl, struct connectdata *conn,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if((enabledmechs & SASL_MECH_XOAUTH2) || conn->xoauth2_bearer) {
|
if((enabledmechs & SASL_MECH_XOAUTH2) || conn->oauth_bearer) {
|
||||||
mech = SASL_MECH_STRING_XOAUTH2;
|
mech = SASL_MECH_STRING_XOAUTH2;
|
||||||
state1 = SASL_XOAUTH2;
|
state1 = SASL_XOAUTH2;
|
||||||
sasl->authused = SASL_MECH_XOAUTH2;
|
sasl->authused = SASL_MECH_XOAUTH2;
|
||||||
|
|
||||||
if(force_ir || data->set.sasl_ir)
|
if(force_ir || data->set.sasl_ir)
|
||||||
result = sasl_create_xoauth2_message(data, conn->user,
|
result = sasl_create_xoauth2_message(data, conn->user,
|
||||||
conn->xoauth2_bearer,
|
conn->oauth_bearer,
|
||||||
&resp, &len);
|
&resp, &len);
|
||||||
}
|
}
|
||||||
else if(enabledmechs & SASL_MECH_LOGIN) {
|
else if(enabledmechs & SASL_MECH_LOGIN) {
|
||||||
@@ -1629,7 +1630,7 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct connectdata *conn,
|
|||||||
case SASL_XOAUTH2:
|
case SASL_XOAUTH2:
|
||||||
/* Create the authorisation message */
|
/* Create the authorisation message */
|
||||||
result = sasl_create_xoauth2_message(data, conn->user,
|
result = sasl_create_xoauth2_message(data, conn->user,
|
||||||
conn->xoauth2_bearer, &resp, &len);
|
conn->oauth_bearer, &resp, &len);
|
||||||
break;
|
break;
|
||||||
case SASL_CANCEL:
|
case SASL_CANCEL:
|
||||||
/* Remove the offending mechanism from the supported list */
|
/* Remove the offending mechanism from the supported list */
|
||||||
|
|||||||
@@ -2725,7 +2725,7 @@ static void conn_free(struct connectdata *conn)
|
|||||||
|
|
||||||
Curl_safefree(conn->user);
|
Curl_safefree(conn->user);
|
||||||
Curl_safefree(conn->passwd);
|
Curl_safefree(conn->passwd);
|
||||||
Curl_safefree(conn->xoauth2_bearer);
|
Curl_safefree(conn->oauth_bearer);
|
||||||
Curl_safefree(conn->options);
|
Curl_safefree(conn->options);
|
||||||
Curl_safefree(conn->proxyuser);
|
Curl_safefree(conn->proxyuser);
|
||||||
Curl_safefree(conn->proxypasswd);
|
Curl_safefree(conn->proxypasswd);
|
||||||
@@ -5535,8 +5535,8 @@ static CURLcode create_conn(struct SessionHandle *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(data->set.str[STRING_BEARER]) {
|
if(data->set.str[STRING_BEARER]) {
|
||||||
conn->xoauth2_bearer = strdup(data->set.str[STRING_BEARER]);
|
conn->oauth_bearer = strdup(data->set.str[STRING_BEARER]);
|
||||||
if(!conn->xoauth2_bearer) {
|
if(!conn->oauth_bearer) {
|
||||||
result = CURLE_OUT_OF_MEMORY;
|
result = CURLE_OUT_OF_MEMORY;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -915,7 +915,7 @@ struct connectdata {
|
|||||||
char *passwd; /* password string, allocated */
|
char *passwd; /* password string, allocated */
|
||||||
char *options; /* options string, allocated */
|
char *options; /* options string, allocated */
|
||||||
|
|
||||||
char *xoauth2_bearer; /* bearer token for OAuth 2.0, allocated */
|
char *oauth_bearer; /* bearer token for OAuth 2.0, allocated */
|
||||||
|
|
||||||
char *proxyuser; /* proxy user name string, allocated */
|
char *proxyuser; /* proxy user name string, allocated */
|
||||||
char *proxypasswd; /* proxy password string, allocated */
|
char *proxypasswd; /* proxy password string, allocated */
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ static void free_config_fields(struct OperationConfig *config)
|
|||||||
Curl_safefree(config->customrequest);
|
Curl_safefree(config->customrequest);
|
||||||
Curl_safefree(config->krblevel);
|
Curl_safefree(config->krblevel);
|
||||||
|
|
||||||
Curl_safefree(config->xoauth2_bearer);
|
Curl_safefree(config->oauth_bearer);
|
||||||
|
|
||||||
Curl_safefree(config->unix_socket_path);
|
Curl_safefree(config->unix_socket_path);
|
||||||
Curl_safefree(config->writeout);
|
Curl_safefree(config->writeout);
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ struct OperationConfig {
|
|||||||
#ifdef CURLDEBUG
|
#ifdef CURLDEBUG
|
||||||
bool test_event_based;
|
bool test_event_based;
|
||||||
#endif
|
#endif
|
||||||
char *xoauth2_bearer; /* OAuth 2.0 bearer token */
|
char *oauth_bearer; /* OAuth 2.0 bearer token */
|
||||||
bool nonpn; /* enable/disable TLS NPN extension */
|
bool nonpn; /* enable/disable TLS NPN extension */
|
||||||
bool noalpn; /* enable/disable TLS ALPN extension */
|
bool noalpn; /* enable/disable TLS ALPN extension */
|
||||||
char *unix_socket_path; /* path to Unix domain socket */
|
char *unix_socket_path; /* path to Unix domain socket */
|
||||||
|
|||||||
@@ -496,7 +496,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
GetStr(&config->egd_file, nextarg);
|
GetStr(&config->egd_file, nextarg);
|
||||||
break;
|
break;
|
||||||
case 'B': /* OAuth 2.0 bearer token */
|
case 'B': /* OAuth 2.0 bearer token */
|
||||||
GetStr(&config->xoauth2_bearer, nextarg);
|
GetStr(&config->oauth_bearer, nextarg);
|
||||||
break;
|
break;
|
||||||
case 'c': /* connect-timeout */
|
case 'c': /* connect-timeout */
|
||||||
err = str2udouble(&config->connecttimeout, nextarg);
|
err = str2udouble(&config->connecttimeout, nextarg);
|
||||||
|
|||||||
@@ -851,8 +851,8 @@ static CURLcode operate_do(struct GlobalConfig *global,
|
|||||||
else if(!config->use_metalink)
|
else if(!config->use_metalink)
|
||||||
my_setopt(curl, CURLOPT_HEADER, config->include_headers?1L:0L);
|
my_setopt(curl, CURLOPT_HEADER, config->include_headers?1L:0L);
|
||||||
|
|
||||||
if(config->xoauth2_bearer)
|
if(config->oauth_bearer)
|
||||||
my_setopt_str(curl, CURLOPT_XOAUTH2_BEARER, config->xoauth2_bearer);
|
my_setopt_str(curl, CURLOPT_XOAUTH2_BEARER, config->oauth_bearer);
|
||||||
|
|
||||||
#if !defined(CURL_DISABLE_PROXY)
|
#if !defined(CURL_DISABLE_PROXY)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -519,7 +519,7 @@ CURLcode get_args(struct OperationConfig *config, const size_t i)
|
|||||||
bool last = (config->next ? FALSE : TRUE);
|
bool last = (config->next ? FALSE : TRUE);
|
||||||
|
|
||||||
/* Check we have a password for the given host user */
|
/* Check we have a password for the given host user */
|
||||||
if(config->userpwd && !config->xoauth2_bearer) {
|
if(config->userpwd && !config->oauth_bearer) {
|
||||||
result = checkpasswd("host", i, last, &config->userpwd);
|
result = checkpasswd("host", i, last, &config->userpwd);
|
||||||
if(result)
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Reference in New Issue
Block a user