Skip to content

Commit

Permalink
freerdp: make modifications to NLA server-side fixes according to PR …
Browse files Browse the repository at this point in the history
…comments
  • Loading branch information
awakecoding committed Jul 22, 2016
1 parent 801dc0f commit 14cb6d3
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 17 deletions.
16 changes: 11 additions & 5 deletions libfreerdp/core/nla.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -1815,11 +1824,8 @@ void nla_free(rdpNla* nla)
}
}

if (nla->SamFile)
{
free(nla->SamFile);
nla->SamFile = NULL;
}
free(nla->SamFile);
nla->SamFile = NULL;

sspi_SecBufferFree(&nla->PublicKey);
sspi_SecBufferFree(&nla->tsCredentials);
Expand Down
5 changes: 4 additions & 1 deletion server/shadow/shadow_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)
Expand Down
14 changes: 4 additions & 10 deletions server/shadow/shadow_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -784,17 +784,11 @@ void shadow_server_free(rdpShadowServer* server)
if (!server)
return;

if (server->ipcSocket)
{
free(server->ipcSocket);
server->ipcSocket = NULL;
}
free(server->ipcSocket);
server->ipcSocket = NULL;

if (server->settings)
{
freerdp_settings_free(server->settings);
server->settings = NULL;
}
freerdp_settings_free(server->settings);
server->settings = NULL;

free(server);
}
Expand Down
10 changes: 9 additions & 1 deletion winpr/libwinpr/sspi/NTLM/ntlm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 14cb6d3

Please sign in to comment.