mirror of
https://github.com/moparisthebest/curl
synced 2024-11-17 15:05:02 -05:00
sasl_sspi: Fixed SPN not being converted to wchar under Unicode builds
Curl_sasl_create_digest_md5_message() would simply cast the SPN variable to a TCHAR when calling InitializeSecurityContext(). This meant that, under Unicode builds, it would not be valid wide character string. Updated to use the recently introduced Curl_sasl_build_spn() function which performs the correct conversion for us.
This commit is contained in:
parent
1b69122810
commit
f187372f0a
@ -116,7 +116,7 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
|
|||||||
char **outptr, size_t *outlen)
|
char **outptr, size_t *outlen)
|
||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
CURLcode result = CURLE_OK;
|
||||||
char *spn = NULL;
|
TCHAR *spn = NULL;
|
||||||
size_t chlglen = 0;
|
size_t chlglen = 0;
|
||||||
unsigned char *chlg = NULL;
|
unsigned char *chlg = NULL;
|
||||||
unsigned char resp[1024];
|
unsigned char resp[1024];
|
||||||
@ -161,8 +161,8 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
|
|||||||
/* Release the package buffer as it is not required anymore */
|
/* Release the package buffer as it is not required anymore */
|
||||||
s_pSecFn->FreeContextBuffer(SecurityPackage);
|
s_pSecFn->FreeContextBuffer(SecurityPackage);
|
||||||
|
|
||||||
/* Calculate our SPN */
|
/* Generate our SPN */
|
||||||
spn = aprintf("%s/%s", service, data->easy_conn->host.name);
|
spn = Curl_sasl_build_spn(service, data->easy_conn->host.name);
|
||||||
if(!spn)
|
if(!spn)
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
@ -207,14 +207,9 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
|
|||||||
resp_buf.cbBuffer = sizeof(resp);
|
resp_buf.cbBuffer = sizeof(resp);
|
||||||
|
|
||||||
/* Generate our challenge-response message */
|
/* Generate our challenge-response message */
|
||||||
status = s_pSecFn->InitializeSecurityContext(&handle,
|
status = s_pSecFn->InitializeSecurityContext(&handle, NULL, spn, 0, 0, 0,
|
||||||
NULL,
|
&chlg_desc, 0, &ctx,
|
||||||
(TCHAR *) spn,
|
&resp_desc, &attrs, &tsDummy);
|
||||||
0, 0, 0,
|
|
||||||
&chlg_desc,
|
|
||||||
0, &ctx,
|
|
||||||
&resp_desc,
|
|
||||||
&attrs, &tsDummy);
|
|
||||||
|
|
||||||
if(status == SEC_I_COMPLETE_AND_CONTINUE ||
|
if(status == SEC_I_COMPLETE_AND_CONTINUE ||
|
||||||
status == SEC_I_CONTINUE_NEEDED)
|
status == SEC_I_CONTINUE_NEEDED)
|
||||||
|
Loading…
Reference in New Issue
Block a user