diff mbox series

ui/dbus: on win32, allow ANONYMOUS with p2p

Message ID 20250114104753.2612342-1-marcandre.lureau@redhat.com (mailing list archive)
State New
Headers show
Series ui/dbus: on win32, allow ANONYMOUS with p2p | expand

Commit Message

Marc-André Lureau Jan. 14, 2025, 10:47 a.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

GLib doesn't implement EXTERNAL on win32 at the moment, and disables
ANONYMOUS by default. zbus dropped support for COOKIE_SHA1 in 5.0,
making it no longer possible to connect to qemu -display dbus.

Since p2p connections are gated by existing QMP (or a D-Bus connection),
qemu -display dbus p2p can accept authentication with ANONYMOUS.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 audio/dbusaudio.c        |  8 +++++++-
 ui/dbus-console.c        |  8 +++++++-
 ui/dbus.c                | 10 ++++++++--
 tests/lcitool/libvirt-ci |  2 +-
 4 files changed, 23 insertions(+), 5 deletions(-)

Comments

Marc-André Lureau Jan. 14, 2025, 11:41 a.m. UTC | #1
On Tue, Jan 14, 2025 at 2:50 PM <marcandre.lureau@redhat.com> wrote:
>
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> GLib doesn't implement EXTERNAL on win32 at the moment, and disables
> ANONYMOUS by default. zbus dropped support for COOKIE_SHA1 in 5.0,
> making it no longer possible to connect to qemu -display dbus.
>
> Since p2p connections are gated by existing QMP (or a D-Bus connection),
> qemu -display dbus p2p can accept authentication with ANONYMOUS.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
....

> diff --git a/tests/lcitool/libvirt-ci b/tests/lcitool/libvirt-ci
> index b6a65806bc..9ad3f70bde 160000
> --- a/tests/lcitool/libvirt-ci
> +++ b/tests/lcitool/libvirt-ci
> @@ -1 +1 @@
> -Subproject commit b6a65806bc9b2b56985f5e97c936b77c7e7a99fc
> +Subproject commit 9ad3f70bde9865d5ad18f36d256d472e72b5cbf3
> --

bad submodule update, my bad.
diff mbox series

Patch

diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c
index 095e739382..af77e7cc33 100644
--- a/audio/dbusaudio.c
+++ b/audio/dbusaudio.c
@@ -524,11 +524,17 @@  dbus_audio_register_listener(AudioState *s,
             );
     }
 
+    GDBusConnectionFlags flags =
+        G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER;
+#ifdef WIN32
+    flags |= G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS;
+#endif
+
     listener_conn =
         g_dbus_connection_new_sync(
             G_IO_STREAM(socket_conn),
             guid,
-            G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER,
+            flags,
             NULL, NULL, &err);
     if (err) {
         error_report("Failed to setup peer connection: %s", err->message);
diff --git a/ui/dbus-console.c b/ui/dbus-console.c
index 5eb1d40d16..85e215ef23 100644
--- a/ui/dbus-console.c
+++ b/ui/dbus-console.c
@@ -305,10 +305,16 @@  dbus_console_register_listener(DBusDisplayConsole *ddc,
 #endif
     );
 
+    GDBusConnectionFlags flags =
+        G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER;
+#ifdef WIN32
+    flags |= G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS;
+#endif
+
     listener_conn = g_dbus_connection_new_sync(
         G_IO_STREAM(socket_conn),
         guid,
-        G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER,
+        flags,
         NULL, NULL, &err);
     if (err) {
         error_report("Failed to setup peer connection: %s", err->message);
diff --git a/ui/dbus.c b/ui/dbus.c
index 7b258c6823..2eb03aa247 100644
--- a/ui/dbus.c
+++ b/ui/dbus.c
@@ -317,11 +317,17 @@  dbus_display_add_client(int csock, Error **errp)
     conn = g_socket_connection_factory_create_connection(socket);
 
     dbus_display->add_client_cancellable = g_cancellable_new();
+    GDBusConnectionFlags flags =
+        G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER |
+        G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING;
+
+#ifdef WIN32
+    flags |= G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS;
+#endif
 
     g_dbus_connection_new(G_IO_STREAM(conn),
                           guid,
-                          G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER |
-                          G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING,
+                          flags,
                           NULL,
                           dbus_display->add_client_cancellable,
                           dbus_display_add_client_ready,
diff --git a/tests/lcitool/libvirt-ci b/tests/lcitool/libvirt-ci
index b6a65806bc..9ad3f70bde 160000
--- a/tests/lcitool/libvirt-ci
+++ b/tests/lcitool/libvirt-ci
@@ -1 +1 @@ 
-Subproject commit b6a65806bc9b2b56985f5e97c936b77c7e7a99fc
+Subproject commit 9ad3f70bde9865d5ad18f36d256d472e72b5cbf3