|
|
dfaa01 |
From 2724b4fd6d4ac527acc481f056f535141b63fe24 Mon Sep 17 00:00:00 2001
|
|
|
e0b6b0 |
From: Iain Lane <iainl@gnome.org>
|
|
|
e0b6b0 |
Date: Tue, 7 May 2019 15:57:43 +0100
|
|
|
e0b6b0 |
Subject: [PATCH 49/51] GdmManager, GdmDisplay: Add RegisterSession method
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
Window managers can use this to register with GDM when they've finished
|
|
|
e0b6b0 |
starting up and started displaying.
|
|
|
e0b6b0 |
---
|
|
|
dfaa01 |
daemon/gdm-display.c | 24 ++++++++++++++++++++++++
|
|
|
e0b6b0 |
daemon/gdm-manager.c | 30 ++++++++++++++++++++++++++++++
|
|
|
e0b6b0 |
daemon/gdm-manager.xml | 3 +++
|
|
|
dfaa01 |
3 files changed, 57 insertions(+)
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
diff --git a/daemon/gdm-display.c b/daemon/gdm-display.c
|
|
|
dfaa01 |
index 1cef8c7c1..56799741d 100644
|
|
|
e0b6b0 |
--- a/daemon/gdm-display.c
|
|
|
e0b6b0 |
+++ b/daemon/gdm-display.c
|
|
|
e0b6b0 |
@@ -64,82 +64,84 @@ struct GdmDisplayPrivate
|
|
|
e0b6b0 |
char *remote_hostname;
|
|
|
e0b6b0 |
int x11_display_number;
|
|
|
e0b6b0 |
char *x11_display_name;
|
|
|
e0b6b0 |
int status;
|
|
|
e0b6b0 |
time_t creation_time;
|
|
|
e0b6b0 |
GTimer *server_timer;
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
char *x11_cookie;
|
|
|
e0b6b0 |
gsize x11_cookie_size;
|
|
|
e0b6b0 |
GdmDisplayAccessFile *access_file;
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
guint finish_idle_id;
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
xcb_connection_t *xcb_connection;
|
|
|
e0b6b0 |
int xcb_screen_number;
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
GDBusConnection *connection;
|
|
|
e0b6b0 |
GdmDisplayAccessFile *user_access_file;
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
GdmDBusDisplay *display_skeleton;
|
|
|
e0b6b0 |
GDBusObjectSkeleton *object_skeleton;
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
/* this spawns and controls the greeter session */
|
|
|
e0b6b0 |
GdmLaunchEnvironment *launch_environment;
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
guint is_local : 1;
|
|
|
e0b6b0 |
guint is_initial : 1;
|
|
|
e0b6b0 |
guint allow_timed_login : 1;
|
|
|
e0b6b0 |
guint have_existing_user_accounts : 1;
|
|
|
e0b6b0 |
guint doing_initial_setup : 1;
|
|
|
e0b6b0 |
+ guint session_registered : 1;
|
|
|
e0b6b0 |
};
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
enum {
|
|
|
e0b6b0 |
PROP_0,
|
|
|
e0b6b0 |
PROP_ID,
|
|
|
e0b6b0 |
PROP_STATUS,
|
|
|
e0b6b0 |
PROP_SEAT_ID,
|
|
|
e0b6b0 |
PROP_SESSION_ID,
|
|
|
e0b6b0 |
PROP_SESSION_CLASS,
|
|
|
e0b6b0 |
PROP_SESSION_TYPE,
|
|
|
e0b6b0 |
PROP_REMOTE_HOSTNAME,
|
|
|
e0b6b0 |
PROP_X11_DISPLAY_NUMBER,
|
|
|
e0b6b0 |
PROP_X11_DISPLAY_NAME,
|
|
|
e0b6b0 |
PROP_X11_COOKIE,
|
|
|
e0b6b0 |
PROP_X11_AUTHORITY_FILE,
|
|
|
e0b6b0 |
PROP_IS_CONNECTED,
|
|
|
e0b6b0 |
PROP_IS_LOCAL,
|
|
|
e0b6b0 |
PROP_LAUNCH_ENVIRONMENT,
|
|
|
e0b6b0 |
PROP_IS_INITIAL,
|
|
|
e0b6b0 |
PROP_ALLOW_TIMED_LOGIN,
|
|
|
e0b6b0 |
PROP_HAVE_EXISTING_USER_ACCOUNTS,
|
|
|
e0b6b0 |
PROP_DOING_INITIAL_SETUP,
|
|
|
e0b6b0 |
+ PROP_SESSION_REGISTERED,
|
|
|
e0b6b0 |
};
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
static void gdm_display_class_init (GdmDisplayClass *klass);
|
|
|
e0b6b0 |
static void gdm_display_init (GdmDisplay *self);
|
|
|
e0b6b0 |
static void gdm_display_finalize (GObject *object);
|
|
|
e0b6b0 |
static void queue_finish (GdmDisplay *self);
|
|
|
e0b6b0 |
static void _gdm_display_set_status (GdmDisplay *self,
|
|
|
e0b6b0 |
int status);
|
|
|
e0b6b0 |
static gboolean wants_initial_setup (GdmDisplay *self);
|
|
|
e0b6b0 |
G_DEFINE_ABSTRACT_TYPE (GdmDisplay, gdm_display, G_TYPE_OBJECT)
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
GQuark
|
|
|
e0b6b0 |
gdm_display_error_quark (void)
|
|
|
e0b6b0 |
{
|
|
|
e0b6b0 |
static GQuark ret = 0;
|
|
|
e0b6b0 |
if (ret == 0) {
|
|
|
e0b6b0 |
ret = g_quark_from_static_string ("gdm_display_error");
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
return ret;
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
time_t
|
|
|
e0b6b0 |
gdm_display_get_creation_time (GdmDisplay *self)
|
|
|
e0b6b0 |
{
|
|
|
e0b6b0 |
g_return_val_if_fail (GDM_IS_DISPLAY (self), 0);
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
return self->priv->creation_time;
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
|
|
|
dfaa01 |
@@ -733,60 +735,68 @@ static void
|
|
|
e0b6b0 |
_gdm_display_set_x11_display_number (GdmDisplay *self,
|
|
|
e0b6b0 |
int num)
|
|
|
e0b6b0 |
{
|
|
|
e0b6b0 |
self->priv->x11_display_number = num;
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
static void
|
|
|
e0b6b0 |
_gdm_display_set_x11_display_name (GdmDisplay *self,
|
|
|
e0b6b0 |
const char *x11_display)
|
|
|
e0b6b0 |
{
|
|
|
e0b6b0 |
g_free (self->priv->x11_display_name);
|
|
|
e0b6b0 |
self->priv->x11_display_name = g_strdup (x11_display);
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
static void
|
|
|
e0b6b0 |
_gdm_display_set_x11_cookie (GdmDisplay *self,
|
|
|
e0b6b0 |
const char *x11_cookie)
|
|
|
e0b6b0 |
{
|
|
|
e0b6b0 |
g_free (self->priv->x11_cookie);
|
|
|
e0b6b0 |
self->priv->x11_cookie = g_strdup (x11_cookie);
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
static void
|
|
|
e0b6b0 |
_gdm_display_set_is_local (GdmDisplay *self,
|
|
|
e0b6b0 |
gboolean is_local)
|
|
|
e0b6b0 |
{
|
|
|
e0b6b0 |
g_debug ("GdmDisplay: local: %s", is_local? "yes" : "no");
|
|
|
e0b6b0 |
self->priv->is_local = is_local;
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
+static void
|
|
|
e0b6b0 |
+_gdm_display_set_session_registered (GdmDisplay *self,
|
|
|
e0b6b0 |
+ gboolean registered)
|
|
|
e0b6b0 |
+{
|
|
|
e0b6b0 |
+ g_debug ("GdmDisplay: session registered: %s", registered? "yes" : "no");
|
|
|
dfaa01 |
+ self->priv->session_registered = registered;
|
|
|
e0b6b0 |
+}
|
|
|
e0b6b0 |
+
|
|
|
e0b6b0 |
static void
|
|
|
e0b6b0 |
_gdm_display_set_launch_environment (GdmDisplay *self,
|
|
|
e0b6b0 |
GdmLaunchEnvironment *launch_environment)
|
|
|
e0b6b0 |
{
|
|
|
e0b6b0 |
g_clear_object (&self->priv->launch_environment);
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
self->priv->launch_environment = g_object_ref (launch_environment);
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
static void
|
|
|
e0b6b0 |
_gdm_display_set_is_initial (GdmDisplay *self,
|
|
|
e0b6b0 |
gboolean initial)
|
|
|
e0b6b0 |
{
|
|
|
e0b6b0 |
g_debug ("GdmDisplay: initial: %s", initial? "yes" : "no");
|
|
|
e0b6b0 |
self->priv->is_initial = initial;
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
static void
|
|
|
e0b6b0 |
_gdm_display_set_allow_timed_login (GdmDisplay *self,
|
|
|
e0b6b0 |
gboolean allow_timed_login)
|
|
|
e0b6b0 |
{
|
|
|
e0b6b0 |
g_debug ("GdmDisplay: allow timed login: %s", allow_timed_login? "yes" : "no");
|
|
|
e0b6b0 |
self->priv->allow_timed_login = allow_timed_login;
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
static void
|
|
|
e0b6b0 |
gdm_display_set_property (GObject *object,
|
|
|
e0b6b0 |
guint prop_id,
|
|
|
e0b6b0 |
const GValue *value,
|
|
|
e0b6b0 |
GParamSpec *pspec)
|
|
|
dfaa01 |
@@ -811,60 +821,63 @@ gdm_display_set_property (GObject *object,
|
|
|
e0b6b0 |
case PROP_SESSION_CLASS:
|
|
|
e0b6b0 |
_gdm_display_set_session_class (self, g_value_get_string (value));
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
case PROP_SESSION_TYPE:
|
|
|
e0b6b0 |
_gdm_display_set_session_type (self, g_value_get_string (value));
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
case PROP_REMOTE_HOSTNAME:
|
|
|
e0b6b0 |
_gdm_display_set_remote_hostname (self, g_value_get_string (value));
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
case PROP_X11_DISPLAY_NUMBER:
|
|
|
e0b6b0 |
_gdm_display_set_x11_display_number (self, g_value_get_int (value));
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
case PROP_X11_DISPLAY_NAME:
|
|
|
e0b6b0 |
_gdm_display_set_x11_display_name (self, g_value_get_string (value));
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
case PROP_X11_COOKIE:
|
|
|
e0b6b0 |
_gdm_display_set_x11_cookie (self, g_value_get_string (value));
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
case PROP_IS_LOCAL:
|
|
|
e0b6b0 |
_gdm_display_set_is_local (self, g_value_get_boolean (value));
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
case PROP_ALLOW_TIMED_LOGIN:
|
|
|
e0b6b0 |
_gdm_display_set_allow_timed_login (self, g_value_get_boolean (value));
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
case PROP_LAUNCH_ENVIRONMENT:
|
|
|
e0b6b0 |
_gdm_display_set_launch_environment (self, g_value_get_object (value));
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
case PROP_IS_INITIAL:
|
|
|
e0b6b0 |
_gdm_display_set_is_initial (self, g_value_get_boolean (value));
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
+ case PROP_SESSION_REGISTERED:
|
|
|
e0b6b0 |
+ _gdm_display_set_session_registered (self, g_value_get_boolean (value));
|
|
|
e0b6b0 |
+ break;
|
|
|
e0b6b0 |
default:
|
|
|
e0b6b0 |
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
static void
|
|
|
e0b6b0 |
gdm_display_get_property (GObject *object,
|
|
|
e0b6b0 |
guint prop_id,
|
|
|
e0b6b0 |
GValue *value,
|
|
|
e0b6b0 |
GParamSpec *pspec)
|
|
|
e0b6b0 |
{
|
|
|
e0b6b0 |
GdmDisplay *self;
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
self = GDM_DISPLAY (object);
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
switch (prop_id) {
|
|
|
e0b6b0 |
case PROP_ID:
|
|
|
e0b6b0 |
g_value_set_string (value, self->priv->id);
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
case PROP_STATUS:
|
|
|
e0b6b0 |
g_value_set_int (value, self->priv->status);
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
case PROP_SEAT_ID:
|
|
|
e0b6b0 |
g_value_set_string (value, self->priv->seat_id);
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
case PROP_SESSION_ID:
|
|
|
e0b6b0 |
g_value_set_string (value, self->priv->session_id);
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
case PROP_SESSION_CLASS:
|
|
|
dfaa01 |
@@ -881,60 +894,63 @@ gdm_display_get_property (GObject *object,
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
case PROP_X11_DISPLAY_NAME:
|
|
|
e0b6b0 |
g_value_set_string (value, self->priv->x11_display_name);
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
case PROP_X11_COOKIE:
|
|
|
e0b6b0 |
g_value_set_string (value, self->priv->x11_cookie);
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
case PROP_X11_AUTHORITY_FILE:
|
|
|
e0b6b0 |
g_value_take_string (value,
|
|
|
e0b6b0 |
self->priv->access_file?
|
|
|
e0b6b0 |
gdm_display_access_file_get_path (self->priv->access_file) : NULL);
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
case PROP_IS_LOCAL:
|
|
|
e0b6b0 |
g_value_set_boolean (value, self->priv->is_local);
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
case PROP_IS_CONNECTED:
|
|
|
e0b6b0 |
g_value_set_boolean (value, self->priv->xcb_connection != NULL);
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
case PROP_LAUNCH_ENVIRONMENT:
|
|
|
e0b6b0 |
g_value_set_object (value, self->priv->launch_environment);
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
case PROP_IS_INITIAL:
|
|
|
e0b6b0 |
g_value_set_boolean (value, self->priv->is_initial);
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
case PROP_HAVE_EXISTING_USER_ACCOUNTS:
|
|
|
e0b6b0 |
g_value_set_boolean (value, self->priv->have_existing_user_accounts);
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
case PROP_DOING_INITIAL_SETUP:
|
|
|
e0b6b0 |
g_value_set_boolean (value, self->priv->doing_initial_setup);
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
+ case PROP_SESSION_REGISTERED:
|
|
|
e0b6b0 |
+ g_value_set_boolean (value, priv->session_registered);
|
|
|
e0b6b0 |
+ break;
|
|
|
e0b6b0 |
case PROP_ALLOW_TIMED_LOGIN:
|
|
|
e0b6b0 |
g_value_set_boolean (value, self->priv->allow_timed_login);
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
default:
|
|
|
e0b6b0 |
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
e0b6b0 |
break;
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
static gboolean
|
|
|
e0b6b0 |
handle_get_id (GdmDBusDisplay *skeleton,
|
|
|
e0b6b0 |
GDBusMethodInvocation *invocation,
|
|
|
e0b6b0 |
GdmDisplay *self)
|
|
|
e0b6b0 |
{
|
|
|
e0b6b0 |
char *id;
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
gdm_display_get_id (self, &id, NULL);
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
gdm_dbus_display_complete_get_id (skeleton, invocation, id);
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
g_free (id);
|
|
|
e0b6b0 |
return TRUE;
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
static gboolean
|
|
|
e0b6b0 |
handle_get_remote_hostname (GdmDBusDisplay *skeleton,
|
|
|
e0b6b0 |
GDBusMethodInvocation *invocation,
|
|
|
e0b6b0 |
GdmDisplay *self)
|
|
|
e0b6b0 |
{
|
|
|
e0b6b0 |
char *hostname;
|
|
|
dfaa01 |
@@ -1197,60 +1213,68 @@ gdm_display_class_init (GdmDisplayClass *klass)
|
|
|
e0b6b0 |
G_PARAM_READABLE));
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
g_object_class_install_property (object_class,
|
|
|
e0b6b0 |
PROP_IS_LOCAL,
|
|
|
e0b6b0 |
g_param_spec_boolean ("is-local",
|
|
|
e0b6b0 |
NULL,
|
|
|
e0b6b0 |
NULL,
|
|
|
e0b6b0 |
TRUE,
|
|
|
e0b6b0 |
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
|
|
e0b6b0 |
g_object_class_install_property (object_class,
|
|
|
e0b6b0 |
PROP_IS_CONNECTED,
|
|
|
e0b6b0 |
g_param_spec_boolean ("is-connected",
|
|
|
e0b6b0 |
NULL,
|
|
|
e0b6b0 |
NULL,
|
|
|
e0b6b0 |
TRUE,
|
|
|
e0b6b0 |
G_PARAM_READABLE));
|
|
|
e0b6b0 |
g_object_class_install_property (object_class,
|
|
|
e0b6b0 |
PROP_HAVE_EXISTING_USER_ACCOUNTS,
|
|
|
e0b6b0 |
g_param_spec_boolean ("have-existing-user-accounts",
|
|
|
e0b6b0 |
NULL,
|
|
|
e0b6b0 |
NULL,
|
|
|
e0b6b0 |
FALSE,
|
|
|
e0b6b0 |
G_PARAM_READABLE));
|
|
|
e0b6b0 |
g_object_class_install_property (object_class,
|
|
|
e0b6b0 |
PROP_DOING_INITIAL_SETUP,
|
|
|
e0b6b0 |
g_param_spec_boolean ("doing-initial-setup",
|
|
|
e0b6b0 |
NULL,
|
|
|
e0b6b0 |
NULL,
|
|
|
e0b6b0 |
FALSE,
|
|
|
e0b6b0 |
G_PARAM_READABLE));
|
|
|
e0b6b0 |
+ g_object_class_install_property (object_class,
|
|
|
e0b6b0 |
+ PROP_SESSION_REGISTERED,
|
|
|
e0b6b0 |
+ g_param_spec_boolean ("session-registered",
|
|
|
e0b6b0 |
+ NULL,
|
|
|
e0b6b0 |
+ NULL,
|
|
|
e0b6b0 |
+ FALSE,
|
|
|
e0b6b0 |
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
e0b6b0 |
+
|
|
|
e0b6b0 |
g_object_class_install_property (object_class,
|
|
|
e0b6b0 |
PROP_LAUNCH_ENVIRONMENT,
|
|
|
e0b6b0 |
g_param_spec_object ("launch-environment",
|
|
|
e0b6b0 |
NULL,
|
|
|
e0b6b0 |
NULL,
|
|
|
e0b6b0 |
GDM_TYPE_LAUNCH_ENVIRONMENT,
|
|
|
e0b6b0 |
G_PARAM_READWRITE));
|
|
|
e0b6b0 |
g_object_class_install_property (object_class,
|
|
|
e0b6b0 |
PROP_STATUS,
|
|
|
e0b6b0 |
g_param_spec_int ("status",
|
|
|
e0b6b0 |
"status",
|
|
|
e0b6b0 |
"status",
|
|
|
e0b6b0 |
-1,
|
|
|
e0b6b0 |
G_MAXINT,
|
|
|
e0b6b0 |
GDM_DISPLAY_UNMANAGED,
|
|
|
e0b6b0 |
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
g_type_class_add_private (klass, sizeof (GdmDisplayPrivate));
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
static void
|
|
|
e0b6b0 |
gdm_display_init (GdmDisplay *self)
|
|
|
e0b6b0 |
{
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
self->priv = GDM_DISPLAY_GET_PRIVATE (self);
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
self->priv->creation_time = time (NULL);
|
|
|
e0b6b0 |
self->priv->server_timer = g_timer_new ();
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
|
|
|
e0b6b0 |
index b147d73db..bff602a07 100644
|
|
|
e0b6b0 |
--- a/daemon/gdm-manager.c
|
|
|
e0b6b0 |
+++ b/daemon/gdm-manager.c
|
|
|
e0b6b0 |
@@ -789,60 +789,89 @@ gdm_manager_handle_register_display (GdmDBusManager *manager,
|
|
|
e0b6b0 |
if (session != NULL) {
|
|
|
e0b6b0 |
GPid pid;
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
if (x11_display_name != NULL) {
|
|
|
e0b6b0 |
g_object_set (G_OBJECT (session), "display-name", x11_display_name, NULL);
|
|
|
e0b6b0 |
g_object_set (G_OBJECT (display), "x11-display-name", x11_display_name, NULL);
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
/* FIXME: this should happen in gdm-session.c when the session is opened
|
|
|
e0b6b0 |
*/
|
|
|
e0b6b0 |
if (tty != NULL)
|
|
|
e0b6b0 |
g_object_set (G_OBJECT (session), "display-device", tty, NULL);
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
pid = gdm_session_get_pid (session);
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
if (pid > 0) {
|
|
|
e0b6b0 |
add_session_record (self, session, pid, SESSION_RECORD_LOGIN);
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
g_object_set (G_OBJECT (display), "status", GDM_DISPLAY_MANAGED, NULL);
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
gdm_dbus_manager_complete_register_display (GDM_DBUS_MANAGER (manager),
|
|
|
e0b6b0 |
invocation);
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
g_clear_pointer (&x11_display_name, g_free);
|
|
|
e0b6b0 |
g_clear_pointer (&tty, g_free);
|
|
|
e0b6b0 |
return TRUE;
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
+static gboolean
|
|
|
e0b6b0 |
+gdm_manager_handle_register_session (GdmDBusManager *manager,
|
|
|
e0b6b0 |
+ GDBusMethodInvocation *invocation,
|
|
|
e0b6b0 |
+ GVariant *details)
|
|
|
e0b6b0 |
+{
|
|
|
e0b6b0 |
+ GdmManager *self = GDM_MANAGER (manager);
|
|
|
e0b6b0 |
+ GdmDisplay *display;
|
|
|
e0b6b0 |
+ const char *sender;
|
|
|
e0b6b0 |
+ GDBusConnection *connection;
|
|
|
e0b6b0 |
+
|
|
|
e0b6b0 |
+ sender = g_dbus_method_invocation_get_sender (invocation);
|
|
|
e0b6b0 |
+ connection = g_dbus_method_invocation_get_connection (invocation);
|
|
|
e0b6b0 |
+
|
|
|
e0b6b0 |
+ get_display_and_details_for_bus_sender (self, connection, sender, &display,
|
|
|
e0b6b0 |
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
|
|
e0b6b0 |
+
|
|
|
e0b6b0 |
+ g_debug ("GdmManager: trying to register new session on display %p", display);
|
|
|
e0b6b0 |
+
|
|
|
e0b6b0 |
+ if (display != NULL)
|
|
|
e0b6b0 |
+ g_object_set (G_OBJECT (display), "session-registered", TRUE, NULL);
|
|
|
e0b6b0 |
+ else
|
|
|
e0b6b0 |
+ g_debug ("GdmManager: No display, not registering");
|
|
|
e0b6b0 |
+
|
|
|
e0b6b0 |
+ gdm_dbus_manager_complete_register_session (GDM_DBUS_MANAGER (manager),
|
|
|
e0b6b0 |
+ invocation);
|
|
|
e0b6b0 |
+
|
|
|
e0b6b0 |
+ return TRUE;
|
|
|
e0b6b0 |
+}
|
|
|
e0b6b0 |
+
|
|
|
e0b6b0 |
static gboolean
|
|
|
e0b6b0 |
gdm_manager_handle_open_session (GdmDBusManager *manager,
|
|
|
e0b6b0 |
GDBusMethodInvocation *invocation)
|
|
|
e0b6b0 |
{
|
|
|
e0b6b0 |
GdmManager *self = GDM_MANAGER (manager);
|
|
|
e0b6b0 |
const char *sender;
|
|
|
e0b6b0 |
GDBusConnection *connection;
|
|
|
e0b6b0 |
GdmDisplay *display = NULL;
|
|
|
e0b6b0 |
GdmSession *session = NULL;
|
|
|
e0b6b0 |
const char *address;
|
|
|
e0b6b0 |
GPid pid = 0;
|
|
|
e0b6b0 |
uid_t uid = (uid_t) -1;
|
|
|
e0b6b0 |
uid_t allowed_user;
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
g_debug ("GdmManager: trying to open new session");
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
sender = g_dbus_method_invocation_get_sender (invocation);
|
|
|
e0b6b0 |
connection = g_dbus_method_invocation_get_connection (invocation);
|
|
|
e0b6b0 |
get_display_and_details_for_bus_sender (self, connection, sender, &display, NULL, NULL, NULL, &pid, &uid, NULL, NULL);
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
if (display == NULL) {
|
|
|
e0b6b0 |
g_dbus_method_invocation_return_error_literal (invocation,
|
|
|
e0b6b0 |
G_DBUS_ERROR,
|
|
|
e0b6b0 |
G_DBUS_ERROR_ACCESS_DENIED,
|
|
|
e0b6b0 |
_("No session available"));
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
return TRUE;
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
#ifdef HAVE_LIBXDMCP
|
|
|
e0b6b0 |
@@ -1167,60 +1196,61 @@ gdm_manager_handle_open_reauthentication_channel (GdmDBusManager *manager
|
|
|
e0b6b0 |
g_hash_table_insert (self->priv->open_reauthentication_requests,
|
|
|
e0b6b0 |
GINT_TO_POINTER (pid),
|
|
|
e0b6b0 |
invocation);
|
|
|
e0b6b0 |
} else if (is_login_screen) {
|
|
|
e0b6b0 |
g_dbus_method_invocation_return_error_literal (invocation,
|
|
|
e0b6b0 |
G_DBUS_ERROR,
|
|
|
e0b6b0 |
G_DBUS_ERROR_ACCESS_DENIED,
|
|
|
e0b6b0 |
"Login screen only allowed to open reauthentication channels for running sessions");
|
|
|
e0b6b0 |
return TRUE;
|
|
|
e0b6b0 |
} else {
|
|
|
e0b6b0 |
char *address;
|
|
|
e0b6b0 |
address = open_temporary_reauthentication_channel (self,
|
|
|
e0b6b0 |
seat_id,
|
|
|
e0b6b0 |
session_id,
|
|
|
e0b6b0 |
pid,
|
|
|
e0b6b0 |
uid,
|
|
|
e0b6b0 |
is_remote);
|
|
|
e0b6b0 |
gdm_dbus_manager_complete_open_reauthentication_channel (GDM_DBUS_MANAGER (manager),
|
|
|
e0b6b0 |
invocation,
|
|
|
e0b6b0 |
address);
|
|
|
e0b6b0 |
g_free (address);
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
return TRUE;
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
static void
|
|
|
e0b6b0 |
manager_interface_init (GdmDBusManagerIface *interface)
|
|
|
e0b6b0 |
{
|
|
|
e0b6b0 |
interface->handle_register_display = gdm_manager_handle_register_display;
|
|
|
e0b6b0 |
+ interface->handle_register_session = gdm_manager_handle_register_session;
|
|
|
e0b6b0 |
interface->handle_open_session = gdm_manager_handle_open_session;
|
|
|
e0b6b0 |
interface->handle_open_reauthentication_channel = gdm_manager_handle_open_reauthentication_channel;
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
static gboolean
|
|
|
e0b6b0 |
display_is_on_seat0 (GdmDisplay *display)
|
|
|
e0b6b0 |
{
|
|
|
e0b6b0 |
gboolean is_on_seat0 = TRUE;
|
|
|
e0b6b0 |
char *seat_id = NULL;
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
g_object_get (G_OBJECT (display), "seat-id", &seat_id, NULL);
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
if (g_strcmp0 (seat_id, "seat0") != 0) {
|
|
|
e0b6b0 |
is_on_seat0 = FALSE;
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
g_free (seat_id);
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
return is_on_seat0;
|
|
|
e0b6b0 |
}
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
static gboolean
|
|
|
e0b6b0 |
get_timed_login_details (GdmManager *manager,
|
|
|
e0b6b0 |
char **usernamep,
|
|
|
e0b6b0 |
int *delayp)
|
|
|
e0b6b0 |
{
|
|
|
e0b6b0 |
gboolean res;
|
|
|
e0b6b0 |
gboolean enabled;
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
int delay;
|
|
|
e0b6b0 |
diff --git a/daemon/gdm-manager.xml b/daemon/gdm-manager.xml
|
|
|
e0b6b0 |
index f11f3fb73..92ef1d02d 100644
|
|
|
e0b6b0 |
--- a/daemon/gdm-manager.xml
|
|
|
e0b6b0 |
+++ b/daemon/gdm-manager.xml
|
|
|
e0b6b0 |
@@ -1,16 +1,19 @@
|
|
|
e0b6b0 |
|
|
|
e0b6b0 |
<node name="/org/gnome/DisplayManager/Manager">
|
|
|
e0b6b0 |
<interface name="org.gnome.DisplayManager.Manager">
|
|
|
e0b6b0 |
<method name="RegisterDisplay">
|
|
|
e0b6b0 |
<arg name="details" direction="in" type="a{ss}"/>
|
|
|
e0b6b0 |
</method>
|
|
|
e0b6b0 |
+ <method name="RegisterSession">
|
|
|
e0b6b0 |
+ <arg name="details" direction="in" type="a{sv}"/>
|
|
|
e0b6b0 |
+ </method>
|
|
|
e0b6b0 |
<method name="OpenSession">
|
|
|
e0b6b0 |
<arg name="address" direction="out" type="s"/>
|
|
|
e0b6b0 |
</method>
|
|
|
e0b6b0 |
<method name="OpenReauthenticationChannel">
|
|
|
e0b6b0 |
<arg name="username" direction="in" type="s"/>
|
|
|
e0b6b0 |
<arg name="address" direction="out" type="s"/>
|
|
|
e0b6b0 |
</method>
|
|
|
e0b6b0 |
<property name="Version" type="s" access="read"/>
|
|
|
e0b6b0 |
</interface>
|
|
|
e0b6b0 |
</node>
|
|
|
e0b6b0 |
--
|
|
|
dfaa01 |
2.28.0
|
|
|
e0b6b0 |
|