nla: Fix unicode issues with gateway code
Gateway code was passing a char string as the package name to `credssp_auth_init`. When using Unicode builds this fails since `QuerySecurityPackageInfo` expects a wchar string. Additionally with unicode builds, `credssp_auth_pkg_name` causes string type mismatches in the gateway code where a char string is expected.
This commit is contained in:
parent
b04c0e7b1c
commit
fbbcd9b8ef
@ -66,6 +66,9 @@ struct rdp_credssp_auth
|
||||
ULONG flags;
|
||||
SecPkgContext_Sizes sizes;
|
||||
enum AUTH_STATE state;
|
||||
#ifdef UNICODE
|
||||
char* pkgNameA;
|
||||
#endif
|
||||
};
|
||||
|
||||
static BOOL parseKerberosDeltat(const char* value, INT32* dest, const char* message);
|
||||
@ -588,10 +591,16 @@ size_t credssp_auth_trailer_size(rdpCredsspAuth* auth)
|
||||
return auth->sizes.cbSecurityTrailer;
|
||||
}
|
||||
|
||||
const TCHAR* credssp_auth_pkg_name(rdpCredsspAuth* auth)
|
||||
const char* credssp_auth_pkg_name(rdpCredsspAuth* auth)
|
||||
{
|
||||
WINPR_ASSERT(auth && auth->info);
|
||||
#ifdef UNICODE
|
||||
if (!auth->pkgNameA)
|
||||
ConvertFromUnicode(CP_UTF8, 0, auth->info->Name, -1, &auth->pkgNameA, 0, NULL, NULL);
|
||||
return auth->pkgNameA;
|
||||
#else
|
||||
return auth->info->Name;
|
||||
#endif
|
||||
}
|
||||
|
||||
void credssp_auth_free(rdpCredsspAuth* auth)
|
||||
@ -639,6 +648,9 @@ void credssp_auth_free(rdpCredsspAuth* auth)
|
||||
free(auth->spn);
|
||||
sspi_SecBufferFree(&auth->input_buffer);
|
||||
sspi_SecBufferFree(&auth->output_buffer);
|
||||
#ifdef UNICODE
|
||||
free(auth->pkgNameA);
|
||||
#endif
|
||||
|
||||
free(auth);
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ FREERDP_LOCAL void credssp_auth_take_input_buffer(rdpCredsspAuth* auth, SecBuffe
|
||||
FREERDP_LOCAL const SecBuffer* credssp_auth_get_output_buffer(rdpCredsspAuth* auth);
|
||||
FREERDP_LOCAL BOOL credssp_auth_have_output_token(rdpCredsspAuth* auth);
|
||||
FREERDP_LOCAL BOOL credssp_auth_is_complete(rdpCredsspAuth* auth);
|
||||
FREERDP_LOCAL const TCHAR* credssp_auth_pkg_name(rdpCredsspAuth* auth);
|
||||
FREERDP_LOCAL const char* credssp_auth_pkg_name(rdpCredsspAuth* auth);
|
||||
FREERDP_LOCAL size_t credssp_auth_trailer_size(rdpCredsspAuth* auth);
|
||||
FREERDP_LOCAL void credssp_auth_free(rdpCredsspAuth* auth);
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#define TAG FREERDP_TAG("core.gateway.ntlm")
|
||||
|
||||
#define AUTH_PKG CREDSSP_AUTH_PKG_NTLM
|
||||
#define AUTH_PKG NTLM_SSP_NAME
|
||||
|
||||
static wStream* rpc_auth_http_request(HttpContext* http, const char* method, int contentLength,
|
||||
const SecBuffer* authToken, const char* auth_scheme)
|
||||
|
@ -44,9 +44,9 @@
|
||||
#define TAG FREERDP_TAG("core.gateway.rdg")
|
||||
|
||||
#if defined(_WIN32) || defined(WITH_SPNEGO)
|
||||
#define AUTH_PKG CREDSSP_AUTH_PKG_SPNEGO
|
||||
#define AUTH_PKG NEGO_SSP_NAME
|
||||
#else
|
||||
#define AUTH_PKG CREDSSP_AUTH_PKG_NTLM
|
||||
#define AUTH_PKG NTLM_SSP_NAME
|
||||
#endif
|
||||
|
||||
/* HTTP channel response fields present flags. */
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
#define TAG FREERDP_TAG("core.gateway.rpc")
|
||||
|
||||
#define AUTH_PKG CREDSSP_AUTH_PKG_NTLM
|
||||
#define AUTH_PKG NTLM_SSP_NAME
|
||||
|
||||
/**
|
||||
* Connection-Oriented RPC Protocol Client Details:
|
||||
|
Loading…
Reference in New Issue
Block a user