summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViktor Szakats <commit@vsz.me>2021-02-10 18:50:36 +0000
committerViktor Szakats <commit@vsz.me>2021-02-10 18:55:58 +0000
commit62c4f2f10fd49eb6f3933d94c8e154e08b755eec (patch)
tree771b0956edf91dc49ae89cf9da82c3a7145107d6
parent2dfe3d70936fb8bed5139b77863f6e1e508940c8 (diff)
downloadcurl-62c4f2f10fd49eb6f3933d94c8e154e08b755eec.tar.gz
gsasl: fix errors/warnings building against libgsasl
- also fix an indentation - make Curl_auth_gsasl_token() use CURLcode (by Daniel Stenberg) Ref: https://github.com/curl/curl/pull/6372#issuecomment-776118711 Ref: https://github.com/curl/curl/pull/6588 Reviewed-by: Jay Satiro Assisted-by: Daniel Stenberg Reviewed-by: Simon Josefsson Closes #6587
-rw-r--r--lib/vauth/gsasl.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/lib/vauth/gsasl.c b/lib/vauth/gsasl.c
index c9b1576f8..02a06357f 100644
--- a/lib/vauth/gsasl.c
+++ b/lib/vauth/gsasl.c
@@ -65,29 +65,31 @@ CURLcode Curl_auth_gsasl_start(struct Curl_easy *data,
const char *passwdp,
struct gsasldata *gsasl)
{
-#if GSASL_VERSION_NUMBER >= 0x010a00
+#if GSASL_VERSION_NUMBER >= 0x010b00
int res;
res =
#endif
- gsasl_property_set(gsasl->client, GSASL_AUTHID, userp);
-#if GSASL_VERSION_NUMBER >= 0x010a00
+ gsasl_property_set(gsasl->client, GSASL_AUTHID, userp);
+#if GSASL_VERSION_NUMBER >= 0x010b00
if(res != GSASL_OK) {
- failf(data, "setting AUTHID failed: %s\n", gsasl_strerror(result));
+ failf(data, "setting AUTHID failed: %s\n", gsasl_strerror(res));
return CURLE_OUT_OF_MEMORY;
}
#endif
-#if GSASL_VERSION_NUMBER >= 0x010a00
+#if GSASL_VERSION_NUMBER >= 0x010b00
res =
#endif
gsasl_property_set(gsasl->client, GSASL_PASSWORD, passwdp);
-#if GSASL_VERSION_NUMBER >= 0x010a00
+#if GSASL_VERSION_NUMBER >= 0x010b00
if(res != GSASL_OK) {
- failf(data, "setting PASSWORD failed: %s\n", gsasl_strerror(result));
+ failf(data, "setting PASSWORD failed: %s\n", gsasl_strerror(res));
return CURLE_OUT_OF_MEMORY;
}
#endif
+ (void)data;
+
return CURLE_OK;
}
@@ -98,8 +100,8 @@ CURLcode Curl_auth_gsasl_token(struct Curl_easy *data,
{
unsigned char *chlg = NULL;
size_t chlglen = 0;
- size_t chlg64len = chlg64 ? strlen(chlg64) : 0;
- int result;
+ CURLcode result = CURLE_OK;
+ int res;
char *response;
if(chlg64) {
@@ -108,11 +110,12 @@ CURLcode Curl_auth_gsasl_token(struct Curl_easy *data,
return result;
}
- result = gsasl_step(gsasl->client, chlg, chlglen, &response, outlen);
- if(result != GSASL_OK && result != GSASL_NEEDS_MORE) {
+ res = gsasl_step(gsasl->client,
+ (const char *)chlg, chlglen, &response, outlen);
+ if(res != GSASL_OK && res != GSASL_NEEDS_MORE) {
if(chlg64)
free(chlg);
- failf(data, "GSASL step: %s\n", gsasl_strerror(result));
+ failf(data, "GSASL step: %s\n", gsasl_strerror(res));
return CURLE_BAD_CONTENT_ENCODING;
}
@@ -120,10 +123,13 @@ CURLcode Curl_auth_gsasl_token(struct Curl_easy *data,
result = Curl_base64_encode(data, response, 0, outptr, outlen);
gsasl_free(response);
}
- else
+ else {
*outptr = strdup("");
+ if(!*outptr)
+ result = CURLE_OUT_OF_MEMORY;
+ }
- return CURLE_OK;
+ return result;
}
void Curl_auth_gsasl_cleanup(struct gsasldata *gsasl)