From d6612d8d42a9bc7c17fe17fe91862d6cfb577741 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Tue, 5 Jan 2021 10:25:54 +0100 Subject: [PATCH] Add debug logging for ignored clipboard events --- common/rfb/CConnection.cxx | 12 +++++++++--- common/rfb/SConnection.cxx | 12 +++++++++--- common/rfb/VNCServerST.cxx | 4 +++- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/common/rfb/CConnection.cxx b/common/rfb/CConnection.cxx index 6632efa8..11cf29c9 100644 --- a/common/rfb/CConnection.cxx +++ b/common/rfb/CConnection.cxx @@ -495,10 +495,14 @@ void CConnection::handleClipboardCaps(rdr::U32 flags, void CConnection::handleClipboardRequest(rdr::U32 flags) { - if (!(flags & rfb::clipboardUTF8)) + if (!(flags & rfb::clipboardUTF8)) { + vlog.debug("Ignoring clipboard request for unsupported formats 0x%x", flags); return; - if (!hasLocalClipboard) + } + if (!hasLocalClipboard) { + vlog.debug("Ignoring unexpected clipboard request"); return; + } handleClipboardRequest(); } @@ -525,8 +529,10 @@ void CConnection::handleClipboardProvide(rdr::U32 flags, const size_t* lengths, const rdr::U8* const* data) { - if (!(flags & rfb::clipboardUTF8)) + if (!(flags & rfb::clipboardUTF8)) { + vlog.debug("Ignoring clipboard provide with unsupported formats 0x%x", flags); return; + } strFree(serverClipboard); serverClipboard = NULL; diff --git a/common/rfb/SConnection.cxx b/common/rfb/SConnection.cxx index d44ff786..683d29b6 100644 --- a/common/rfb/SConnection.cxx +++ b/common/rfb/SConnection.cxx @@ -327,10 +327,14 @@ void SConnection::clientCutText(const char* str) void SConnection::handleClipboardRequest(rdr::U32 flags) { - if (!(flags & rfb::clipboardUTF8)) + if (!(flags & rfb::clipboardUTF8)) { + vlog.debug("Ignoring clipboard request for unsupported formats 0x%x", flags); return; - if (!hasLocalClipboard) + } + if (!hasLocalClipboard) { + vlog.debug("Ignoring unexpected clipboard request"); return; + } handleClipboardRequest(); } @@ -357,8 +361,10 @@ void SConnection::handleClipboardProvide(rdr::U32 flags, const size_t* lengths, const rdr::U8* const* data) { - if (!(flags & rfb::clipboardUTF8)) + if (!(flags & rfb::clipboardUTF8)) { + vlog.debug("Ignoring clipboard provide with unsupported formats 0x%x", flags); return; + } strFree(clientClipboard); clientClipboard = NULL; diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx index 17e963e8..fe060857 100644 --- a/common/rfb/VNCServerST.cxx +++ b/common/rfb/VNCServerST.cxx @@ -515,8 +515,10 @@ void VNCServerST::handleClipboardAnnounce(VNCSConnectionST* client, void VNCServerST::handleClipboardData(VNCSConnectionST* client, const char* data) { - if (client != clipboardClient) + if (client != clipboardClient) { + slog.debug("Ignoring unexpected clipboard data"); return; + } desktop->handleClipboardData(data); } -- 2.39.5