From 25fa5ef1c536399cb96091e214fff0ccc746d20e Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Mon, 21 Nov 2022 15:16:48 +0100 Subject: [PATCH] remote-desktop: Accept ConnectToEIS only with started sessions The ConnectToEIS() method allows the client to communicate directly with EIS via a socket. But we need to allow for this only with a fully started session, otherwise ConnecToEIS() would allow to bypass the permission and the user dialog entirely. --- src/remote-desktop.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/remote-desktop.c b/src/remote-desktop.c index 1ed0457c3..c06205f1c 100644 --- a/src/remote-desktop.c +++ b/src/remote-desktop.c @@ -1407,13 +1407,18 @@ handle_connect_to_eis (XdpDbusRemoteDesktop *object, switch (remote_desktop_session->state) { + case REMOTE_DESKTOP_SESSION_STATE_STARTED: + break; case REMOTE_DESKTOP_SESSION_STATE_INIT: case REMOTE_DESKTOP_SESSION_STATE_DEVICES_SELECTED: case REMOTE_DESKTOP_SESSION_STATE_SELECTING_DEVICES: case REMOTE_DESKTOP_SESSION_STATE_SOURCES_SELECTED: case REMOTE_DESKTOP_SESSION_STATE_SELECTING_SOURCES: - break; - case REMOTE_DESKTOP_SESSION_STATE_STARTED: + g_dbus_method_invocation_return_error (invocation, + G_DBUS_ERROR, + G_DBUS_ERROR_FAILED, + "Session is not ready"); + return G_DBUS_METHOD_INVOCATION_HANDLED; case REMOTE_DESKTOP_SESSION_STATE_STARTING: g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,