|
|
6b1540 |
From de95917e0e9d142703a86f94961ef9fd4151739d Mon Sep 17 00:00:00 2001
|
|
|
890c66 |
From: Ray Strode <rstrode@redhat.com>
|
|
|
890c66 |
Date: Mon, 20 Aug 2018 14:30:59 -0400
|
|
|
890c66 |
Subject: [PATCH 3/4] daemon: save os-release in accountsservice
|
|
|
890c66 |
|
|
|
890c66 |
It can be useful to know what OS a user was running
|
|
|
890c66 |
when they logged in (to detect upgrades).
|
|
|
890c66 |
|
|
|
890c66 |
This commit saves that information in accountsservice.
|
|
|
890c66 |
---
|
|
|
890c66 |
.../com.redhat.AccountsServiceUser.System.xml | 10 ++
|
|
|
3b7e70 |
daemon/gdm-session-settings.c | 98 +++++++++++++++++++
|
|
|
3b7e70 |
daemon/gdm-session.c | 4 +-
|
|
|
3b7e70 |
daemon/meson.build | 8 ++
|
|
|
3b7e70 |
4 files changed, 118 insertions(+), 2 deletions(-)
|
|
|
3b7e70 |
create mode 100644 daemon/com.redhat.AccountsServiceUser.System.xml
|
|
|
890c66 |
|
|
|
3b7e70 |
diff --git a/daemon/com.redhat.AccountsServiceUser.System.xml b/daemon/com.redhat.AccountsServiceUser.System.xml
|
|
|
3b7e70 |
new file mode 100644
|
|
|
6b1540 |
index 00000000..67f5f302
|
|
|
3b7e70 |
--- /dev/null
|
|
|
3b7e70 |
+++ b/daemon/com.redhat.AccountsServiceUser.System.xml
|
|
|
3b7e70 |
@@ -0,0 +1,10 @@
|
|
|
3b7e70 |
+<node>
|
|
|
3b7e70 |
+ <interface name="com.redhat.AccountsServiceUser.System">
|
|
|
890c66 |
+
|
|
|
3b7e70 |
+ <annotation name="org.freedesktop.Accounts.VendorExtension" value="true"/>
|
|
|
3b7e70 |
+
|
|
|
3b7e70 |
+ <property name="id" type="s" access="readwrite"/>
|
|
|
3b7e70 |
+ <property name="version-id" type="s" access="readwrite"/>
|
|
|
3b7e70 |
+
|
|
|
3b7e70 |
+ </interface>
|
|
|
3b7e70 |
+</node>
|
|
|
890c66 |
diff --git a/daemon/gdm-session-settings.c b/daemon/gdm-session-settings.c
|
|
|
6b1540 |
index f2b1addd..a4b7f1a6 100644
|
|
|
890c66 |
--- a/daemon/gdm-session-settings.c
|
|
|
890c66 |
+++ b/daemon/gdm-session-settings.c
|
|
|
890c66 |
@@ -1,70 +1,77 @@
|
|
|
890c66 |
/* gdm-session-settings.c - Loads session and language from ~/.dmrc
|
|
|
890c66 |
*
|
|
|
890c66 |
* Copyright (C) 2008 Red Hat, Inc.
|
|
|
890c66 |
*
|
|
|
890c66 |
* This program is free software; you can redistribute it and/or modify
|
|
|
890c66 |
* it under the terms of the GNU General Public License as published by
|
|
|
890c66 |
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
890c66 |
* any later version.
|
|
|
890c66 |
*
|
|
|
890c66 |
* This program is distributed in the hope that it will be useful,
|
|
|
890c66 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
890c66 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
890c66 |
* GNU General Public License for more details.
|
|
|
890c66 |
*
|
|
|
890c66 |
* You should have received a copy of the GNU General Public License
|
|
|
890c66 |
* along with this program; if not, write to the Free Software
|
|
|
890c66 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
|
890c66 |
* 02110-1301, USA.
|
|
|
890c66 |
*
|
|
|
890c66 |
* Written by: Ray Strode <rstrode@redhat.com>
|
|
|
890c66 |
*/
|
|
|
890c66 |
#include "config.h"
|
|
|
890c66 |
#include "gdm-session-settings.h"
|
|
|
890c66 |
+#include "gdm-common.h"
|
|
|
890c66 |
+
|
|
|
890c66 |
+#include "com.redhat.AccountsServiceUser.System.h"
|
|
|
890c66 |
|
|
|
890c66 |
#include <errno.h>
|
|
|
890c66 |
#include <pwd.h>
|
|
|
890c66 |
#include <string.h>
|
|
|
890c66 |
#include <sys/types.h>
|
|
|
890c66 |
#include <unistd.h>
|
|
|
890c66 |
|
|
|
890c66 |
#include <glib.h>
|
|
|
890c66 |
#include <glib-object.h>
|
|
|
890c66 |
#include <glib/gi18n.h>
|
|
|
890c66 |
|
|
|
890c66 |
#include <act/act-user-manager.h>
|
|
|
890c66 |
|
|
|
890c66 |
struct _GdmSessionSettingsPrivate
|
|
|
890c66 |
{
|
|
|
890c66 |
ActUserManager *user_manager;
|
|
|
890c66 |
ActUser *user;
|
|
|
890c66 |
+
|
|
|
890c66 |
+ /* used for retrieving the last OS user logged in with */
|
|
|
890c66 |
+ GdmAccountsServiceUserSystem *user_system_proxy;
|
|
|
890c66 |
+
|
|
|
890c66 |
char *session_name;
|
|
|
890c66 |
char *session_type;
|
|
|
890c66 |
char *language_name;
|
|
|
890c66 |
};
|
|
|
890c66 |
|
|
|
890c66 |
static void gdm_session_settings_finalize (GObject *object);
|
|
|
890c66 |
static void gdm_session_settings_class_install_properties (GdmSessionSettingsClass *
|
|
|
890c66 |
settings_class);
|
|
|
890c66 |
|
|
|
890c66 |
static void gdm_session_settings_set_property (GObject *object,
|
|
|
890c66 |
guint prop_id,
|
|
|
890c66 |
const GValue *value,
|
|
|
890c66 |
GParamSpec *pspec);
|
|
|
890c66 |
static void gdm_session_settings_get_property (GObject *object,
|
|
|
890c66 |
guint prop_id,
|
|
|
890c66 |
GValue *value,
|
|
|
890c66 |
GParamSpec *pspec);
|
|
|
890c66 |
|
|
|
890c66 |
enum {
|
|
|
890c66 |
PROP_0 = 0,
|
|
|
890c66 |
PROP_SESSION_NAME,
|
|
|
890c66 |
PROP_SESSION_TYPE,
|
|
|
890c66 |
PROP_LANGUAGE_NAME,
|
|
|
890c66 |
PROP_IS_LOADED
|
|
|
890c66 |
};
|
|
|
890c66 |
|
|
|
3b7e70 |
G_DEFINE_TYPE_WITH_PRIVATE (GdmSessionSettings,
|
|
|
3b7e70 |
gdm_session_settings,
|
|
|
3b7e70 |
G_TYPE_OBJECT)
|
|
|
890c66 |
|
|
|
890c66 |
@@ -107,60 +114,62 @@ gdm_session_settings_class_install_properties (GdmSessionSettingsClass *settings
|
|
|
890c66 |
g_object_class_install_property (object_class, PROP_LANGUAGE_NAME, param_spec);
|
|
|
890c66 |
|
|
|
890c66 |
param_spec = g_param_spec_boolean ("is-loaded", NULL, NULL,
|
|
|
3b7e70 |
FALSE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
|
|
890c66 |
g_object_class_install_property (object_class, PROP_IS_LOADED, param_spec);
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
static void
|
|
|
890c66 |
gdm_session_settings_init (GdmSessionSettings *settings)
|
|
|
890c66 |
{
|
|
|
890c66 |
settings->priv = G_TYPE_INSTANCE_GET_PRIVATE (settings,
|
|
|
890c66 |
GDM_TYPE_SESSION_SETTINGS,
|
|
|
890c66 |
GdmSessionSettingsPrivate);
|
|
|
890c66 |
|
|
|
890c66 |
settings->priv->user_manager = act_user_manager_get_default ();
|
|
|
890c66 |
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
static void
|
|
|
890c66 |
gdm_session_settings_finalize (GObject *object)
|
|
|
890c66 |
{
|
|
|
890c66 |
GdmSessionSettings *settings;
|
|
|
890c66 |
GObjectClass *parent_class;
|
|
|
890c66 |
|
|
|
890c66 |
settings = GDM_SESSION_SETTINGS (object);
|
|
|
890c66 |
|
|
|
890c66 |
if (settings->priv->user != NULL) {
|
|
|
890c66 |
g_object_unref (settings->priv->user);
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
+ g_clear_object (&settings->priv->user_system_proxy);
|
|
|
890c66 |
+
|
|
|
890c66 |
g_free (settings->priv->session_name);
|
|
|
890c66 |
g_free (settings->priv->language_name);
|
|
|
890c66 |
|
|
|
890c66 |
parent_class = G_OBJECT_CLASS (gdm_session_settings_parent_class);
|
|
|
890c66 |
|
|
|
890c66 |
if (parent_class->finalize != NULL) {
|
|
|
890c66 |
parent_class->finalize (object);
|
|
|
890c66 |
}
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
void
|
|
|
890c66 |
gdm_session_settings_set_language_name (GdmSessionSettings *settings,
|
|
|
890c66 |
const char *language_name)
|
|
|
890c66 |
{
|
|
|
890c66 |
g_return_if_fail (GDM_IS_SESSION_SETTINGS (settings));
|
|
|
890c66 |
|
|
|
890c66 |
if (settings->priv->language_name == NULL ||
|
|
|
890c66 |
strcmp (settings->priv->language_name, language_name) != 0) {
|
|
|
890c66 |
settings->priv->language_name = g_strdup (language_name);
|
|
|
890c66 |
g_object_notify (G_OBJECT (settings), "language-name");
|
|
|
890c66 |
}
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
void
|
|
|
890c66 |
gdm_session_settings_set_session_name (GdmSessionSettings *settings,
|
|
|
890c66 |
const char *session_name)
|
|
|
890c66 |
{
|
|
|
890c66 |
g_return_if_fail (GDM_IS_SESSION_SETTINGS (settings));
|
|
|
890c66 |
|
|
|
890c66 |
if (settings->priv->session_name == NULL ||
|
|
|
890c66 |
@@ -261,69 +270,86 @@ gdm_session_settings_get_property (GObject *object,
|
|
|
890c66 |
|
|
|
890c66 |
default:
|
|
|
890c66 |
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
890c66 |
}
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
GdmSessionSettings *
|
|
|
890c66 |
gdm_session_settings_new (void)
|
|
|
890c66 |
{
|
|
|
890c66 |
GdmSessionSettings *settings;
|
|
|
890c66 |
|
|
|
890c66 |
settings = g_object_new (GDM_TYPE_SESSION_SETTINGS,
|
|
|
890c66 |
NULL);
|
|
|
890c66 |
|
|
|
890c66 |
return settings;
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
gboolean
|
|
|
890c66 |
gdm_session_settings_is_loaded (GdmSessionSettings *settings)
|
|
|
890c66 |
{
|
|
|
890c66 |
if (settings->priv->user == NULL) {
|
|
|
890c66 |
return FALSE;
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
return act_user_is_loaded (settings->priv->user);
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
static void
|
|
|
890c66 |
load_settings_from_user (GdmSessionSettings *settings)
|
|
|
890c66 |
{
|
|
|
890c66 |
+ const char *object_path;
|
|
|
890c66 |
const char *session_name;
|
|
|
890c66 |
const char *session_type;
|
|
|
890c66 |
const char *language_name;
|
|
|
890c66 |
|
|
|
890c66 |
if (!act_user_is_loaded (settings->priv->user)) {
|
|
|
890c66 |
g_warning ("GdmSessionSettings: trying to load user settings from unloaded user");
|
|
|
890c66 |
return;
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
+ object_path = act_user_get_object_path (settings->priv->user);
|
|
|
890c66 |
+
|
|
|
890c66 |
+ if (object_path != NULL) {
|
|
|
890c66 |
+ g_autoptr (GError) error = NULL;
|
|
|
890c66 |
+ settings->priv->user_system_proxy = gdm_accounts_service_user_system_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
|
|
|
890c66 |
+ G_DBUS_PROXY_FLAGS_NONE,
|
|
|
890c66 |
+ "org.freedesktop.Accounts",
|
|
|
890c66 |
+ object_path,
|
|
|
890c66 |
+ NULL,
|
|
|
890c66 |
+ &error);
|
|
|
890c66 |
+ if (error != NULL) {
|
|
|
890c66 |
+ g_debug ("GdmSessionSettings: couldn't retrieve user system proxy from accountsservice: %s",
|
|
|
890c66 |
+ error->message);
|
|
|
890c66 |
+ }
|
|
|
890c66 |
+ }
|
|
|
890c66 |
+
|
|
|
6b1540 |
|
|
|
6b1540 |
|
|
|
6b1540 |
|
|
|
890c66 |
|
|
|
890c66 |
session_type = act_user_get_session_type (settings->priv->user);
|
|
|
890c66 |
session_name = act_user_get_session (settings->priv->user);
|
|
|
890c66 |
|
|
|
890c66 |
g_debug ("GdmSessionSettings: saved session is %s (type %s)", session_name, session_type);
|
|
|
890c66 |
|
|
|
890c66 |
if (session_type != NULL && session_type[0] != '\0') {
|
|
|
890c66 |
gdm_session_settings_set_session_type (settings, session_type);
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
if (session_name != NULL && session_name[0] != '\0') {
|
|
|
890c66 |
gdm_session_settings_set_session_name (settings, session_name);
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
language_name = act_user_get_language (settings->priv->user);
|
|
|
890c66 |
|
|
|
890c66 |
g_debug ("GdmSessionSettings: saved language is %s", language_name);
|
|
|
890c66 |
if (language_name != NULL && language_name[0] != '\0') {
|
|
|
890c66 |
gdm_session_settings_set_language_name (settings, language_name);
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
out:
|
|
|
890c66 |
g_object_notify (G_OBJECT (settings), "is-loaded");
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
static void
|
|
|
890c66 |
on_user_is_loaded_changed (ActUser *user,
|
|
|
890c66 |
@@ -349,64 +375,136 @@ gdm_session_settings_load (GdmSessionSettings *settings,
|
|
|
890c66 |
g_return_val_if_fail (!gdm_session_settings_is_loaded (settings), FALSE);
|
|
|
890c66 |
|
|
|
890c66 |
if (settings->priv->user != NULL) {
|
|
|
890c66 |
old_user = settings->priv->user;
|
|
|
890c66 |
|
|
|
890c66 |
g_signal_handlers_disconnect_by_func (G_OBJECT (settings->priv->user),
|
|
|
890c66 |
G_CALLBACK (on_user_is_loaded_changed),
|
|
|
890c66 |
settings);
|
|
|
890c66 |
} else {
|
|
|
890c66 |
old_user = NULL;
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
settings->priv->user = act_user_manager_get_user (settings->priv->user_manager,
|
|
|
890c66 |
username);
|
|
|
890c66 |
|
|
|
890c66 |
g_clear_object (&old_user);
|
|
|
890c66 |
|
|
|
890c66 |
if (!act_user_is_loaded (settings->priv->user)) {
|
|
|
890c66 |
g_signal_connect (settings->priv->user,
|
|
|
890c66 |
"notify::is-loaded",
|
|
|
890c66 |
G_CALLBACK (on_user_is_loaded_changed),
|
|
|
890c66 |
settings);
|
|
|
890c66 |
return FALSE;
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
load_settings_from_user (settings);
|
|
|
890c66 |
|
|
|
890c66 |
return TRUE;
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
+static void
|
|
|
890c66 |
+save_os_release (GdmSessionSettings *settings,
|
|
|
890c66 |
+ ActUser *user)
|
|
|
890c66 |
+{
|
|
|
890c66 |
+ g_autoptr(GFile) file = NULL;
|
|
|
890c66 |
+ g_autoptr(GError) error = NULL;
|
|
|
890c66 |
+ g_autofree char *contents = NULL;
|
|
|
890c66 |
+ g_auto(GStrv) lines = NULL;
|
|
|
890c66 |
+ size_t i;
|
|
|
890c66 |
+
|
|
|
890c66 |
+ if (settings->priv->user_system_proxy == NULL) {
|
|
|
890c66 |
+ g_debug ("GdmSessionSettings: not saving OS version to user account because accountsservice doesn't support it");
|
|
|
890c66 |
+ return;
|
|
|
890c66 |
+ }
|
|
|
890c66 |
+
|
|
|
890c66 |
+ file = g_file_new_for_path ("/etc/os-release");
|
|
|
890c66 |
+
|
|
|
890c66 |
+ if (!g_file_load_contents (file, NULL, &contents, NULL, NULL, &error)) {
|
|
|
890c66 |
+ g_debug ("GdmSessionSettings: couldn't load /etc/os-release: %s", error->message);
|
|
|
890c66 |
+ return;
|
|
|
890c66 |
+ }
|
|
|
890c66 |
+
|
|
|
890c66 |
+ lines = g_strsplit (contents, "\n", -1);
|
|
|
890c66 |
+ for (i = 0; lines[i] != NULL; i++) {
|
|
|
890c66 |
+ char *p, *name, *name_end, *value, *value_end;
|
|
|
890c66 |
+
|
|
|
890c66 |
+ p = lines[i];
|
|
|
890c66 |
+
|
|
|
890c66 |
+ while (g_ascii_isspace (*p))
|
|
|
890c66 |
+ p++;
|
|
|
890c66 |
+
|
|
|
890c66 |
+ if (*p == '#' || *p == '\0')
|
|
|
890c66 |
+ continue;
|
|
|
890c66 |
+ name = p;
|
|
|
890c66 |
+ while (gdm_shell_var_is_valid_char (*p, p == name))
|
|
|
890c66 |
+ p++;
|
|
|
890c66 |
+ name_end = p;
|
|
|
890c66 |
+ while (g_ascii_isspace (*p))
|
|
|
890c66 |
+ p++;
|
|
|
890c66 |
+ if (name == name_end || *p != '=') {
|
|
|
890c66 |
+ continue;
|
|
|
890c66 |
+ }
|
|
|
890c66 |
+ *name_end = '\0';
|
|
|
890c66 |
+
|
|
|
890c66 |
+ p++;
|
|
|
890c66 |
+
|
|
|
890c66 |
+ while (g_ascii_isspace (*p))
|
|
|
890c66 |
+ p++;
|
|
|
890c66 |
+
|
|
|
890c66 |
+ value = p;
|
|
|
890c66 |
+ value_end = value + strlen(value) - 1;
|
|
|
890c66 |
+
|
|
|
890c66 |
+ if (value != value_end && *value == '"' && *value_end == '"') {
|
|
|
890c66 |
+ value++;
|
|
|
890c66 |
+ *value_end = '\0';
|
|
|
890c66 |
+ }
|
|
|
890c66 |
+
|
|
|
890c66 |
+ if (strcmp (name, "ID") == 0) {
|
|
|
890c66 |
+ gdm_accounts_service_user_system_set_id (settings->priv->user_system_proxy,
|
|
|
890c66 |
+ value);
|
|
|
890c66 |
+ g_debug ("GdmSessionSettings: setting system OS for user to '%s'", value);
|
|
|
890c66 |
+ } else if (strcmp (name, "VERSION_ID") == 0) {
|
|
|
890c66 |
+ gdm_accounts_service_user_system_set_version_id (settings->priv->user_system_proxy,
|
|
|
890c66 |
+ value);
|
|
|
890c66 |
+ g_debug ("GdmSessionSettings: setting system OS version for user to '%s'", value);
|
|
|
890c66 |
+ }
|
|
|
890c66 |
+ }
|
|
|
890c66 |
+}
|
|
|
890c66 |
+
|
|
|
890c66 |
gboolean
|
|
|
890c66 |
gdm_session_settings_save (GdmSessionSettings *settings,
|
|
|
890c66 |
const char *username)
|
|
|
890c66 |
{
|
|
|
890c66 |
ActUser *user;
|
|
|
890c66 |
|
|
|
890c66 |
g_return_val_if_fail (GDM_IS_SESSION_SETTINGS (settings), FALSE);
|
|
|
890c66 |
g_return_val_if_fail (username != NULL, FALSE);
|
|
|
890c66 |
g_return_val_if_fail (gdm_session_settings_is_loaded (settings), FALSE);
|
|
|
890c66 |
|
|
|
890c66 |
user = act_user_manager_get_user (settings->priv->user_manager,
|
|
|
890c66 |
username);
|
|
|
890c66 |
|
|
|
890c66 |
|
|
|
890c66 |
if (!act_user_is_loaded (user)) {
|
|
|
890c66 |
g_object_unref (user);
|
|
|
890c66 |
return FALSE;
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
if (settings->priv->session_name != NULL) {
|
|
|
890c66 |
act_user_set_session (user, settings->priv->session_name);
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
if (settings->priv->session_type != NULL) {
|
|
|
890c66 |
act_user_set_session_type (user, settings->priv->session_type);
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
if (settings->priv->language_name != NULL) {
|
|
|
890c66 |
act_user_set_language (user, settings->priv->language_name);
|
|
|
890c66 |
}
|
|
|
890c66 |
+
|
|
|
890c66 |
+ save_os_release (settings, user);
|
|
|
890c66 |
+
|
|
|
890c66 |
g_object_unref (user);
|
|
|
890c66 |
|
|
|
890c66 |
return TRUE;
|
|
|
890c66 |
}
|
|
|
3b7e70 |
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
|
|
|
6b1540 |
index f4d0bef9..d1e2c301 100644
|
|
|
3b7e70 |
--- a/daemon/gdm-session.c
|
|
|
3b7e70 |
+++ b/daemon/gdm-session.c
|
|
|
3b7e70 |
@@ -351,72 +351,72 @@ supports_session_type (GdmSession *self,
|
|
|
3b7e70 |
if (session_type == NULL)
|
|
|
3b7e70 |
return TRUE;
|
|
|
3b7e70 |
|
|
|
3b7e70 |
return g_strv_contains ((const char * const *) self->supported_session_types,
|
|
|
3b7e70 |
session_type);
|
|
|
3b7e70 |
}
|
|
|
3b7e70 |
|
|
|
3b7e70 |
static char **
|
|
|
3b7e70 |
get_system_session_dirs (GdmSession *self,
|
|
|
3b7e70 |
const char *type)
|
|
|
3b7e70 |
{
|
|
|
3b7e70 |
GArray *search_array = NULL;
|
|
|
3b7e70 |
char **search_dirs;
|
|
|
3b7e70 |
int i, j;
|
|
|
3b7e70 |
const gchar * const *system_data_dirs = g_get_system_data_dirs ();
|
|
|
3b7e70 |
|
|
|
3b7e70 |
static const char *x_search_dirs[] = {
|
|
|
3b7e70 |
"/etc/X11/sessions/",
|
|
|
3b7e70 |
DMCONFDIR "/Sessions/",
|
|
|
3b7e70 |
DATADIR "/gdm/BuiltInSessions/",
|
|
|
3b7e70 |
DATADIR "/xsessions/",
|
|
|
3b7e70 |
};
|
|
|
3b7e70 |
|
|
|
3b7e70 |
static const char *wayland_search_dir = DATADIR "/wayland-sessions/";
|
|
|
3b7e70 |
|
|
|
3b7e70 |
search_array = g_array_new (TRUE, TRUE, sizeof (char *));
|
|
|
3b7e70 |
|
|
|
3b7e70 |
for (j = 0; self->supported_session_types[j] != NULL; j++) {
|
|
|
3b7e70 |
const char *supported_type = self->supported_session_types[j];
|
|
|
3b7e70 |
|
|
|
3b7e70 |
- if (g_str_equal (supported_type, "x11") ||
|
|
|
3b7e70 |
+ if (g_str_equal (supported_type, "x11") &&
|
|
|
3b7e70 |
(type == NULL || g_str_equal (type, supported_type))) {
|
|
|
3b7e70 |
for (i = 0; system_data_dirs[i]; i++) {
|
|
|
3b7e70 |
gchar *dir = g_build_filename (system_data_dirs[i], "xsessions", NULL);
|
|
|
3b7e70 |
g_array_append_val (search_array, dir);
|
|
|
3b7e70 |
}
|
|
|
3b7e70 |
|
|
|
3b7e70 |
g_array_append_vals (search_array, x_search_dirs, G_N_ELEMENTS (x_search_dirs));
|
|
|
3b7e70 |
}
|
|
|
3b7e70 |
|
|
|
3b7e70 |
#ifdef ENABLE_WAYLAND_SUPPORT
|
|
|
3b7e70 |
- if (g_str_equal (supported_type, "wayland") ||
|
|
|
3b7e70 |
+ if (g_str_equal (supported_type, "wayland") &&
|
|
|
3b7e70 |
(type == NULL || g_str_equal (type, supported_type))) {
|
|
|
3b7e70 |
for (i = 0; system_data_dirs[i]; i++) {
|
|
|
3b7e70 |
gchar *dir = g_build_filename (system_data_dirs[i], "wayland-sessions", NULL);
|
|
|
3b7e70 |
g_array_append_val (search_array, dir);
|
|
|
3b7e70 |
}
|
|
|
3b7e70 |
|
|
|
3b7e70 |
g_array_append_val (search_array, wayland_search_dir);
|
|
|
3b7e70 |
}
|
|
|
3b7e70 |
#endif
|
|
|
3b7e70 |
}
|
|
|
3b7e70 |
|
|
|
3b7e70 |
search_dirs = g_strdupv ((char **) search_array->data);
|
|
|
3b7e70 |
|
|
|
3b7e70 |
g_array_free (search_array, TRUE);
|
|
|
3b7e70 |
|
|
|
3b7e70 |
return search_dirs;
|
|
|
3b7e70 |
}
|
|
|
3b7e70 |
|
|
|
3b7e70 |
static gboolean
|
|
|
3b7e70 |
is_prog_in_path (const char *prog)
|
|
|
3b7e70 |
{
|
|
|
3b7e70 |
char *f;
|
|
|
3b7e70 |
gboolean ret;
|
|
|
3b7e70 |
|
|
|
3b7e70 |
f = g_find_program_in_path (prog);
|
|
|
3b7e70 |
ret = (f != NULL);
|
|
|
3b7e70 |
g_free (f);
|
|
|
3b7e70 |
return ret;
|
|
|
3b7e70 |
}
|
|
|
3b7e70 |
|
|
|
3b7e70 |
diff --git a/daemon/meson.build b/daemon/meson.build
|
|
|
6b1540 |
index 2e61b644..71c65039 100644
|
|
|
3b7e70 |
--- a/daemon/meson.build
|
|
|
3b7e70 |
+++ b/daemon/meson.build
|
|
|
3b7e70 |
@@ -15,114 +15,122 @@ local_display_dbus_gen = gnome.gdbus_codegen('gdm-local-display-glue',
|
|
|
3b7e70 |
'gdm-local-display.xml',
|
|
|
3b7e70 |
namespace: 'GdmDBus',
|
|
|
3b7e70 |
interface_prefix: 'org.gnome.DisplayManager',
|
|
|
3b7e70 |
autocleanup: 'all',
|
|
|
3b7e70 |
)
|
|
|
3b7e70 |
local_display_factory_dbus_gen = gnome.gdbus_codegen('gdm-local-display-factory-glue',
|
|
|
3b7e70 |
'gdm-local-display-factory.xml',
|
|
|
3b7e70 |
namespace: 'GdmDBus',
|
|
|
3b7e70 |
interface_prefix: 'org.gnome.DisplayManager',
|
|
|
3b7e70 |
autocleanup: 'all',
|
|
|
3b7e70 |
)
|
|
|
3b7e70 |
manager_dbus_gen = gnome.gdbus_codegen('gdm-manager-glue',
|
|
|
3b7e70 |
'gdm-manager.xml',
|
|
|
3b7e70 |
namespace: 'GdmDBus',
|
|
|
3b7e70 |
interface_prefix: 'org.gnome.DisplayManager',
|
|
|
3b7e70 |
autocleanup: 'all',
|
|
|
3b7e70 |
)
|
|
|
3b7e70 |
session_dbus_gen = gnome.gdbus_codegen('gdm-session-glue',
|
|
|
3b7e70 |
'gdm-session.xml',
|
|
|
3b7e70 |
namespace: 'GdmDBus',
|
|
|
3b7e70 |
interface_prefix: 'org.gnome.DisplayManager',
|
|
|
3b7e70 |
autocleanup: 'all',
|
|
|
3b7e70 |
)
|
|
|
3b7e70 |
session_worker_dbus_gen = gnome.gdbus_codegen('gdm-session-worker-glue',
|
|
|
3b7e70 |
'gdm-session-worker.xml',
|
|
|
3b7e70 |
namespace: 'GdmDBus',
|
|
|
3b7e70 |
interface_prefix: 'org.gnome.DisplayManager',
|
|
|
3b7e70 |
autocleanup: 'all',
|
|
|
3b7e70 |
)
|
|
|
3b7e70 |
|
|
|
3b7e70 |
+accountsservice_system_user_dbus_gen = gnome.gdbus_codegen('com.redhat.AccountsServiceUser.System',
|
|
|
3b7e70 |
+ 'com.redhat.AccountsServiceUser.System.xml',
|
|
|
3b7e70 |
+ namespace: 'Gdm',
|
|
|
3b7e70 |
+ interface_prefix: 'com.redhat',
|
|
|
3b7e70 |
+ autocleanup: 'all',
|
|
|
3b7e70 |
+)
|
|
|
890c66 |
+
|
|
|
3b7e70 |
gdm_session_enums = gnome.mkenums('gdm-session-enum-types',
|
|
|
3b7e70 |
h_template: 'gdm-session-enum-types.h.in',
|
|
|
3b7e70 |
c_template: 'gdm-session-enum-types.c.in',
|
|
|
3b7e70 |
sources: 'gdm-session.h',
|
|
|
3b7e70 |
)
|
|
|
3b7e70 |
gdm_session_worker_enums = gnome.mkenums('gdm-session-worker-enum-types',
|
|
|
3b7e70 |
h_template: 'gdm-session-worker-enum-types.h.in',
|
|
|
3b7e70 |
c_template: 'gdm-session-worker-enum-types.c.in',
|
|
|
3b7e70 |
sources: 'gdm-session-worker.h',
|
|
|
3b7e70 |
)
|
|
|
3b7e70 |
|
|
|
3b7e70 |
# Daemons deps
|
|
|
3b7e70 |
gdm_daemon_deps = [
|
|
|
3b7e70 |
libgdmcommon_dep,
|
|
|
3b7e70 |
accountsservice_dep,
|
|
|
3b7e70 |
gobject_dep,
|
|
|
3b7e70 |
gio_dep,
|
|
|
3b7e70 |
gio_unix_dep,
|
|
|
3b7e70 |
libpam_dep,
|
|
|
3b7e70 |
x_deps,
|
|
|
3b7e70 |
xcb_dep,
|
|
|
3b7e70 |
]
|
|
|
3b7e70 |
|
|
|
3b7e70 |
if xdmcp_dep.found() and get_option('tcp-wrappers')
|
|
|
3b7e70 |
gdm_daemon_deps += libwrap_dep
|
|
|
3b7e70 |
endif
|
|
|
3b7e70 |
|
|
|
3b7e70 |
# test-session-client
|
|
|
3b7e70 |
test_session_client_src = [
|
|
|
3b7e70 |
'test-session-client.c',
|
|
|
3b7e70 |
session_dbus_gen,
|
|
|
3b7e70 |
manager_dbus_gen,
|
|
|
3b7e70 |
]
|
|
|
3b7e70 |
|
|
|
3b7e70 |
test_session_client = executable('test-session-client',
|
|
|
3b7e70 |
test_session_client_src,
|
|
|
3b7e70 |
dependencies: gdm_daemon_deps,
|
|
|
3b7e70 |
include_directories: config_h_dir,
|
|
|
3b7e70 |
)
|
|
|
3b7e70 |
|
|
|
3b7e70 |
# Session worker
|
|
|
3b7e70 |
gdm_session_worker_src = [
|
|
|
3b7e70 |
'session-worker-main.c',
|
|
|
3b7e70 |
'gdm-session.c',
|
|
|
3b7e70 |
'gdm-session-settings.c',
|
|
|
3b7e70 |
'gdm-session-auditor.c',
|
|
|
3b7e70 |
'gdm-session-record.c',
|
|
|
3b7e70 |
'gdm-session-worker.c',
|
|
|
3b7e70 |
'gdm-session-worker-job.c',
|
|
|
3b7e70 |
'gdm-session-worker-common.c',
|
|
|
3b7e70 |
'gdm-dbus-util.c',
|
|
|
3b7e70 |
dbus_gen,
|
|
|
3b7e70 |
session_dbus_gen,
|
|
|
3b7e70 |
session_worker_dbus_gen,
|
|
|
3b7e70 |
+ accountsservice_system_user_dbus_gen,
|
|
|
3b7e70 |
gdm_session_enums,
|
|
|
3b7e70 |
gdm_session_worker_enums,
|
|
|
3b7e70 |
]
|
|
|
3b7e70 |
|
|
|
3b7e70 |
gdm_session_worker_deps = [
|
|
|
3b7e70 |
gdm_daemon_deps,
|
|
|
3b7e70 |
]
|
|
|
3b7e70 |
|
|
|
3b7e70 |
gdm_session_worker_includes = [
|
|
|
3b7e70 |
config_h_dir,
|
|
|
3b7e70 |
]
|
|
|
3b7e70 |
|
|
|
3b7e70 |
if pam_extensions_supported
|
|
|
3b7e70 |
gdm_session_worker_src += '../pam-extensions/gdm-pam-extensions.h'
|
|
|
3b7e70 |
gdm_session_worker_includes += pam_extensions_inc
|
|
|
3b7e70 |
endif
|
|
|
3b7e70 |
|
|
|
3b7e70 |
if libaudit_dep.found()
|
|
|
3b7e70 |
gdm_session_worker_deps += libaudit_dep
|
|
|
3b7e70 |
|
|
|
3b7e70 |
gdm_session_worker_src += [
|
|
|
3b7e70 |
'gdm-session-linux-auditor.c',
|
|
|
3b7e70 |
]
|
|
|
3b7e70 |
endif
|
|
|
3b7e70 |
|
|
|
3b7e70 |
if have_adt
|
|
|
3b7e70 |
gdm_session_worker_src += 'gdm-session-solaris-auditor.c'
|
|
|
3b7e70 |
endif
|
|
|
3b7e70 |
|
|
|
3b7e70 |
gdm_session_worker = executable('gdm-session-worker',
|
|
|
890c66 |
--
|
|
|
6b1540 |
2.33.1
|
|
|
890c66 |
|