diff options
author | Marcel Raad <raad@teamviewer.com> | 2014-09-10 14:32:56 +0200 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2014-09-13 10:06:44 +0100 |
commit | bd3df5ec6dd2a71a66699303cc37fd5218a9920b (patch) | |
tree | a552d066fbf5e350d96048fa1b5771725ff77040 /lib | |
parent | 06b27ea24c79286eb751cca07970017641b912d9 (diff) |
sasl_sspi: Fixed Unicode build
Bug: http://curl.haxx.se/bug/view.cgi?id=1422
Verified-by: Steve Holme
Diffstat (limited to 'lib')
-rw-r--r-- | lib/curl_sasl_sspi.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/curl_sasl_sspi.c b/lib/curl_sasl_sspi.c index df4da9645..6e7aae9e5 100644 --- a/lib/curl_sasl_sspi.c +++ b/lib/curl_sasl_sspi.c @@ -85,8 +85,7 @@ TCHAR *Curl_sasl_build_spn(const char *service, const char *host) } /* Release the UTF8 variant when operating with Unicode */ - if(utf8_spn != tchar_spn) - Curl_safefree(utf8_spn); + Curl_unicodefree(utf8_spn); /* Return our newly allocated SPN */ return tchar_spn; @@ -485,8 +484,7 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data, SecPkgContext_Sizes sizes; SecPkgCredentials_Names names; SECURITY_STATUS status; - - /* TODO: Verify the unicodeness of this function */ + char *user_name; /* Decode the base-64 encoded input message */ if(strlen(chlg64) && *chlg64 != '=') { @@ -577,12 +575,22 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data, return CURLE_OUT_OF_MEMORY; } + /* Convert the user name to UTF8 when operating with Unicode */ + user_name = Curl_convert_tchar_to_UTF8(names.sUserName); + if(!user_name) { + Curl_safefree(trailer); + Curl_safefree(chlg); + + return CURLE_OUT_OF_MEMORY; + } + /* Allocate our message */ - messagelen = 4 + strlen(names.sUserName) + 1; + messagelen = 4 + strlen(user_name) + 1; message = malloc(messagelen); if(!message) { Curl_safefree(trailer); Curl_safefree(chlg); + Curl_unicodefree(user_name); return CURLE_OUT_OF_MEMORY; } @@ -593,7 +601,8 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data, identity is not terminated with the zero-valued (%x00) octet." it seems necessary to include it. */ memcpy(message, &outdata, 4); - strcpy((char *)message + 4, names.sUserName); + strcpy((char *)message + 4, user_name); + Curl_unicodefree(user_name); /* Allocate the padding */ padding = malloc(sizes.cbBlockSize); |