libwinpr-sspi: partially fix encoding of credentials on Windows
This commit is contained in:
parent
c90326cc16
commit
5624b4450a
@ -47,7 +47,7 @@ struct rdp_credssp
|
|||||||
SecBuffer PublicKey;
|
SecBuffer PublicKey;
|
||||||
SecBuffer ts_credentials;
|
SecBuffer ts_credentials;
|
||||||
CryptoRc4 rc4_seal_state;
|
CryptoRc4 rc4_seal_state;
|
||||||
LPCTSTR ServicePrincipalName;
|
LPTSTR ServicePrincipalName;
|
||||||
SEC_WINNT_AUTH_IDENTITY identity;
|
SEC_WINNT_AUTH_IDENTITY identity;
|
||||||
PSecurityFunctionTable table;
|
PSecurityFunctionTable table;
|
||||||
SecPkgContext_Sizes ContextSizes;
|
SecPkgContext_Sizes ContextSizes;
|
||||||
|
@ -220,7 +220,8 @@ int credssp_client_authenticate(rdpCredssp* credssp)
|
|||||||
memset(&output_buffer, 0, sizeof(SecBuffer));
|
memset(&output_buffer, 0, sizeof(SecBuffer));
|
||||||
memset(&credssp->ContextSizes, 0, sizeof(SecPkgContext_Sizes));
|
memset(&credssp->ContextSizes, 0, sizeof(SecPkgContext_Sizes));
|
||||||
|
|
||||||
fContextReq = ISC_REQ_CONFIDENTIALITY | ISC_REQ_INTEGRITY | ISC_REQ_IDENTIFY;
|
fContextReq = ISC_REQ_CONFIDENTIALITY | ISC_REQ_INTEGRITY | ISC_REQ_IDENTIFY |
|
||||||
|
ISC_REQ_EXTENDED_ERROR | ISC_REQ_SEQUENCE_DETECT | ISC_REQ_REPLAY_DETECT;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include <winpr/crt.h>
|
#include <winpr/crt.h>
|
||||||
#include <winpr/sspi.h>
|
#include <winpr/sspi.h>
|
||||||
|
#include <winpr/print.h>
|
||||||
|
|
||||||
#include "sspi.h"
|
#include "sspi.h"
|
||||||
|
|
||||||
@ -278,10 +279,9 @@ void sspi_SetAuthIdentity(SEC_WINNT_AUTH_IDENTITY* identity, char* user, char* d
|
|||||||
|
|
||||||
if (user)
|
if (user)
|
||||||
{
|
{
|
||||||
identity->UserLength = strlen(user) * 2;
|
identity->UserLength = MultiByteToWideChar(CP_UTF8, 0, user, strlen(user), NULL, 0);
|
||||||
identity->User = (UINT16*) malloc(identity->UserLength + 2);
|
identity->User = (UINT16*) malloc(identity->UserLength * sizeof(WCHAR));
|
||||||
MultiByteToWideChar(CP_ACP, 0, user, strlen(user),
|
MultiByteToWideChar(CP_UTF8, 0, user, identity->UserLength, (LPWSTR) identity->User, identity->UserLength * sizeof(WCHAR));
|
||||||
(LPWSTR) identity->User, identity->UserLength / 2);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -291,10 +291,9 @@ void sspi_SetAuthIdentity(SEC_WINNT_AUTH_IDENTITY* identity, char* user, char* d
|
|||||||
|
|
||||||
if (domain)
|
if (domain)
|
||||||
{
|
{
|
||||||
identity->DomainLength = strlen(domain) * 2;
|
identity->DomainLength = MultiByteToWideChar(CP_UTF8, 0, domain, strlen(domain), NULL, 0);
|
||||||
identity->Domain = (UINT16*) malloc(identity->DomainLength + 2);
|
identity->Domain = (UINT16*) malloc(identity->DomainLength * sizeof(WCHAR));
|
||||||
MultiByteToWideChar(CP_ACP, 0, domain, strlen(domain),
|
MultiByteToWideChar(CP_UTF8, 0, domain, identity->DomainLength, (LPWSTR) identity->Domain, identity->DomainLength * sizeof(WCHAR));
|
||||||
(LPWSTR) identity->Domain, identity->DomainLength / 2);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -304,10 +303,9 @@ void sspi_SetAuthIdentity(SEC_WINNT_AUTH_IDENTITY* identity, char* user, char* d
|
|||||||
|
|
||||||
if (password != NULL)
|
if (password != NULL)
|
||||||
{
|
{
|
||||||
identity->PasswordLength = strlen(password) * 2;
|
identity->PasswordLength = MultiByteToWideChar(CP_UTF8, 0, password, strlen(password), NULL, 0);
|
||||||
identity->Password = (UINT16*) malloc(identity->PasswordLength + 2);
|
identity->Password = (UINT16*) malloc(identity->PasswordLength * sizeof(WCHAR));
|
||||||
MultiByteToWideChar(CP_ACP, 0, password, strlen(password),
|
MultiByteToWideChar(CP_UTF8, 0, password, identity->PasswordLength, (LPWSTR) identity->Password, identity->PasswordLength * sizeof(WCHAR));
|
||||||
(LPWSTR) identity->Password, identity->PasswordLength / 2);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user