|
|
6b1540 |
From f0dce28fa02210caa445e96d9cbec1d150b79e80 Mon Sep 17 00:00:00 2001
|
|
|
890c66 |
From: Ray Strode <rstrode@redhat.com>
|
|
|
890c66 |
Date: Wed, 15 Aug 2018 10:48:16 -0400
|
|
|
890c66 |
Subject: [PATCH 1/4] worker: don't load user settings for program sessions
|
|
|
890c66 |
|
|
|
890c66 |
We don't need or want the login greeter to access accountsservice
|
|
|
890c66 |
for its session name
|
|
|
890c66 |
---
|
|
|
3b7e70 |
daemon/gdm-session-worker.c | 37 ++++++++++++++++++++++++++-----------
|
|
|
3b7e70 |
1 file changed, 26 insertions(+), 11 deletions(-)
|
|
|
890c66 |
|
|
|
890c66 |
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
|
|
|
6b1540 |
index 9b8e0d87..438348df 100644
|
|
|
890c66 |
--- a/daemon/gdm-session-worker.c
|
|
|
890c66 |
+++ b/daemon/gdm-session-worker.c
|
|
|
3b7e70 |
@@ -400,103 +400,108 @@ gdm_session_execute (const char *file,
|
|
|
890c66 |
*/
|
|
|
890c66 |
static gboolean
|
|
|
890c66 |
gdm_session_worker_get_username (GdmSessionWorker *worker,
|
|
|
890c66 |
char **username)
|
|
|
890c66 |
{
|
|
|
890c66 |
gconstpointer item;
|
|
|
890c66 |
|
|
|
890c66 |
g_assert (worker->priv->pam_handle != NULL);
|
|
|
890c66 |
|
|
|
890c66 |
if (pam_get_item (worker->priv->pam_handle, PAM_USER, &item) == PAM_SUCCESS) {
|
|
|
890c66 |
if (username != NULL) {
|
|
|
890c66 |
*username = g_strdup ((char *) item);
|
|
|
890c66 |
g_debug ("GdmSessionWorker: username is '%s'",
|
|
|
890c66 |
*username != NULL ? *username : "<unset>");
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
if (worker->priv->auditor != NULL) {
|
|
|
890c66 |
gdm_session_auditor_set_username (worker->priv->auditor, (char *)item);
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
return TRUE;
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
return FALSE;
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
static void
|
|
|
890c66 |
attempt_to_load_user_settings (GdmSessionWorker *worker,
|
|
|
890c66 |
const char *username)
|
|
|
890c66 |
{
|
|
|
890c66 |
+ if (worker->priv->user_settings == NULL)
|
|
|
890c66 |
+ return;
|
|
|
890c66 |
+
|
|
|
890c66 |
+ if (gdm_session_settings_is_loaded (worker->priv->user_settings))
|
|
|
890c66 |
+ return;
|
|
|
890c66 |
+
|
|
|
890c66 |
g_debug ("GdmSessionWorker: attempting to load user settings");
|
|
|
890c66 |
gdm_session_settings_load (worker->priv->user_settings,
|
|
|
890c66 |
username);
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
static void
|
|
|
890c66 |
gdm_session_worker_update_username (GdmSessionWorker *worker)
|
|
|
890c66 |
{
|
|
|
890c66 |
char *username;
|
|
|
890c66 |
gboolean res;
|
|
|
890c66 |
|
|
|
890c66 |
username = NULL;
|
|
|
890c66 |
res = gdm_session_worker_get_username (worker, &username);
|
|
|
890c66 |
if (res) {
|
|
|
890c66 |
g_debug ("GdmSessionWorker: old-username='%s' new-username='%s'",
|
|
|
890c66 |
worker->priv->username != NULL ? worker->priv->username : "<unset>",
|
|
|
890c66 |
username != NULL ? username : "<unset>");
|
|
|
890c66 |
|
|
|
890c66 |
|
|
|
890c66 |
gdm_session_auditor_set_username (worker->priv->auditor, worker->priv->username);
|
|
|
890c66 |
|
|
|
890c66 |
if ((worker->priv->username == username) ||
|
|
|
890c66 |
((worker->priv->username != NULL) && (username != NULL) &&
|
|
|
890c66 |
(strcmp (worker->priv->username, username) == 0)))
|
|
|
890c66 |
goto out;
|
|
|
890c66 |
|
|
|
890c66 |
g_debug ("GdmSessionWorker: setting username to '%s'", username);
|
|
|
890c66 |
|
|
|
890c66 |
g_free (worker->priv->username);
|
|
|
890c66 |
worker->priv->username = username;
|
|
|
890c66 |
username = NULL;
|
|
|
890c66 |
|
|
|
890c66 |
gdm_dbus_worker_emit_username_changed (GDM_DBUS_WORKER (worker),
|
|
|
890c66 |
worker->priv->username);
|
|
|
890c66 |
|
|
|
890c66 |
/* We have a new username to try. If we haven't been able to
|
|
|
890c66 |
* read user settings up until now, then give it a go now
|
|
|
890c66 |
* (see the comment in do_setup for rationale on why it's useful
|
|
|
890c66 |
* to keep trying to read settings)
|
|
|
890c66 |
*/
|
|
|
890c66 |
if (worker->priv->username != NULL &&
|
|
|
890c66 |
- worker->priv->username[0] != '\0' &&
|
|
|
890c66 |
- !gdm_session_settings_is_loaded (worker->priv->user_settings)) {
|
|
|
890c66 |
+ worker->priv->username[0] != '\0') {
|
|
|
890c66 |
attempt_to_load_user_settings (worker, worker->priv->username);
|
|
|
890c66 |
}
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
out:
|
|
|
890c66 |
g_free (username);
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
static gboolean
|
|
|
890c66 |
gdm_session_worker_ask_question (GdmSessionWorker *worker,
|
|
|
890c66 |
const char *question,
|
|
|
890c66 |
char **answerp)
|
|
|
890c66 |
{
|
|
|
890c66 |
return gdm_dbus_worker_manager_call_info_query_sync (worker->priv->manager,
|
|
|
890c66 |
worker->priv->service,
|
|
|
890c66 |
question,
|
|
|
890c66 |
answerp,
|
|
|
890c66 |
NULL,
|
|
|
890c66 |
NULL);
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
static gboolean
|
|
|
890c66 |
gdm_session_worker_ask_for_secret (GdmSessionWorker *worker,
|
|
|
890c66 |
const char *question,
|
|
|
890c66 |
char **answerp)
|
|
|
890c66 |
{
|
|
|
890c66 |
return gdm_dbus_worker_manager_call_secret_info_query_sync (worker->priv->manager,
|
|
|
890c66 |
worker->priv->service,
|
|
|
890c66 |
question,
|
|
|
890c66 |
answerp,
|
|
|
6b1540 |
@@ -2598,87 +2603,89 @@ gdm_session_worker_get_property (GObject *object,
|
|
|
890c66 |
g_value_set_boolean (value, self->priv->is_reauth_session);
|
|
|
890c66 |
break;
|
|
|
3b7e70 |
case PROP_STATE:
|
|
|
3b7e70 |
g_value_set_enum (value, self->priv->state);
|
|
|
3b7e70 |
break;
|
|
|
890c66 |
default:
|
|
|
890c66 |
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
890c66 |
break;
|
|
|
890c66 |
}
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
static gboolean
|
|
|
890c66 |
gdm_session_worker_handle_set_environment_variable (GdmDBusWorker *object,
|
|
|
890c66 |
GDBusMethodInvocation *invocation,
|
|
|
890c66 |
const char *key,
|
|
|
890c66 |
const char *value)
|
|
|
890c66 |
{
|
|
|
890c66 |
GdmSessionWorker *worker = GDM_SESSION_WORKER (object);
|
|
|
890c66 |
gdm_session_worker_set_environment_variable (worker, key, value);
|
|
|
890c66 |
gdm_dbus_worker_complete_set_environment_variable (object, invocation);
|
|
|
890c66 |
return TRUE;
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
static gboolean
|
|
|
890c66 |
gdm_session_worker_handle_set_session_name (GdmDBusWorker *object,
|
|
|
890c66 |
GDBusMethodInvocation *invocation,
|
|
|
890c66 |
const char *session_name)
|
|
|
890c66 |
{
|
|
|
890c66 |
GdmSessionWorker *worker = GDM_SESSION_WORKER (object);
|
|
|
890c66 |
g_debug ("GdmSessionWorker: session name set to %s", session_name);
|
|
|
890c66 |
- gdm_session_settings_set_session_name (worker->priv->user_settings,
|
|
|
890c66 |
- session_name);
|
|
|
890c66 |
+ if (worker->priv->user_settings != NULL)
|
|
|
890c66 |
+ gdm_session_settings_set_session_name (worker->priv->user_settings,
|
|
|
890c66 |
+ session_name);
|
|
|
890c66 |
gdm_dbus_worker_complete_set_session_name (object, invocation);
|
|
|
890c66 |
return TRUE;
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
static gboolean
|
|
|
890c66 |
gdm_session_worker_handle_set_session_display_mode (GdmDBusWorker *object,
|
|
|
890c66 |
GDBusMethodInvocation *invocation,
|
|
|
890c66 |
const char *str)
|
|
|
890c66 |
{
|
|
|
890c66 |
GdmSessionWorker *worker = GDM_SESSION_WORKER (object);
|
|
|
890c66 |
g_debug ("GdmSessionWorker: session display mode set to %s", str);
|
|
|
890c66 |
worker->priv->display_mode = gdm_session_display_mode_from_string (str);
|
|
|
890c66 |
gdm_dbus_worker_complete_set_session_display_mode (object, invocation);
|
|
|
890c66 |
return TRUE;
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
static gboolean
|
|
|
890c66 |
gdm_session_worker_handle_set_language_name (GdmDBusWorker *object,
|
|
|
890c66 |
GDBusMethodInvocation *invocation,
|
|
|
890c66 |
const char *language_name)
|
|
|
890c66 |
{
|
|
|
890c66 |
GdmSessionWorker *worker = GDM_SESSION_WORKER (object);
|
|
|
890c66 |
g_debug ("GdmSessionWorker: language name set to %s", language_name);
|
|
|
890c66 |
- gdm_session_settings_set_language_name (worker->priv->user_settings,
|
|
|
890c66 |
- language_name);
|
|
|
890c66 |
+ if (worker->priv->user_settings != NULL)
|
|
|
890c66 |
+ gdm_session_settings_set_language_name (worker->priv->user_settings,
|
|
|
890c66 |
+ language_name);
|
|
|
890c66 |
gdm_dbus_worker_complete_set_language_name (object, invocation);
|
|
|
890c66 |
return TRUE;
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
static void
|
|
|
890c66 |
on_saved_language_name_read (GdmSessionWorker *worker)
|
|
|
890c66 |
{
|
|
|
890c66 |
char *language_name;
|
|
|
890c66 |
|
|
|
890c66 |
language_name = gdm_session_settings_get_language_name (worker->priv->user_settings);
|
|
|
890c66 |
|
|
|
890c66 |
g_debug ("GdmSessionWorker: Saved language is %s", language_name);
|
|
|
890c66 |
gdm_dbus_worker_emit_saved_language_name_read (GDM_DBUS_WORKER (worker),
|
|
|
890c66 |
language_name);
|
|
|
890c66 |
g_free (language_name);
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
static void
|
|
|
890c66 |
on_saved_session_name_read (GdmSessionWorker *worker)
|
|
|
890c66 |
{
|
|
|
890c66 |
char *session_name;
|
|
|
890c66 |
|
|
|
890c66 |
session_name = gdm_session_settings_get_session_name (worker->priv->user_settings);
|
|
|
890c66 |
|
|
|
890c66 |
g_debug ("GdmSessionWorker: Saved session is %s", session_name);
|
|
|
890c66 |
gdm_dbus_worker_emit_saved_session_name_read (GDM_DBUS_WORKER (worker),
|
|
|
890c66 |
session_name);
|
|
|
890c66 |
g_free (session_name);
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
6b1540 |
@@ -2756,110 +2763,113 @@ do_authorize (GdmSessionWorker *worker)
|
|
|
3b7e70 |
g_dbus_method_invocation_take_error (worker->priv->pending_invocation, error);
|
|
|
890c66 |
}
|
|
|
890c66 |
worker->priv->pending_invocation = NULL;
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
static void
|
|
|
890c66 |
do_accredit (GdmSessionWorker *worker)
|
|
|
890c66 |
{
|
|
|
890c66 |
GError *error;
|
|
|
890c66 |
gboolean res;
|
|
|
890c66 |
|
|
|
890c66 |
/* get kerberos tickets, setup group lists, etc
|
|
|
890c66 |
*/
|
|
|
890c66 |
error = NULL;
|
|
|
890c66 |
res = gdm_session_worker_accredit_user (worker, &error);
|
|
|
890c66 |
|
|
|
890c66 |
if (res) {
|
|
|
890c66 |
gdm_dbus_worker_complete_establish_credentials (GDM_DBUS_WORKER (worker), worker->priv->pending_invocation);
|
|
|
890c66 |
} else {
|
|
|
890c66 |
g_dbus_method_invocation_take_error (worker->priv->pending_invocation, error);
|
|
|
890c66 |
}
|
|
|
890c66 |
worker->priv->pending_invocation = NULL;
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
static void
|
|
|
890c66 |
save_account_details_now (GdmSessionWorker *worker)
|
|
|
890c66 |
{
|
|
|
890c66 |
g_assert (worker->priv->state == GDM_SESSION_WORKER_STATE_ACCREDITED);
|
|
|
890c66 |
|
|
|
890c66 |
g_debug ("GdmSessionWorker: saving account details for user %s", worker->priv->username);
|
|
|
3b7e70 |
+
|
|
|
3b7e70 |
gdm_session_worker_set_state (worker, GDM_SESSION_WORKER_STATE_ACCOUNT_DETAILS_SAVED);
|
|
|
890c66 |
- if (!gdm_session_settings_save (worker->priv->user_settings,
|
|
|
890c66 |
- worker->priv->username)) {
|
|
|
890c66 |
- g_warning ("could not save session and language settings");
|
|
|
890c66 |
+ if (worker->priv->user_settings != NULL) {
|
|
|
890c66 |
+ if (!gdm_session_settings_save (worker->priv->user_settings,
|
|
|
890c66 |
+ worker->priv->username)) {
|
|
|
890c66 |
+ g_warning ("could not save session and language settings");
|
|
|
890c66 |
+ }
|
|
|
890c66 |
}
|
|
|
890c66 |
queue_state_change (worker);
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
static void
|
|
|
890c66 |
on_settings_is_loaded_changed (GdmSessionSettings *user_settings,
|
|
|
890c66 |
GParamSpec *pspec,
|
|
|
890c66 |
GdmSessionWorker *worker)
|
|
|
890c66 |
{
|
|
|
890c66 |
if (!gdm_session_settings_is_loaded (worker->priv->user_settings)) {
|
|
|
890c66 |
return;
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
/* These signal handlers should be disconnected after the loading,
|
|
|
890c66 |
* so that gdm_session_settings_set_* APIs don't cause the emitting
|
|
|
890c66 |
* of Saved*NameRead D-Bus signals any more.
|
|
|
890c66 |
*/
|
|
|
890c66 |
g_signal_handlers_disconnect_by_func (worker->priv->user_settings,
|
|
|
890c66 |
G_CALLBACK (on_saved_session_name_read),
|
|
|
890c66 |
worker);
|
|
|
890c66 |
|
|
|
890c66 |
g_signal_handlers_disconnect_by_func (worker->priv->user_settings,
|
|
|
890c66 |
G_CALLBACK (on_saved_language_name_read),
|
|
|
890c66 |
worker);
|
|
|
890c66 |
|
|
|
890c66 |
if (worker->priv->state == GDM_SESSION_WORKER_STATE_NONE) {
|
|
|
890c66 |
g_debug ("GdmSessionWorker: queuing setup for user: %s %s",
|
|
|
890c66 |
worker->priv->username, worker->priv->display_device);
|
|
|
890c66 |
queue_state_change (worker);
|
|
|
890c66 |
} else if (worker->priv->state == GDM_SESSION_WORKER_STATE_ACCREDITED) {
|
|
|
890c66 |
save_account_details_now (worker);
|
|
|
890c66 |
} else {
|
|
|
890c66 |
return;
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
g_signal_handlers_disconnect_by_func (G_OBJECT (worker->priv->user_settings),
|
|
|
890c66 |
G_CALLBACK (on_settings_is_loaded_changed),
|
|
|
890c66 |
worker);
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
static void
|
|
|
890c66 |
do_save_account_details_when_ready (GdmSessionWorker *worker)
|
|
|
890c66 |
{
|
|
|
890c66 |
g_assert (worker->priv->state == GDM_SESSION_WORKER_STATE_ACCREDITED);
|
|
|
890c66 |
|
|
|
890c66 |
- if (!gdm_session_settings_is_loaded (worker->priv->user_settings)) {
|
|
|
890c66 |
+ if (worker->priv->user_settings != NULL && !gdm_session_settings_is_loaded (worker->priv->user_settings)) {
|
|
|
890c66 |
g_signal_connect (G_OBJECT (worker->priv->user_settings),
|
|
|
890c66 |
"notify::is-loaded",
|
|
|
890c66 |
G_CALLBACK (on_settings_is_loaded_changed),
|
|
|
890c66 |
worker);
|
|
|
890c66 |
g_debug ("GdmSessionWorker: user %s, not fully loaded yet, will save account details later",
|
|
|
890c66 |
worker->priv->username);
|
|
|
890c66 |
gdm_session_settings_load (worker->priv->user_settings,
|
|
|
890c66 |
worker->priv->username);
|
|
|
890c66 |
return;
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
save_account_details_now (worker);
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
static void
|
|
|
890c66 |
do_open_session (GdmSessionWorker *worker)
|
|
|
890c66 |
{
|
|
|
890c66 |
GError *error;
|
|
|
890c66 |
gboolean res;
|
|
|
890c66 |
|
|
|
890c66 |
error = NULL;
|
|
|
890c66 |
res = gdm_session_worker_open_session (worker, &error);
|
|
|
890c66 |
|
|
|
890c66 |
if (res) {
|
|
|
890c66 |
char *session_id = worker->priv->session_id;
|
|
|
890c66 |
if (session_id == NULL) {
|
|
|
890c66 |
session_id = "";
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
gdm_dbus_worker_complete_open (GDM_DBUS_WORKER (worker), worker->priv->pending_invocation, session_id);
|
|
|
6b1540 |
@@ -3103,155 +3113,161 @@ gdm_session_worker_handle_initialize (GdmDBusWorker *object,
|
|
|
890c66 |
if (g_strcmp0 (key, "service") == 0) {
|
|
|
890c66 |
worker->priv->service = g_variant_dup_string (value, NULL);
|
|
|
890c66 |
} else if (g_strcmp0 (key, "extensions") == 0) {
|
|
|
890c66 |
worker->priv->extensions = filter_extensions (g_variant_get_strv (value, NULL));
|
|
|
890c66 |
} else if (g_strcmp0 (key, "username") == 0) {
|
|
|
890c66 |
worker->priv->username = g_variant_dup_string (value, NULL);
|
|
|
890c66 |
} else if (g_strcmp0 (key, "is-program-session") == 0) {
|
|
|
890c66 |
worker->priv->is_program_session = g_variant_get_boolean (value);
|
|
|
890c66 |
} else if (g_strcmp0 (key, "log-file") == 0) {
|
|
|
890c66 |
worker->priv->log_file = g_variant_dup_string (value, NULL);
|
|
|
890c66 |
} else if (g_strcmp0 (key, "x11-display-name") == 0) {
|
|
|
890c66 |
worker->priv->x11_display_name = g_variant_dup_string (value, NULL);
|
|
|
890c66 |
} else if (g_strcmp0 (key, "x11-authority-file") == 0) {
|
|
|
890c66 |
worker->priv->x11_authority_file = g_variant_dup_string (value, NULL);
|
|
|
890c66 |
} else if (g_strcmp0 (key, "console") == 0) {
|
|
|
890c66 |
worker->priv->display_device = g_variant_dup_string (value, NULL);
|
|
|
890c66 |
} else if (g_strcmp0 (key, "seat-id") == 0) {
|
|
|
890c66 |
worker->priv->display_seat_id = g_variant_dup_string (value, NULL);
|
|
|
890c66 |
} else if (g_strcmp0 (key, "hostname") == 0) {
|
|
|
890c66 |
worker->priv->hostname = g_variant_dup_string (value, NULL);
|
|
|
890c66 |
} else if (g_strcmp0 (key, "display-is-local") == 0) {
|
|
|
890c66 |
worker->priv->display_is_local = g_variant_get_boolean (value);
|
|
|
890c66 |
} else if (g_strcmp0 (key, "display-is-initial") == 0) {
|
|
|
890c66 |
worker->priv->display_is_initial = g_variant_get_boolean (value);
|
|
|
890c66 |
}
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
worker->priv->pending_invocation = invocation;
|
|
|
890c66 |
|
|
|
890c66 |
if (!worker->priv->is_program_session) {
|
|
|
890c66 |
+ worker->priv->user_settings = gdm_session_settings_new ();
|
|
|
890c66 |
+
|
|
|
890c66 |
g_signal_connect_swapped (worker->priv->user_settings,
|
|
|
890c66 |
"notify::language-name",
|
|
|
890c66 |
G_CALLBACK (on_saved_language_name_read),
|
|
|
890c66 |
worker);
|
|
|
890c66 |
|
|
|
890c66 |
g_signal_connect_swapped (worker->priv->user_settings,
|
|
|
890c66 |
"notify::session-name",
|
|
|
890c66 |
G_CALLBACK (on_saved_session_name_read),
|
|
|
890c66 |
worker);
|
|
|
890c66 |
|
|
|
890c66 |
if (worker->priv->username) {
|
|
|
890c66 |
wait_for_settings = !gdm_session_settings_load (worker->priv->user_settings,
|
|
|
890c66 |
worker->priv->username);
|
|
|
890c66 |
}
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
if (wait_for_settings) {
|
|
|
890c66 |
/* Load settings from accounts daemon before continuing
|
|
|
890c66 |
*/
|
|
|
890c66 |
g_signal_connect (G_OBJECT (worker->priv->user_settings),
|
|
|
890c66 |
"notify::is-loaded",
|
|
|
890c66 |
G_CALLBACK (on_settings_is_loaded_changed),
|
|
|
890c66 |
worker);
|
|
|
890c66 |
} else {
|
|
|
890c66 |
queue_state_change (worker);
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
return TRUE;
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
static gboolean
|
|
|
890c66 |
gdm_session_worker_handle_setup (GdmDBusWorker *object,
|
|
|
890c66 |
GDBusMethodInvocation *invocation,
|
|
|
890c66 |
const char *service,
|
|
|
890c66 |
const char *x11_display_name,
|
|
|
890c66 |
const char *x11_authority_file,
|
|
|
890c66 |
const char *console,
|
|
|
890c66 |
const char *seat_id,
|
|
|
890c66 |
const char *hostname,
|
|
|
890c66 |
gboolean display_is_local,
|
|
|
890c66 |
gboolean display_is_initial)
|
|
|
890c66 |
{
|
|
|
890c66 |
GdmSessionWorker *worker = GDM_SESSION_WORKER (object);
|
|
|
890c66 |
validate_and_queue_state_change (worker, invocation, GDM_SESSION_WORKER_STATE_SETUP_COMPLETE);
|
|
|
890c66 |
|
|
|
890c66 |
worker->priv->service = g_strdup (service);
|
|
|
890c66 |
worker->priv->x11_display_name = g_strdup (x11_display_name);
|
|
|
890c66 |
worker->priv->x11_authority_file = g_strdup (x11_authority_file);
|
|
|
890c66 |
worker->priv->display_device = g_strdup (console);
|
|
|
890c66 |
worker->priv->display_seat_id = g_strdup (seat_id);
|
|
|
890c66 |
worker->priv->hostname = g_strdup (hostname);
|
|
|
890c66 |
worker->priv->display_is_local = display_is_local;
|
|
|
890c66 |
worker->priv->display_is_initial = display_is_initial;
|
|
|
890c66 |
worker->priv->username = NULL;
|
|
|
890c66 |
|
|
|
890c66 |
+ worker->priv->user_settings = gdm_session_settings_new ();
|
|
|
890c66 |
+
|
|
|
890c66 |
g_signal_connect_swapped (worker->priv->user_settings,
|
|
|
890c66 |
"notify::language-name",
|
|
|
890c66 |
G_CALLBACK (on_saved_language_name_read),
|
|
|
890c66 |
worker);
|
|
|
890c66 |
|
|
|
890c66 |
g_signal_connect_swapped (worker->priv->user_settings,
|
|
|
890c66 |
"notify::session-name",
|
|
|
890c66 |
G_CALLBACK (on_saved_session_name_read),
|
|
|
890c66 |
worker);
|
|
|
890c66 |
return TRUE;
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
static gboolean
|
|
|
890c66 |
gdm_session_worker_handle_setup_for_user (GdmDBusWorker *object,
|
|
|
890c66 |
GDBusMethodInvocation *invocation,
|
|
|
890c66 |
const char *service,
|
|
|
890c66 |
const char *username,
|
|
|
890c66 |
const char *x11_display_name,
|
|
|
890c66 |
const char *x11_authority_file,
|
|
|
890c66 |
const char *console,
|
|
|
890c66 |
const char *seat_id,
|
|
|
890c66 |
const char *hostname,
|
|
|
890c66 |
gboolean display_is_local,
|
|
|
890c66 |
gboolean display_is_initial)
|
|
|
890c66 |
{
|
|
|
890c66 |
GdmSessionWorker *worker = GDM_SESSION_WORKER (object);
|
|
|
890c66 |
|
|
|
890c66 |
if (!validate_state_change (worker, invocation, GDM_SESSION_WORKER_STATE_SETUP_COMPLETE))
|
|
|
890c66 |
return TRUE;
|
|
|
890c66 |
|
|
|
890c66 |
worker->priv->service = g_strdup (service);
|
|
|
890c66 |
worker->priv->x11_display_name = g_strdup (x11_display_name);
|
|
|
890c66 |
worker->priv->x11_authority_file = g_strdup (x11_authority_file);
|
|
|
890c66 |
worker->priv->display_device = g_strdup (console);
|
|
|
890c66 |
worker->priv->display_seat_id = g_strdup (seat_id);
|
|
|
890c66 |
worker->priv->hostname = g_strdup (hostname);
|
|
|
890c66 |
worker->priv->display_is_local = display_is_local;
|
|
|
890c66 |
worker->priv->display_is_initial = display_is_initial;
|
|
|
890c66 |
worker->priv->username = g_strdup (username);
|
|
|
890c66 |
|
|
|
890c66 |
+ worker->priv->user_settings = gdm_session_settings_new ();
|
|
|
890c66 |
+
|
|
|
890c66 |
g_signal_connect_swapped (worker->priv->user_settings,
|
|
|
890c66 |
"notify::language-name",
|
|
|
890c66 |
G_CALLBACK (on_saved_language_name_read),
|
|
|
890c66 |
worker);
|
|
|
890c66 |
|
|
|
890c66 |
g_signal_connect_swapped (worker->priv->user_settings,
|
|
|
890c66 |
"notify::session-name",
|
|
|
890c66 |
G_CALLBACK (on_saved_session_name_read),
|
|
|
890c66 |
worker);
|
|
|
890c66 |
|
|
|
890c66 |
/* Load settings from accounts daemon before continuing
|
|
|
890c66 |
*/
|
|
|
890c66 |
worker->priv->pending_invocation = invocation;
|
|
|
890c66 |
if (gdm_session_settings_load (worker->priv->user_settings, username)) {
|
|
|
890c66 |
queue_state_change (worker);
|
|
|
890c66 |
} else {
|
|
|
890c66 |
g_signal_connect (G_OBJECT (worker->priv->user_settings),
|
|
|
890c66 |
"notify::is-loaded",
|
|
|
890c66 |
G_CALLBACK (on_settings_is_loaded_changed),
|
|
|
890c66 |
worker);
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
return TRUE;
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
static gboolean
|
|
|
890c66 |
gdm_session_worker_handle_setup_for_program (GdmDBusWorker *object,
|
|
|
890c66 |
GDBusMethodInvocation *invocation,
|
|
|
890c66 |
const char *service,
|
|
|
890c66 |
const char *username,
|
|
|
6b1540 |
@@ -3589,61 +3605,60 @@ static void
|
|
|
890c66 |
reauthentication_request_free (ReauthenticationRequest *request)
|
|
|
890c66 |
{
|
|
|
890c66 |
|
|
|
890c66 |
g_signal_handlers_disconnect_by_func (request->session,
|
|
|
890c66 |
G_CALLBACK (on_reauthentication_client_connected),
|
|
|
890c66 |
request);
|
|
|
890c66 |
g_signal_handlers_disconnect_by_func (request->session,
|
|
|
890c66 |
G_CALLBACK (on_reauthentication_client_disconnected),
|
|
|
890c66 |
request);
|
|
|
890c66 |
g_signal_handlers_disconnect_by_func (request->session,
|
|
|
890c66 |
G_CALLBACK (on_reauthentication_cancelled),
|
|
|
890c66 |
request);
|
|
|
890c66 |
g_signal_handlers_disconnect_by_func (request->session,
|
|
|
890c66 |
G_CALLBACK (on_reauthentication_conversation_started),
|
|
|
890c66 |
request);
|
|
|
890c66 |
g_signal_handlers_disconnect_by_func (request->session,
|
|
|
890c66 |
G_CALLBACK (on_reauthentication_conversation_stopped),
|
|
|
890c66 |
request);
|
|
|
890c66 |
g_signal_handlers_disconnect_by_func (request->session,
|
|
|
890c66 |
G_CALLBACK (on_reauthentication_verification_complete),
|
|
|
890c66 |
request);
|
|
|
890c66 |
g_clear_object (&request->session);
|
|
|
890c66 |
g_slice_free (ReauthenticationRequest, request);
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
static void
|
|
|
890c66 |
gdm_session_worker_init (GdmSessionWorker *worker)
|
|
|
890c66 |
{
|
|
|
890c66 |
worker->priv = GDM_SESSION_WORKER_GET_PRIVATE (worker);
|
|
|
890c66 |
|
|
|
890c66 |
- worker->priv->user_settings = gdm_session_settings_new ();
|
|
|
890c66 |
worker->priv->reauthentication_requests = g_hash_table_new_full (NULL,
|
|
|
890c66 |
NULL,
|
|
|
890c66 |
NULL,
|
|
|
890c66 |
(GDestroyNotify)
|
|
|
890c66 |
reauthentication_request_free);
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
static void
|
|
|
890c66 |
gdm_session_worker_unwatch_child (GdmSessionWorker *worker)
|
|
|
890c66 |
{
|
|
|
890c66 |
if (worker->priv->child_watch_id == 0)
|
|
|
890c66 |
return;
|
|
|
890c66 |
|
|
|
890c66 |
g_source_remove (worker->priv->child_watch_id);
|
|
|
890c66 |
worker->priv->child_watch_id = 0;
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
|
|
|
890c66 |
static void
|
|
|
890c66 |
gdm_session_worker_finalize (GObject *object)
|
|
|
890c66 |
{
|
|
|
890c66 |
GdmSessionWorker *worker;
|
|
|
890c66 |
|
|
|
890c66 |
g_return_if_fail (object != NULL);
|
|
|
890c66 |
g_return_if_fail (GDM_IS_SESSION_WORKER (object));
|
|
|
890c66 |
|
|
|
890c66 |
worker = GDM_SESSION_WORKER (object);
|
|
|
890c66 |
|
|
|
890c66 |
g_return_if_fail (worker->priv != NULL);
|
|
|
890c66 |
|
|
|
890c66 |
--
|
|
|
6b1540 |
2.33.1
|
|
|
890c66 |
|