commit 7c3adc8449a4fe89920a6438206e8e2690d7f021
Author: Armin Novak <armin.novak@gmail.com>
Date:   Mon Nov 17 00:21:04 2014 +0100

    Fixed nonnull warning.
commit 232aa89efd13d21b2e5dca69e0aea70a03d09544
Author: Armin Novak <armin.novak@gmail.com>
Date:   Mon Nov 17 00:22:33 2014 +0100

    Fixed memory leak.
commit d9b889ddb7e466837e363b45ae6713c0bcf0f6db
Author: Armin Novak <armin.novak@gmail.com>
Date:   Mon Nov 17 00:33:37 2014 +0100

    Fixed memory leak.
commit f34ee395eb9516bd1b91e25acc0fa73a574d531d
Author: Armin Novak <armin.novak@gmail.com>
Date:   Mon Nov 17 00:34:17 2014 +0100

    Fixed memory leak.
commit c44f85c2b4e5455e5da1609d2b6d1a73a7ea2371
Author: Armin Novak <armin.novak@gmail.com>
Date:   Mon Nov 17 00:42:05 2014 +0100

    Fixed memory leak.
commit 7881ec762e6f9b51e24878f4c3ed5343a4e05509
Author: Marc-André Moreau <marcandre.moreau@gmail.com>
Date:   Fri Nov 21 15:10:39 2014 -0500

    server/shadow: avoid sending pointer updates when not active, fix remdesk leak
commit 547054a48b83fe81917cb3b474116225e97d340f
Author: Armin Novak <armin.novak@gmail.com>
Date:   Sun Dec 7 00:23:46 2014 +0100

    Fixed uninitialized value.
commit 43beef36ff1521756bc41378cfa251c843375f49
Author: Bernhard Miklautz <bernhard.miklautz@shacknet.at>
Date:   Fri Dec 12 18:57:40 2014 +0100

    rdtk/shadow: install libraries versioned
diff --git a/channels/remdesk/server/remdesk_main.c b/channels/remdesk/server/remdesk_main.c
index 4a7670e..072eec2 100644
--- a/channels/remdesk/server/remdesk_main.c
+++ b/channels/remdesk/server/remdesk_main.c
@@ -156,6 +156,8 @@ static int remdesk_send_ctl_version_info_pdu(RemdeskServerContext* context)
 
 	remdesk_virtual_channel_write(context, s);
 
+	Stream_Free(s, TRUE);
+
 	return 1;
 }
 
diff --git a/client/common/cmdline.c b/client/common/cmdline.c
index f1f9640..a731c31 100644
--- a/client/common/cmdline.c
+++ b/client/common/cmdline.c
@@ -2077,11 +2077,24 @@ int freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings)
 		}
 	}
 
+	if (settings->LyncRdpMode)
+	{
+		settings->EncomspVirtualChannel = TRUE;
+		settings->RemdeskVirtualChannel = TRUE;
+		settings->CompressionEnabled = FALSE;
+	}
+
 	if (settings->RemoteAssistanceMode)
 	{
+		settings->EncomspVirtualChannel = TRUE;
+		settings->RemdeskVirtualChannel = TRUE;
+	}
+
+	if (settings->EncomspVirtualChannel)
 		freerdp_client_load_static_channel_addin(channels, settings, "encomsp", settings);
+
+	if (settings->RemdeskVirtualChannel)
 		freerdp_client_load_static_channel_addin(channels, settings, "remdesk", settings);
