Skip to contentSkip to conversation

ui/dbus: forward guest clipboard grabs that lack a serial

PATCH In review Rick Vernam 2 participants 2 messages Sep 7 – Sep 8

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ui/dbus: forward guest clipboard grabs that lack a serial

dbus_clipboard_update_info() drops any incoming grab whose QemuClipboardInfo has no serial number:

    if (self_update || !info->has_serial) {
        return;
    }

For grabs coming from ui/vdagent.c, has_serial is only set when the guest's vdagent client has negotiated VD_AGENT_CAP_CLIPBOARD_GRAB_SERIAL (see vdagent_clipboard_recv_grab()). When the guest doesn't negotiate it, the grab is silently dropped here and never forwarded to the D-Bus display client via Clipboard.Grab.

It seems other protocols (ui/gtk-clipboard.c, ui/vnc-clipboard.c) do not incorporate a validation on has_serial, so this patch matches their behavior.

---
 ui/dbus-clipboard.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ui/dbus-clipboard.c +1 -1
index 90318384ee..1389ec0edc 100644
@@ -72,7 +72,7 @@ dbus_clipboard_update_info(DBusDisplay *dpy, QemuClipboardInfo *info)
         return;
     }
 
-    if (self_update || !info->has_serial) {
+    if (self_update) {
         return;
     }
 
Signature · 1 line
2.55.0
#1 lore raw

Hi

Quoted 14 lines · Rick Vernam

dbus_clipboard_update_info() drops any incoming grab whose QemuClipboardInfo has no serial number:

    if (self_update || !info->has_serial) {
        return;
    }

For grabs coming from ui/vdagent.c, has_serial is only set when the guest's vdagent client has negotiated VD_AGENT_CAP_CLIPBOARD_GRAB_SERIAL (see vdagent_clipboard_recv_grab()). When the guest doesn't negotiate it, the grab is silently dropped here and never forwarded to the D-Bus display client via Clipboard.Grab.

Quoted 3 lines

It seems other protocols (ui/gtk-clipboard.c, ui/vnc-clipboard.c) do not incorporate a validation on has_serial, so this patch matches their behavior.

But dbus display relies on "serial" being valid. The client has no way to check !info->serial. Iow, the agent must support VD_AGENT_CAP_CLIPBOARD_GRAB_SERIAL. When not supported, the clipboard state get out of sync due to races.

Quoted 22 lines
---
 ui/dbus-clipboard.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ui/dbus-clipboard.c +1 -2
index 90318384ee..1389ec0edc 100644
@@ -72,7 +72,7 @@ dbus_clipboard_update_info(DBusDisplay *dpy, QemuClipboardInfo *info)
         return;
     }
 
-    if (self_update || !info->has_serial) {
+    if (self_update) {
         return;
     }
 
--

2.55.0