summaryrefslogtreecommitdiff
path: root/lib/curl_sasl.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/curl_sasl.c')
-rw-r--r--lib/curl_sasl.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/curl_sasl.c b/lib/curl_sasl.c
index 8d39e4f81..9684ee476 100644
--- a/lib/curl_sasl.c
+++ b/lib/curl_sasl.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2012 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2012 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -18,6 +18,8 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
+ * SPDX-License-Identifier: curl
+ *
* RFC2195 CRAM-MD5 authentication
* RFC2617 Basic and Digest Access Authentication
* RFC2831 DIGEST-MD5 authentication
@@ -48,7 +50,6 @@
#include "warnless.h"
#include "strtok.h"
#include "sendf.h"
-#include "non-ascii.h" /* included for Curl_convert_... prototypes */
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
@@ -283,8 +284,7 @@ static CURLcode get_server_message(struct SASL *sasl, struct Curl_easy *data,
}
/* Encode the outgoing SASL message. */
-static CURLcode build_message(struct SASL *sasl, struct Curl_easy *data,
- struct bufref *msg)
+static CURLcode build_message(struct SASL *sasl, struct bufref *msg)
{
CURLcode result = CURLE_OK;
@@ -297,7 +297,7 @@ static CURLcode build_message(struct SASL *sasl, struct Curl_easy *data,
char *base64;
size_t base64len;
- result = Curl_base64_encode(data, (const char *) Curl_bufref_ptr(msg),
+ result = Curl_base64_encode((const char *) Curl_bufref_ptr(msg),
Curl_bufref_len(msg), &base64, &base64len);
if(!result)
Curl_bufref_set(msg, base64, base64len, curl_free);
@@ -312,10 +312,10 @@ static CURLcode build_message(struct SASL *sasl, struct Curl_easy *data,
*
* Check if we have enough auth data and capabilities to authenticate.
*/
-bool Curl_sasl_can_authenticate(struct SASL *sasl, struct connectdata *conn)
+bool Curl_sasl_can_authenticate(struct SASL *sasl, struct Curl_easy *data)
{
/* Have credentials been provided? */
- if(conn->bits.user_passwd)
+ if(data->state.aptr.user)
return TRUE;
/* EXTERNAL can authenticate without a user name and/or password */
@@ -367,7 +367,7 @@ CURLcode Curl_sasl_start(struct SASL *sasl, struct Curl_easy *data,
if(force_ir || data->set.sasl_ir)
result = Curl_auth_create_external_message(conn->user, &resp);
}
- else if(conn->bits.user_passwd) {
+ else if(data->state.aptr.user) {
#if defined(USE_KERBEROS5)
if((enabledmechs & SASL_MECH_GSSAPI) && Curl_auth_is_gssapi_supported() &&
Curl_auth_user_contains_domain(conn->user)) {
@@ -494,7 +494,7 @@ CURLcode Curl_sasl_start(struct SASL *sasl, struct Curl_easy *data,
if(!result && mech) {
sasl->curmech = mech;
if(Curl_bufref_ptr(&resp))
- result = build_message(sasl, data, &resp);
+ result = build_message(sasl, &resp);
if(sasl->params->maxirlen &&
strlen(mech) + Curl_bufref_len(&resp) > sasl->params->maxirlen)
@@ -672,7 +672,7 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct Curl_easy *data,
#endif
case SASL_OAUTH2:
- /* Create the authorisation message */
+ /* Create the authorization message */
if(sasl->authused == SASL_MECH_OAUTHBEARER) {
result = Curl_auth_create_oauth_bearer_message(conn->user,
hostname,
@@ -729,7 +729,7 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct Curl_easy *data,
newstate = SASL_CANCEL;
break;
case CURLE_OK:
- result = build_message(sasl, data, &resp);
+ result = build_message(sasl, &resp);
if(!result)
result = sasl->params->contauth(data, sasl->curmech, &resp);
break;