-	}
 
 	for (index = 0; index < settings->StaticChannelCount; index++)
 	{
diff --git a/include/freerdp/settings.h b/include/freerdp/settings.h
index a53c14d..ca358f1 100644
--- a/include/freerdp/settings.h
+++ b/include/freerdp/settings.h
@@ -599,6 +599,9 @@ typedef struct _RDPDR_PARALLEL RDPDR_PARALLEL;
 #define FreeRDP_RemoteAssistancePassStub			1026
 #define FreeRDP_RemoteAssistancePassword			1027
 #define FreeRDP_RemoteAssistanceRCTicket			1028
+#define FreeRDP_EncomspVirtualChannel				1029
+#define FreeRDP_RemdeskVirtualChannel				1030
+#define FreeRDP_LyncRdpMode					1031
 #define FreeRDP_TlsSecurity					1088
 #define FreeRDP_NlaSecurity					1089
 #define FreeRDP_RdpSecurity					1090
@@ -971,7 +974,10 @@ struct rdp_settings
 	ALIGN64 char* RemoteAssistancePassStub; /* 1026 */
 	ALIGN64 char* RemoteAssistancePassword; /* 1027 */
 	ALIGN64 char* RemoteAssistanceRCTicket; /* 1028 */
-	UINT64 padding1088[1088 - 1029]; /* 1029 */
+	ALIGN64 BOOL EncomspVirtualChannel; /* 1029 */
+	ALIGN64 BOOL RemdeskVirtualChannel; /* 1030 */
+	ALIGN64 BOOL LyncRdpMode; /* 1031 */
+	UINT64 padding1088[1088 - 1032]; /* 1032 */
 
 	/**
 	 * X.224 Connection Request/Confirm
diff --git a/rdtk/CMakeLists.txt b/rdtk/CMakeLists.txt
index 35b0052..93c5a3c 100644
--- a/rdtk/CMakeLists.txt
+++ b/rdtk/CMakeLists.txt
@@ -44,8 +44,9 @@ include(CMakePackageConfigHelpers)
 set(RDTK_VERSION_MAJOR "1")
 set(RDTK_VERSION_MINOR "1")
 set(RDTK_VERSION_REVISION "0")
-set(RDTK_VERSION "${RDTK_VERSION_MAJOR}.${RDTK_VERSION_MINOR}")
-set(RDTK_VERSION_FULL "${RDTK_VERSION}.${RDTK_VERSION_REVISION}")
+set(RDTK_API_VERSION "${RDTK_VERSION_MAJOR}.${RDTK_VERSION_MINOR}")
+set(RDTK_VERSION "${RDTK_API_VERSION}.${RDTK_VERSION_REVISION}")
+set(RDTK_VERSION_FULL "${RDTK_VERSION}")
 set(RDTK_VERSION_FULL ${RDTK_VERSION_FULL} PARENT_SCOPE)
 
 # Default to release build type
diff --git a/rdtk/librdtk/CMakeLists.txt b/rdtk/librdtk/CMakeLists.txt
index 8a81964..950cc7d 100644
--- a/rdtk/librdtk/CMakeLists.txt
+++ b/rdtk/librdtk/CMakeLists.txt
@@ -58,6 +58,10 @@ add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
 list(APPEND ${MODULE_PREFIX}_LIBS winpr)
 list(APPEND ${MODULE_PREFIX}_LIBS freerdp)
 
+if (WITH_LIBRARY_VERSIONING)
+	set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${RDTK_VERSION} SOVERSION ${RDTK_API_VERSION})
+endif()
+
 target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
 
 install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} EXPORT RdTkTargets)
diff --git a/server/shadow/CMakeLists.txt b/server/shadow/CMakeLists.txt
index 78f85b0..26a5c7b 100644
--- a/server/shadow/CMakeLists.txt
+++ b/server/shadow/CMakeLists.txt
@@ -238,6 +238,10 @@ list(APPEND ${MODULE_PREFIX}_LIBS rdtk)
 
 target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
 
+if (WITH_LIBRARY_VERSIONING)
+	  set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION} SOVERSION ${FREERDP_API_VERSION})
+endif()
+
 install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT server)
 
 set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/shadow")
diff --git a/server/shadow/X11/x11_shadow.c b/server/shadow/X11/x11_shadow.c
index 3f1a964..d1a8591 100644
--- a/server/shadow/X11/x11_shadow.c
+++ b/server/shadow/X11/x11_shadow.c
@@ -386,7 +386,10 @@ int x11_shadow_pointer_alpha_update(x11ShadowSubsystem* subsystem)
 	msg->pixels = (BYTE*) malloc(msg->scanline * msg->height);
 
 	if (!msg->pixels)
+	{
+		free (msg);
 		return -1;
+	}
 
 	CopyMemory(msg->pixels, subsystem->cursorPixels, msg->scanline * msg->height);
 	msg->premultiplied = TRUE;
diff --git a/server/shadow/shadow_client.c b/server/shadow/shadow_client.c
index 63d0b9e..30ab90e 100644
--- a/server/shadow/shadow_client.c
+++ b/server/shadow/shadow_client.c
@@ -67,6 +67,12 @@ void shadow_client_context_new(freerdp_peer* peer, rdpShadowClient* client)
 
 	settings->RdpKeyFile = _strdup(settings->PrivateKeyFile);
 
+	if (server->ipcSocket)
+	{
+		settings->LyncRdpMode = TRUE;
+		settings->CompressionEnabled = FALSE;
+	}
+
 	client->inLobby = TRUE;
 	client->mayView = server->mayView;
 	client->mayInteract = server->mayInteract;
@@ -217,8 +223,12 @@ void shadow_client_refresh_rect(rdpShadowClient* client, BYTE count, RECTANGLE_1
 
 	wParam = (SHADOW_MSG_IN_REFRESH_OUTPUT*) calloc(1, sizeof(SHADOW_MSG_IN_REFRESH_OUTPUT));
 
-	if (!wParam)
+	if (!wParam || !areas)
+	{
+		if (wParam)
+			free (wParam);
 		return;
+	}
 
 	wParam->numRects = (UINT32) count;
 
@@ -227,7 +237,10 @@ void shadow_client_refresh_rect(rdpShadowClient* client, BYTE count, RECTANGLE_1
 		wParam->rects = (RECTANGLE_16*) calloc(wParam->numRects, sizeof(RECTANGLE_16));
 
 		if (!wParam->rects)
+		{
+			free (wParam);
 			return;
+		}
 	}
 
 	CopyMemory(wParam->rects, areas, wParam->numRects * sizeof(RECTANGLE_16));
@@ -832,12 +845,15 @@ int shadow_client_subsystem_process_message(rdpShadowClient* client, wMessage* m
 		pointerPosition.xPos = msg->xPos;
 		pointerPosition.yPos = msg->yPos;
 
-		if ((msg->xPos != client->pointerX) || (msg->yPos != client->pointerY))
+		if (client->activated)
 		{
-			IFCALL(update->pointer->PointerPosition, context, &pointerPosition);
+			if ((msg->xPos != client->pointerX) || (msg->yPos != client->pointerY))
+			{
+				IFCALL(update->pointer->PointerPosition, context, &pointerPosition);
 
-			client->pointerX = msg->xPos;
-			client->pointerY = msg->yPos;
+				client->pointerX = msg->xPos;
+				client->pointerY = msg->yPos;
+			}
 		}
 
 		free(msg);
@@ -862,14 +878,17 @@ int shadow_client_subsystem_process_message(rdpShadowClient* client, wMessage* m
 
 		pointerCached.cacheIndex = pointerColor->cacheIndex;
 
-		shadow_client_convert_alpha_pointer_data(msg->pixels, msg->premultiplied,
-				msg->width, msg->height, pointerColor);
+		if (client->activated)
+		{
+			shadow_client_convert_alpha_pointer_data(msg->pixels, msg->premultiplied,
+					msg->width, msg->height, pointerColor);
 
-		IFCALL(update->pointer->PointerNew, context, &pointerNew);
-		IFCALL(update->pointer->PointerCached, context, &pointerCached);
+			IFCALL(update->pointer->PointerNew, context, &pointerNew);
+			IFCALL(update->pointer->PointerCached, context, &pointerCached);
 
-		free(pointerColor->xorMaskData);
-		free(pointerColor->andMaskData);
+			free(pointerColor->xorMaskData);
+			free(pointerColor->andMaskData);
+		}
 
 		free(msg->pixels);
 		free(msg);
diff --git a/server/shadow/shadow_encoder.c b/server/shadow/shadow_encoder.c
index 1e200ee..8d449bf 100644
--- a/server/shadow/shadow_encoder.c
+++ b/server/shadow/shadow_encoder.c
@@ -407,7 +407,10 @@ rdpShadowEncoder* shadow_encoder_new(rdpShadowClient* client)
 	encoder->height = server->screen->height;
 
 	if (shadow_encoder_init(encoder) < 0)
+	{
+		free (encoder);
 		return NULL;
+	}
 
 	return encoder;
 }
diff --git a/server/shadow/shadow_subsystem.c b/server/shadow/shadow_subsystem.c
index f0ed9b8..ac4fd70 100644
--- a/server/shadow/shadow_subsystem.c
+++ b/server/shadow/shadow_subsystem.c
@@ -93,11 +93,11 @@ int shadow_subsystem_load_entry_points(RDP_SHADOW_ENTRY_POINTS* pEntryPoints, co
 
 	entry = shadow_subsystem_load_static_entry(name);
 
+	ZeroMemory(pEntryPoints, sizeof(RDP_SHADOW_ENTRY_POINTS));
+
 	if (!entry)
 		return -1;
 
-	ZeroMemory(pEntryPoints, sizeof(RDP_SHADOW_ENTRY_POINTS));
-
 	if (entry(pEntryPoints) < 0)
 		return -1;
 
diff --git a/server/shadow/shadow_surface.c b/server/shadow/shadow_surface.c
index 9c58142..4c13662 100644
--- a/server/shadow/shadow_surface.c
+++ b/server/shadow/shadow_surface.c
@@ -44,12 +44,19 @@ rdpShadowSurface* shadow_surface_new(rdpShadowServer* server, int x, int y, int
 	surface->data = (BYTE*) malloc(surface->scanline * surface->height);
 
 	if (!surface->data)
+	{
+		free (surface);
 		return NULL;
+	}
 
 	ZeroMemory(surface->data, surface->scanline * surface->height);
 
 	if (!InitializeCriticalSectionAndSpinCount(&(surface->lock), 4000))
+	{
+		free (surface->data);
+		free (surface);
 		return NULL;
+	}
 
 	region16_init(&(surface->invalidRegion));
 
