aboutsummaryrefslogtreecommitdiff
path: root/lib/http_negotiate_sspi.c
diff options
context:
space:
mode:
authorMark Salisbury <mark.salisbury@hp.com>2012-06-15 18:05:11 +0200
committerYang Tse <yangsita@gmail.com>2012-06-15 18:41:49 +0200
commit46480bb9a1569eaf156012f33e3e7e8c3de18f87 (patch)
tree28c6ee9e5b39119260f0691ecb765e771f7fed72 /lib/http_negotiate_sspi.c
parent16c725dbc77b408d5b3c2b2d213063f7c2398c06 (diff)
SSPI related code: Unicode support for WinCE
SSPI related code now compiles with ANSI and WCHAR versions of security methods (WinCE requires WCHAR versions of methods). Pulled UTF8 to WCHAR conversion methods out of idn_win32.c into their own file. curl_sasl.c - include curl_memory.h to use correct memory functions. getenv.c and telnet.c - WinCE compatibility fix With some committer adjustments
Diffstat (limited to 'lib/http_negotiate_sspi.c')
-rw-r--r--lib/http_negotiate_sspi.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/http_negotiate_sspi.c b/lib/http_negotiate_sspi.c
index f1ab33d6d..ac197f6cf 100644
--- a/lib/http_negotiate_sspi.c
+++ b/lib/http_negotiate_sspi.c
@@ -33,6 +33,7 @@
#include "curl_base64.h"
#include "http_negotiate.h"
#include "curl_memory.h"
+#include "curl_multibyte.h"
#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>
@@ -90,7 +91,7 @@ int Curl_input_negotiate(struct connectdata *conn, bool proxy,
SecBuffer in_sec_buff;
ULONG context_attributes;
TimeStamp lifetime;
-
+ LPTSTR sname;
int ret;
size_t len = 0, input_token_len = 0;
bool gss = FALSE;
@@ -137,7 +138,7 @@ int Curl_input_negotiate(struct connectdata *conn, bool proxy,
if(!neg_ctx->output_token) {
PSecPkgInfo SecurityPackage;
- ret = s_pSecFn->QuerySecurityPackageInfo((SEC_CHAR *)"Negotiate",
+ ret = s_pSecFn->QuerySecurityPackageInfo(TEXT("Negotiate"),
&SecurityPackage);
if(ret != SEC_E_OK)
return -1;
@@ -166,7 +167,7 @@ int Curl_input_negotiate(struct connectdata *conn, bool proxy,
return -1;
neg_ctx->status =
- s_pSecFn->AcquireCredentialsHandle(NULL, (SEC_CHAR *)"Negotiate",
+ s_pSecFn->AcquireCredentialsHandle(NULL, TEXT("Negotiate"),
SECPKG_CRED_OUTBOUND, NULL, NULL,
NULL, NULL, neg_ctx->credentials,
&lifetime);
@@ -205,10 +206,18 @@ int Curl_input_negotiate(struct connectdata *conn, bool proxy,
in_sec_buff.pvBuffer = input_token;
}
+#ifdef UNICODE
+ sname = Curl_convert_UTF8_to_wchar(neg_ctx->server_name);
+ if(!wserver)
+ return CURLE_OUT_OF_MEMORY;
+#else
+ sname = neg_ctx->server_name;
+#endif
+
neg_ctx->status = s_pSecFn->InitializeSecurityContext(
neg_ctx->credentials,
input_token ? neg_ctx->context : 0,
- neg_ctx->server_name,
+ sname,
ISC_REQ_CONFIDENTIALITY,
0,
SECURITY_NATIVE_DREP,
@@ -219,6 +228,10 @@ int Curl_input_negotiate(struct connectdata *conn, bool proxy,
&context_attributes,
&lifetime);
+#ifdef UNICODE
+ free(sname);
+#endif
+
if(GSS_ERROR(neg_ctx->status))
return -1;