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
This commit is contained in:
Mark Salisbury
2012-06-15 18:05:11 +02:00
committed by Yang Tse
parent 16c725dbc7
commit 46480bb9a1
13 changed files with 305 additions and 136 deletions

View File

@@ -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;