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