freerdp: make modifications to NLA server-side fixes according to PR comments

This commit is contained in:
Marc-André Moreau 2016-07-22 09:06:07 -04:00
parent 801dc0f826
commit 14cb6d33c6
4 changed files with 28 additions and 17 deletions

View File

@ -1747,8 +1747,17 @@ rdpNla* nla_new(freerdp* instance, rdpTransport* transport, rdpSettings* setting
nla->version = 3;
if (settings->NtlmSamFile)
{
nla->SamFile = _strdup(settings->NtlmSamFile);
if (!nla->SamFile)
{
free(nla->identity);
free(nla);
return NULL;
}
}
ZeroMemory(&nla->negoToken, sizeof(SecBuffer));
ZeroMemory(&nla->pubKeyAuth, sizeof(SecBuffer));
ZeroMemory(&nla->authInfo, sizeof(SecBuffer));
@ -1815,11 +1824,8 @@ void nla_free(rdpNla* nla)
}
}
if (nla->SamFile)
{
free(nla->SamFile);
nla->SamFile = NULL;
}
sspi_SecBufferFree(&nla->PublicKey);
sspi_SecBufferFree(&nla->tsCredentials);

View File

@ -408,6 +408,9 @@ BOOL shadow_client_logon(freerdp_peer* peer, SEC_WINNT_AUTH_IDENTITY* identity,
password = _strdup((char*) identity->Password);
}
if ((identity->User && !user) || (identity->Domain && !domain) || (identity->Password && !password))
return FALSE;
if (user)
{
free(settings->Username);
@ -419,7 +422,7 @@ BOOL shadow_client_logon(freerdp_peer* peer, SEC_WINNT_AUTH_IDENTITY* identity,
{
free(settings->Domain);
settings->Domain = domain;
user = NULL;
domain = NULL;
}
if (password)

View File

@ -784,17 +784,11 @@ void shadow_server_free(rdpShadowServer* server)
if (!server)
return;
if (server->ipcSocket)
{
free(server->ipcSocket);
server->ipcSocket = NULL;
}
if (server->settings)
{
freerdp_settings_free(server->settings);
server->settings = NULL;
}
free(server);
}

View File

@ -810,7 +810,15 @@ SECURITY_STATUS SEC_ENTRY ntlm_SetContextAttributesW(PCtxtHandle phContext, ULON
const char* filename = (char*) pBuffer;
free(context->SamFile);
context->SamFile = filename ? _strdup(filename) : NULL;
context->SamFile = NULL;
if (filename)
{
context->SamFile = _strdup(filename);
if (!context->SamFile)
return SEC_E_INSUFFICIENT_MEMORY;
}
return SEC_E_OK;
}