oauth2: Don't use XOAUTH2 in OAuth 2.0 variables

This commit is contained in:
Steve Holme 2015-09-04 07:11:09 +01:00
parent 4e3d396900
commit eaa98cef8d
8 changed files with 14 additions and 13 deletions

View file

@ -24,6 +24,7 @@
* RFC4422 Simple Authentication and Security Layer (SASL)
* RFC4616 PLAIN authentication
* RFC6749 OAuth 2.0 Authorization Framework
* RFC7628 A Set of SASL Mechanisms for OAuth
* 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
#endif
if((enabledmechs & SASL_MECH_XOAUTH2) || conn->xoauth2_bearer) {
if((enabledmechs & SASL_MECH_XOAUTH2) || conn->oauth_bearer) {
mech = SASL_MECH_STRING_XOAUTH2;
state1 = SASL_XOAUTH2;
sasl->authused = SASL_MECH_XOAUTH2;
if(force_ir || data->set.sasl_ir)
result = sasl_create_xoauth2_message(data, conn->user,
conn->xoauth2_bearer,
conn->oauth_bearer,
&resp, &len);
}
else if(enabledmechs & SASL_MECH_LOGIN) {
@ -1629,7 +1630,7 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct connectdata *conn,
case SASL_XOAUTH2:
/* Create the authorisation message */
result = sasl_create_xoauth2_message(data, conn->user,
conn->xoauth2_bearer, &resp, &len);
conn->oauth_bearer, &resp, &len);
break;
case SASL_CANCEL:
/* Remove the offending mechanism from the supported list */

View file

@ -2725,7 +2725,7 @@ static void conn_free(struct connectdata *conn)
Curl_safefree(conn->user);
Curl_safefree(conn->passwd);
Curl_safefree(conn->xoauth2_bearer);
Curl_safefree(conn->oauth_bearer);
Curl_safefree(conn->options);
Curl_safefree(conn->proxyuser);
Curl_safefree(conn->proxypasswd);
@ -5535,8 +5535,8 @@ static CURLcode create_conn(struct SessionHandle *data,
}
if(data->set.str[STRING_BEARER]) {
conn->xoauth2_bearer = strdup(data->set.str[STRING_BEARER]);
if(!conn->xoauth2_bearer) {
conn->oauth_bearer = strdup(data->set.str[STRING_BEARER]);
if(!conn->oauth_bearer) {
result = CURLE_OUT_OF_MEMORY;
goto out;
}

View file

@ -915,7 +915,7 @@ struct connectdata {
char *passwd; /* password 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 *proxypasswd; /* proxy password string, allocated */