[server,sample] handle peer when key file missing
When a certificate or private key file can not be opened handle the peer disconnect properly.
This commit is contained in:
parent
b25234da66
commit
0cd823e991
@ -994,10 +994,10 @@ static DWORD WINAPI test_peer_mainloop(LPVOID arg)
|
|||||||
{
|
{
|
||||||
BOOL rc;
|
BOOL rc;
|
||||||
DWORD error = CHANNEL_RC_OK;
|
DWORD error = CHANNEL_RC_OK;
|
||||||
HANDLE handles[32] = { 0 };
|
HANDLE handles[MAXIMUM_WAIT_OBJECTS] = { 0 };
|
||||||
DWORD count;
|
DWORD count = 0;
|
||||||
DWORD status;
|
DWORD status = 0;
|
||||||
testPeerContext* context;
|
testPeerContext* context = NULL;
|
||||||
struct server_info* info;
|
struct server_info* info;
|
||||||
rdpSettings* settings;
|
rdpSettings* settings;
|
||||||
rdpInput* input;
|
rdpInput* input;
|
||||||
@ -1031,17 +1031,13 @@ static DWORD WINAPI test_peer_mainloop(LPVOID arg)
|
|||||||
{
|
{
|
||||||
if (!freerdp_settings_set_bool(settings, FreeRDP_TransportDumpReplay, TRUE) ||
|
if (!freerdp_settings_set_bool(settings, FreeRDP_TransportDumpReplay, TRUE) ||
|
||||||
!freerdp_settings_set_string(settings, FreeRDP_TransportDumpFile, info->replay_dump))
|
!freerdp_settings_set_string(settings, FreeRDP_TransportDumpFile, info->replay_dump))
|
||||||
{
|
goto fail;
|
||||||
freerdp_peer_free(client);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!freerdp_settings_set_string(settings, FreeRDP_CertificateFile, cert) ||
|
if (!freerdp_settings_set_string(settings, FreeRDP_CertificateFile, cert) ||
|
||||||
!freerdp_settings_set_string(settings, FreeRDP_PrivateKeyFile, key))
|
!freerdp_settings_set_string(settings, FreeRDP_PrivateKeyFile, key))
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "Memory allocation failed (strdup)");
|
WLog_ERR(TAG, "Memory allocation failed (strdup)");
|
||||||
freerdp_peer_free(client);
|
goto fail;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
settings->RdpSecurity = TRUE;
|
settings->RdpSecurity = TRUE;
|
||||||
@ -1054,7 +1050,8 @@ static DWORD WINAPI test_peer_mainloop(LPVOID arg)
|
|||||||
settings->RemoteFxCodec = TRUE;
|
settings->RemoteFxCodec = TRUE;
|
||||||
if (!freerdp_settings_set_bool(settings, FreeRDP_NSCodec, TRUE) ||
|
if (!freerdp_settings_set_bool(settings, FreeRDP_NSCodec, TRUE) ||
|
||||||
!freerdp_settings_set_uint32(settings, FreeRDP_ColorDepth, 32))
|
!freerdp_settings_set_uint32(settings, FreeRDP_ColorDepth, 32))
|
||||||
return FALSE;
|
goto fail;
|
||||||
|
|
||||||
settings->SuppressOutput = TRUE;
|
settings->SuppressOutput = TRUE;
|
||||||
settings->RefreshRect = TRUE;
|
settings->RefreshRect = TRUE;
|
||||||
|
|
||||||
@ -1080,7 +1077,8 @@ static DWORD WINAPI test_peer_mainloop(LPVOID arg)
|
|||||||
|
|
||||||
WINPR_ASSERT(client->Initialize);
|
WINPR_ASSERT(client->Initialize);
|
||||||
rc = client->Initialize(client);
|
rc = client->Initialize(client);
|
||||||
WINPR_ASSERT(rc);
|
if (!rc)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
context = (testPeerContext*)client->context;
|
context = (testPeerContext*)client->context;
|
||||||
WINPR_ASSERT(context);
|
WINPR_ASSERT(context);
|
||||||
@ -1177,6 +1175,7 @@ static DWORD WINAPI test_peer_mainloop(LPVOID arg)
|
|||||||
|
|
||||||
WINPR_ASSERT(client->Disconnect);
|
WINPR_ASSERT(client->Disconnect);
|
||||||
client->Disconnect(client);
|
client->Disconnect(client);
|
||||||
|
fail:
|
||||||
freerdp_peer_context_free(client);
|
freerdp_peer_context_free(client);
|
||||||
freerdp_peer_free(client);
|
freerdp_peer_free(client);
|
||||||
return error;
|
return error;
|
||||||
|
Loading…
Reference in New Issue
Block a user