[gnome-remote-desktop] clipboard-rdp: Add dummy handling for the Temporary Directory PDU



commit 80ba43020ad8276e43094d2350601ad16e4edca0
Author: Pascal Nowack <Pascal Nowack gmx de>
Date:   Fri Apr 16 14:02:06 2021 +0200

    clipboard-rdp: Add dummy handling for the Temporary Directory PDU
    
    In the initial implementation of the cliprdr protocol (in 1998), some
    PDUs did not exist:
    The capabilities PDUs, the locking PDUs and the
    FileContents-Request/Response PDUs.
    However, despite of that, file transfer was implemented:
    Using the device redirection channel, the client advertised a drive,
    where the server should put the files on a request.
    The path of the redirected drive, was advertised via the Temporary
    Directory PDU.
    While the cliprdr documentation has this behaviour only poorly
    documentated and doesn't directly mention the usage of a redirected
    drive, the Windows Server 2003 and Windows XP source code leaks,
    however, confirm this behaviour.
    When the client requested the files, it used the FormatDataRequest with
    the CF_HDROP format.
    The server then copied the files to the redirected drive and sent the
    file list (e.g. "temp/file1.txt temp/file2.txt") to the client.
    For client-to-server transfer, the server ignored requests with the
    CF_HDROP format.
    
    Today, this PDU is unused, but clients can technically still send this
    PDU.
    So, add a function to the associated function pointer, so FreeRDP
    doesn't dereference a NULL function pointer, upon receiving a Temporary
    Directory PDU.
    FileContentsRequests are used today instead, but the PDU still exists
    for compatibility.
    
    The same applies to the MonitorReady PDU, which was initially used by
    the server to initiate the cliprdr protocol.
    Today, the server first sends the ServerCapabilities PDU, followed by
    the MonitorReady PDU to maintain backward compatibility with ancient
    clients.

 src/grd-clipboard-rdp.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
---
diff --git a/src/grd-clipboard-rdp.c b/src/grd-clipboard-rdp.c
index 37164ed..a566daa 100644
--- a/src/grd-clipboard-rdp.c
+++ b/src/grd-clipboard-rdp.c
@@ -920,6 +920,20 @@ cliprdr_client_capabilities (CliprdrServerContext       *cliprdr_context,
   return CHANNEL_RC_OK;
 }
 
+/**
+ * Client sent us a Temporary Directory PDU.
+ * We don't handle the CF_HDROP format however. It's a relict of the past.
+ */
+static uint32_t
+cliprdr_temp_directory (CliprdrServerContext         *cliprdr_context,
+                        const CLIPRDR_TEMP_DIRECTORY *temp_directory)
+{
+  g_debug ("[RDP.CLIPRDR] Client sent a Temporary Directory PDU with path \"%s\"",
+           temp_directory->szTempDir);
+
+  return CHANNEL_RC_OK;
+}
+
 static gboolean
 update_server_format_list (gpointer user_data)
 {
@@ -1933,6 +1947,7 @@ grd_clipboard_rdp_new (GrdSessionRdp *session_rdp,
 #endif /* HAVE_FREERDP_2_3 */
 
   cliprdr_context->ClientCapabilities = cliprdr_client_capabilities;
+  cliprdr_context->TempDirectory = cliprdr_temp_directory;
   cliprdr_context->ClientFormatList = cliprdr_client_format_list;
   cliprdr_context->ClientFormatListResponse = cliprdr_client_format_list_response;
   cliprdr_context->ClientLockClipboardData = cliprdr_client_lock_clipboard_data;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]