Fix server-to-client clipboard (CLIPRDR) for RDP clients

Summary

The server-to-client clipboard direction was non-functional — when copying text on the server, RDP clients never received the clipboard update. This fixes multiple issues in the CLIPRDR channel implementation:

  • Send ServerFormatListResponse to acknowledge the client's initial format list. Without this, clients (e.g. Microsoft Remote Desktop) consider the clipboard channel incomplete and ignore all subsequent ServerFormatList messages from the server. This was the primary cause of the breakage.
  • Set useLongFormatNames = TRUE to enable proper format name negotiation with modern RDP clients.
  • Zero-initialize CLIPRDR_FORMAT struct in sendServerData() — previously allocated with malloc(), leaving formatName as a garbage pointer instead of nullptr.
  • Send CB_RESPONSE_FAIL in onClientFormatDataRequest() when the requested format is unsupported, instead of silently returning (CLIPRDR protocol requires a response).
  • Include null terminator in CF_UNICODETEXT response data.
  • Remove outdated TODO comment in Clipboard.h.

Test plan

  • Connect from an RDP client (e.g. Microsoft Remote Desktop on macOS)
  • Copy text in a KDE application on the server
  • Verify the text can be pasted on the client side
  • Copy text on the client side
  • Verify the text can be pasted in a KDE application on the server
  • Verify bidirectional clipboard works across multiple copy/paste cycles
Edited by realies

Merge request reports

Loading