ui/dbus: on win32, allow ANONYMOUS with p2p

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>
This commit is contained in:
Marc-André Lureau 2025-01-13 23:31:33 +04:00
parent aeb6b818c1
commit ccf86c392c
3 changed files with 22 additions and 4 deletions

View file

@ -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);