From d9aca506d635205cdc87d4575cfe6b06a3f85fd4 Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Mon, 27 Jul 2015 19:24:41 +0200 Subject: [PATCH 1/4] rdpsnd: include win32error.h If using rdpsnd externally (for example in other projects) WIN32ERROR needs to be defined otherwise some compilers might create a warning or error. --- include/freerdp/client/rdpsnd.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/freerdp/client/rdpsnd.h b/include/freerdp/client/rdpsnd.h index 544b2313a..b7e8b76ce 100644 --- a/include/freerdp/client/rdpsnd.h +++ b/include/freerdp/client/rdpsnd.h @@ -22,6 +22,7 @@ #define FREERDP_CHANNEL_CLIENT_RDPSND_H #include +#include /** * Subsystem Interface From 9fb6705380fe6cc5623e06e1c72faa3b04d06bbc Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Tue, 28 Jul 2015 14:05:57 +0200 Subject: [PATCH 2/4] rdpdr/printer: ignore unhanded packetID Ignore packetIDs PRN_CACHE_DATA and PRN_USING_XPS instead of returning an error. --- channels/rdpdr/client/rdpdr_main.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/channels/rdpdr/client/rdpdr_main.c b/channels/rdpdr/client/rdpdr_main.c index 54aa5da63..3f903c98d 100644 --- a/channels/rdpdr/client/rdpdr_main.c +++ b/channels/rdpdr/client/rdpdr_main.c @@ -851,7 +851,6 @@ static WIN32ERROR rdpdr_process_receive(rdpdrPlugin* rdpdr, wStream* s) WLog_ERR(TAG, "rdpdr_send_client_name_request failed with error %lu", error); return error; } - if ((error = rdpdr_process_init(rdpdr))) { WLog_ERR(TAG, "rdpdr_process_init failed with error %lu", error); @@ -909,13 +908,28 @@ static WIN32ERROR rdpdr_process_receive(rdpdrPlugin* rdpdr, wStream* s) } else if (component == RDPDR_CTYP_PRN) { - WLog_ERR(TAG, "RDPDR_CTYP_PRN unknown PacketId: 0x%04X", packetId); - return ERROR_INVALID_DATA; + switch (packetId) + { + case PAKID_PRN_CACHE_DATA: + { + UINT32 eventID; + Stream_Read_UINT32(s, eventID); + WLog_ERR(TAG, "Ignoring unhandled message PAKID_PRN_CACHE_DATA (EventID: 0x%04X)", eventID); + } + break; + + case PAKID_PRN_USING_XPS: + WLog_ERR(TAG, "Ignoring unhandled message PAKID_PRN_USING_XPS"); + break; + + default: + WLog_ERR(TAG, "Unknown printing component packetID: 0x%04X", packetId); + return ERROR_INVALID_DATA; + } } else { - WLog_ERR(TAG, "unknown message: Component: 0x%04X PacketId: 0x%04X", - component, packetId); + WLog_ERR(TAG, "Unknown message: Component: 0x%04X PacketId: 0x%04X", component, packetId); return ERROR_INVALID_DATA; } From f638ab561518a5ed602dd6ee9a3b59d7909d12d3 Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Tue, 28 Jul 2015 17:23:16 +0200 Subject: [PATCH 3/4] Update version to 1.4.5 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b050a3a1d..32896f2ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,7 +70,7 @@ endif() set(WITH_LIBRARY_VERSIONING "ON") set(FREERDP_VERSION_MAJOR "1") set(FREERDP_VERSION_MINOR "2") -set(FREERDP_VERSION_REVISION "4") +set(FREERDP_VERSION_REVISION "5") set(FREERDP_VERSION_SUFFIX "dev") set(FREERDP_API_VERSION "${FREERDP_VERSION_MAJOR}.${FREERDP_VERSION_MINOR}") set(FREERDP_VERSION "${FREERDP_API_VERSION}.${FREERDP_VERSION_REVISION}") From a22dc21c15f49fe4e5bc7f70fe974d4d022bbf04 Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Wed, 29 Jul 2015 17:32:09 +0200 Subject: [PATCH 4/4] remdesk,encomps: misc fixes * only free stream when an error occurs * ignore unhanded messages instead of throwing an error * fix memory leak in settings --- channels/encomsp/client/encomsp_main.c | 3 +-- channels/remdesk/client/remdesk_main.c | 19 ++++++++++++++----- libfreerdp/core/client.c | 3 +++ libfreerdp/core/settings.c | 3 +++ 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/channels/encomsp/client/encomsp_main.c b/channels/encomsp/client/encomsp_main.c index a4884a153..10a0b5217 100644 --- a/channels/encomsp/client/encomsp_main.c +++ b/channels/encomsp/client/encomsp_main.c @@ -1169,8 +1169,7 @@ static void VCAPITYPE encomsp_virtual_channel_init_event(LPVOID pInitHandle, UIN encomsp_virtual_channel_event_terminated(encomsp); break; default: - WLog_ERR(TAG, "uknown event type %d", event); - error = ERROR_INVALID_DATA; + WLog_ERR(TAG, "Unhandled event type %d", event); } if (error && encomsp->rdpcontext) diff --git a/channels/remdesk/client/remdesk_main.c b/channels/remdesk/client/remdesk_main.c index 9b25042de..ea63c7a42 100644 --- a/channels/remdesk/client/remdesk_main.c +++ b/channels/remdesk/client/remdesk_main.c @@ -254,7 +254,8 @@ static WIN32ERROR remdesk_send_ctl_version_info_pdu(remdeskPlugin* remdesk) if ((error = remdesk_virtual_channel_write(remdesk, s))) WLog_ERR(TAG, "remdesk_virtual_channel_write failed with error %lu!", error); - Stream_Free(s, TRUE); + if (error != CHANNEL_RC_OK) + Stream_Free(s, TRUE); return error; } @@ -340,7 +341,8 @@ static WIN32ERROR remdesk_send_ctl_authenticate_pdu(remdeskPlugin* remdesk) out: free(raConnectionStringW); free(expertBlobW); - Stream_Free(s, TRUE); + if (error != CHANNEL_RC_OK) + Stream_Free(s, TRUE); return error; } @@ -387,7 +389,8 @@ static WIN32ERROR remdesk_send_ctl_remote_control_desktop_pdu(remdeskPlugin* rem out: free(raConnectionStringW); - Stream_Free(s, TRUE); + if (error != CHANNEL_RC_OK) + Stream_Free(s, TRUE); return error; } @@ -440,7 +443,8 @@ static WIN32ERROR remdesk_send_ctl_verify_password_pdu(remdeskPlugin* remdesk) out: free(expertBlobW); - Stream_Free(s, TRUE); + if (error != CHANNEL_RC_OK) + Stream_Free(s, TRUE); return error; } @@ -788,7 +792,7 @@ static VOID VCAPITYPE remdesk_virtual_channel_open_event(DWORD openHandle, UINT LPVOID pData, UINT32 dataLength, UINT32 totalLength, UINT32 dataFlags) { remdeskPlugin* remdesk; - WIN32ERROR error; + WIN32ERROR error = CHANNEL_RC_OK; remdesk = (remdeskPlugin*) remdesk_get_open_handle_data(openHandle); @@ -811,6 +815,11 @@ static VOID VCAPITYPE remdesk_virtual_channel_open_event(DWORD openHandle, UINT case CHANNEL_EVENT_USER: break; + + default: + WLog_ERR(TAG, "unhandled event %lu!", event); + error = ERROR_INTERNAL_ERROR; + } if (error && remdesk->rdpcontext) setChannelError(remdesk->rdpcontext, error, "remdesk_virtual_channel_open_event reported an error"); diff --git a/libfreerdp/core/client.c b/libfreerdp/core/client.c index 243a8222d..b57463a32 100644 --- a/libfreerdp/core/client.c +++ b/libfreerdp/core/client.c @@ -673,7 +673,10 @@ UINT VCAPITYPE FreeRDP_VirtualChannelWrite(DWORD openHandle, LPVOID pData, ULONG pChannelOpenEvent->pChannelOpenData = pChannelOpenData; if (!MessageQueue_Post(channels->queue, (void*) channels, 0, (void*) pChannelOpenEvent, NULL)) + { + free(pChannelOpenEvent); return CHANNEL_RC_NO_MEMORY; + } return CHANNEL_RC_OK; } diff --git a/libfreerdp/core/settings.c b/libfreerdp/core/settings.c index 9303aa7c7..9ea678b7a 100644 --- a/libfreerdp/core/settings.c +++ b/libfreerdp/core/settings.c @@ -929,6 +929,9 @@ void freerdp_settings_free(rdpSettings* settings) free(settings->RedirectionPassword); free(settings->RedirectionTsvUrl); free(settings->RemoteAssistanceSessionId); + free(settings->RemoteAssistancePassword); + free(settings->RemoteAssistancePassStub); + free(settings->RemoteAssistanceRCTicket); free(settings->AuthenticationServiceClass); free(settings->GatewayHostname); free(settings->GatewayUsername);