mirror of
https://github.com/moparisthebest/curl
synced 2024-11-16 06:25:03 -05:00
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
This commit is contained in:
parent
2dfe3d7093
commit
62c4f2f10f
@ -65,29 +65,31 @@ CURLcode Curl_auth_gsasl_start(struct Curl_easy *data,
|
|||||||
const char *passwdp,
|
const char *passwdp,
|
||||||
struct gsasldata *gsasl)
|
struct gsasldata *gsasl)
|
||||||
{
|
{
|
||||||
#if GSASL_VERSION_NUMBER >= 0x010a00
|
#if GSASL_VERSION_NUMBER >= 0x010b00
|
||||||
int res;
|
int res;
|
||||||
res =
|
res =
|
||||||
#endif
|
#endif
|
||||||
gsasl_property_set(gsasl->client, GSASL_AUTHID, userp);
|
gsasl_property_set(gsasl->client, GSASL_AUTHID, userp);
|
||||||
#if GSASL_VERSION_NUMBER >= 0x010a00
|
#if GSASL_VERSION_NUMBER >= 0x010b00
|
||||||
if(res != GSASL_OK) {
|
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;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if GSASL_VERSION_NUMBER >= 0x010a00
|
#if GSASL_VERSION_NUMBER >= 0x010b00
|
||||||
res =
|
res =
|
||||||
#endif
|
#endif
|
||||||
gsasl_property_set(gsasl->client, GSASL_PASSWORD, passwdp);
|
gsasl_property_set(gsasl->client, GSASL_PASSWORD, passwdp);
|
||||||
#if GSASL_VERSION_NUMBER >= 0x010a00
|
#if GSASL_VERSION_NUMBER >= 0x010b00
|
||||||
if(res != GSASL_OK) {
|
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;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
(void)data;
|
||||||
|
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,8 +100,8 @@ CURLcode Curl_auth_gsasl_token(struct Curl_easy *data,
|
|||||||
{
|
{
|
||||||
unsigned char *chlg = NULL;
|
unsigned char *chlg = NULL;
|
||||||
size_t chlglen = 0;
|
size_t chlglen = 0;
|
||||||
size_t chlg64len = chlg64 ? strlen(chlg64) : 0;
|
CURLcode result = CURLE_OK;
|
||||||
int result;
|
int res;
|
||||||
char *response;
|
char *response;
|
||||||
|
|
||||||
if(chlg64) {
|
if(chlg64) {
|
||||||
@ -108,11 +110,12 @@ CURLcode Curl_auth_gsasl_token(struct Curl_easy *data,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = gsasl_step(gsasl->client, chlg, chlglen, &response, outlen);
|
res = gsasl_step(gsasl->client,
|
||||||
if(result != GSASL_OK && result != GSASL_NEEDS_MORE) {
|
(const char *)chlg, chlglen, &response, outlen);
|
||||||
|
if(res != GSASL_OK && res != GSASL_NEEDS_MORE) {
|
||||||
if(chlg64)
|
if(chlg64)
|
||||||
free(chlg);
|
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;
|
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);
|
result = Curl_base64_encode(data, response, 0, outptr, outlen);
|
||||||
gsasl_free(response);
|
gsasl_free(response);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
*outptr = strdup("");
|
*outptr = strdup("");
|
||||||
|
if(!*outptr)
|
||||||
|
result = CURLE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
return CURLE_OK;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Curl_auth_gsasl_cleanup(struct gsasldata *gsasl)
|
void Curl_auth_gsasl_cleanup(struct gsasldata *gsasl)
|
||||||
|
Loading…
Reference in New Issue
Block a user