|
|
f83012 |
From f12d17a6f4f76ba037e9126113684777a070a8f4 Mon Sep 17 00:00:00 2001
|
|
|
f83012 |
From: Ray Strode <rstrode@redhat.com>
|
|
|
f83012 |
Date: Mon, 20 Aug 2018 14:30:59 -0400
|
|
|
f83012 |
Subject: [PATCH 3/4] daemon: save os-release in accountsservice
|
|
|
f83012 |
|
|
|
f83012 |
It can be useful to know what OS a user was running
|
|
|
f83012 |
when they logged in (to detect upgrades).
|
|
|
f83012 |
|
|
|
f83012 |
This commit saves that information in accountsservice.
|
|
|
f83012 |
---
|
|
|
f83012 |
daemon/Makefile.am | 10 ++
|
|
|
f83012 |
daemon/gdm-session-settings.c | 98 +++++++++++++++++++
|
|
|
f83012 |
data/Makefile.am | 2 +
|
|
|
f83012 |
.../com.redhat.AccountsServiceUser.System.xml | 10 ++
|
|
|
f83012 |
4 files changed, 120 insertions(+)
|
|
|
f83012 |
create mode 100644 data/com.redhat.AccountsServiceUser.System.xml
|
|
|
f83012 |
|
|
|
f83012 |
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
|
|
|
f83012 |
index 3b1b15122..b77c9276e 100644
|
|
|
f83012 |
--- a/daemon/Makefile.am
|
|
|
f83012 |
+++ b/daemon/Makefile.am
|
|
|
f83012 |
@@ -14,137 +14,147 @@ AM_CPPFLAGS = \
|
|
|
f83012 |
-DLIBEXECDIR=\"$(libexecdir)\" \
|
|
|
f83012 |
-DLOCALSTATEDIR=\"$(localstatedir)\" \
|
|
|
f83012 |
-DLOGDIR=\"$(logdir)\" \
|
|
|
f83012 |
-DSBINDIR=\"$(sbindir)\" \
|
|
|
f83012 |
-DSYSCONFDIR=\"$(sysconfdir)\" \
|
|
|
f83012 |
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
|
|
|
f83012 |
-DGDM_RUN_DIR=\"$(GDM_RUN_DIR)\" \
|
|
|
f83012 |
-DGDM_XAUTH_DIR=\"$(GDM_XAUTH_DIR)\" \
|
|
|
f83012 |
-DGDM_SCREENSHOT_DIR=\"$(GDM_SCREENSHOT_DIR)\" \
|
|
|
f83012 |
-DGDM_CACHE_DIR=\""$(localstatedir)/cache/gdm"\" \
|
|
|
f83012 |
-DGDM_SESSION_DEFAULT_PATH=\"$(GDM_SESSION_DEFAULT_PATH)\" \
|
|
|
f83012 |
$(DISABLE_DEPRECATED_CFLAGS) \
|
|
|
f83012 |
$(DAEMON_CFLAGS) \
|
|
|
f83012 |
$(XLIB_CFLAGS) \
|
|
|
f83012 |
$(WARN_CFLAGS) \
|
|
|
f83012 |
$(DEBUG_CFLAGS) \
|
|
|
f83012 |
$(SYSTEMD_CFLAGS) \
|
|
|
f83012 |
$(JOURNALD_CFLAGS) \
|
|
|
f83012 |
$(LIBSELINUX_CFLAGS) \
|
|
|
f83012 |
-DLANG_CONFIG_FILE=\"$(LANG_CONFIG_FILE)\" \
|
|
|
f83012 |
$(NULL)
|
|
|
f83012 |
|
|
|
f83012 |
BUILT_SOURCES = \
|
|
|
f83012 |
gdm-display-glue.h \
|
|
|
f83012 |
gdm-manager-glue.h \
|
|
|
f83012 |
gdm-local-display-glue.h \
|
|
|
f83012 |
gdm-local-display-factory-glue.h \
|
|
|
f83012 |
gdm-session-glue.h \
|
|
|
f83012 |
gdm-session-worker-glue.h \
|
|
|
f83012 |
gdm-session-enum-types.h \
|
|
|
f83012 |
+ com.redhat.AccountsServiceUser.System.h \
|
|
|
f83012 |
$(NULL)
|
|
|
f83012 |
|
|
|
f83012 |
gdm-session-enum-types.h: gdm-session-enum-types.h.in gdm-session.h
|
|
|
f83012 |
$(AM_V_GEN) glib-mkenums --template $^ > $@
|
|
|
f83012 |
|
|
|
f83012 |
gdm-session-enum-types.c: gdm-session-enum-types.c.in gdm-session.h
|
|
|
f83012 |
$(AM_V_GEN) glib-mkenums --template $^ > $@
|
|
|
f83012 |
|
|
|
f83012 |
gdm-display-glue.c gdm-display-glue.h: gdm-display.xml Makefile.am
|
|
|
f83012 |
$(AM_V_GEN)gdbus-codegen \
|
|
|
f83012 |
--c-namespace=GdmDBus \
|
|
|
f83012 |
--interface-prefix=org.gnome.DisplayManager \
|
|
|
f83012 |
--generate-c-code=gdm-display-glue \
|
|
|
f83012 |
$(srcdir)/gdm-display.xml
|
|
|
f83012 |
|
|
|
f83012 |
gdm-local-display-glue.c gdm-local-display-glue.h: gdm-local-display.xml Makefile.am
|
|
|
f83012 |
$(AM_V_GEN)gdbus-codegen \
|
|
|
f83012 |
--c-namespace=GdmDBus \
|
|
|
f83012 |
--interface-prefix=org.gnome.DisplayManager \
|
|
|
f83012 |
--generate-c-code=gdm-local-display-glue \
|
|
|
f83012 |
$(srcdir)/gdm-local-display.xml
|
|
|
f83012 |
|
|
|
f83012 |
gdm-local-display-factory-glue.c gdm-local-display-factory-glue.h : gdm-local-display-factory.xml Makefile.am
|
|
|
f83012 |
$(AM_V_GEN)gdbus-codegen \
|
|
|
f83012 |
--c-namespace=GdmDBus \
|
|
|
f83012 |
--interface-prefix=org.gnome.DisplayManager \
|
|
|
f83012 |
--generate-c-code=gdm-local-display-factory-glue \
|
|
|
f83012 |
$(srcdir)/gdm-local-display-factory.xml
|
|
|
f83012 |
|
|
|
f83012 |
gdm-manager-glue.c gdm-manager-glue.h : gdm-manager.xml Makefile.am
|
|
|
f83012 |
$(AM_V_GEN)gdbus-codegen \
|
|
|
f83012 |
--c-namespace=GdmDBus \
|
|
|
f83012 |
--interface-prefix=org.gnome.DisplayManager \
|
|
|
f83012 |
--generate-c-code=gdm-manager-glue \
|
|
|
f83012 |
$(srcdir)/gdm-manager.xml
|
|
|
f83012 |
|
|
|
f83012 |
gdm-session-glue.c gdm-session-glue.h : gdm-session.xml Makefile.am
|
|
|
f83012 |
$(AM_V_GEN)gdbus-codegen \
|
|
|
f83012 |
--c-namespace=GdmDBus \
|
|
|
f83012 |
--interface-prefix=org.gnome.DisplayManager \
|
|
|
f83012 |
--generate-c-code=gdm-session-glue \
|
|
|
f83012 |
$(srcdir)/gdm-session.xml
|
|
|
f83012 |
|
|
|
f83012 |
gdm-session-worker-glue.c gdm-session-worker-glue.h : gdm-session-worker.xml Makefile.am
|
|
|
f83012 |
$(AM_V_GEN)gdbus-codegen \
|
|
|
f83012 |
--c-namespace=GdmDBus \
|
|
|
f83012 |
--interface-prefix=org.gnome.DisplayManager \
|
|
|
f83012 |
--generate-c-code=gdm-session-worker-glue \
|
|
|
f83012 |
$(srcdir)/gdm-session-worker.xml
|
|
|
f83012 |
|
|
|
f83012 |
+com.redhat.AccountsServiceUser.System.c com.redhat.AccountsServiceUser.System.h: $(top_srcdir)/data/com.redhat.AccountsServiceUser.System.xml Makefile.am
|
|
|
f83012 |
+ $(AM_V_GEN)gdbus-codegen \
|
|
|
f83012 |
+ --c-namespace=Gdm \
|
|
|
f83012 |
+ --interface-prefix=com.redhat \
|
|
|
f83012 |
+ --generate-c-code=com.redhat.AccountsServiceUser.System \
|
|
|
f83012 |
+ $(top_srcdir)/data/com.redhat.AccountsServiceUser.System.xml
|
|
|
f83012 |
+
|
|
|
f83012 |
noinst_PROGRAMS = \
|
|
|
f83012 |
test-session-client \
|
|
|
f83012 |
$(NULL)
|
|
|
f83012 |
|
|
|
f83012 |
test_session_client_SOURCES = \
|
|
|
f83012 |
test-session-client.c \
|
|
|
f83012 |
$(NULL)
|
|
|
f83012 |
|
|
|
f83012 |
nodist_test_session_client_SOURCES = \
|
|
|
f83012 |
gdm-session-glue.h \
|
|
|
f83012 |
gdm-session-glue.c \
|
|
|
f83012 |
gdm-manager-glue.h \
|
|
|
f83012 |
gdm-manager-glue.c \
|
|
|
f83012 |
$(NULL)
|
|
|
f83012 |
|
|
|
f83012 |
test_session_client_LDADD = \
|
|
|
f83012 |
$(DAEMON_LIBS) \
|
|
|
f83012 |
$(NULL)
|
|
|
f83012 |
|
|
|
f83012 |
libexec_PROGRAMS = \
|
|
|
f83012 |
gdm-session-worker \
|
|
|
f83012 |
gdm-wayland-session \
|
|
|
f83012 |
gdm-x-session \
|
|
|
f83012 |
$(NULL)
|
|
|
f83012 |
|
|
|
f83012 |
gdm_session_worker_SOURCES = \
|
|
|
f83012 |
session-worker-main.c \
|
|
|
f83012 |
+ com.redhat.AccountsServiceUser.System.h \
|
|
|
f83012 |
+ com.redhat.AccountsServiceUser.System.c \
|
|
|
f83012 |
gdm-session.c \
|
|
|
f83012 |
gdm-session.h \
|
|
|
f83012 |
gdm-session-settings.h \
|
|
|
f83012 |
gdm-session-settings.c \
|
|
|
f83012 |
gdm-session-auditor.h \
|
|
|
f83012 |
gdm-session-auditor.c \
|
|
|
f83012 |
gdm-session-record.c \
|
|
|
f83012 |
gdm-session-record.h \
|
|
|
f83012 |
gdm-session-worker.h \
|
|
|
f83012 |
gdm-session-worker.c \
|
|
|
f83012 |
gdm-session-worker-job.c \
|
|
|
f83012 |
gdm-session-worker-common.c \
|
|
|
f83012 |
gdm-session-worker-common.h \
|
|
|
f83012 |
gdm-dbus-util.c \
|
|
|
f83012 |
gdm-dbus-util.h \
|
|
|
f83012 |
$(NULL)
|
|
|
f83012 |
|
|
|
f83012 |
if SUPPORTS_PAM_EXTENSIONS
|
|
|
f83012 |
gdm_session_worker_SOURCES += $(top_srcdir)/pam-extensions/gdm-pam-extensions.h
|
|
|
f83012 |
endif
|
|
|
f83012 |
|
|
|
f83012 |
nodist_gdm_session_worker_SOURCES = \
|
|
|
f83012 |
gdm-session-glue.h \
|
|
|
f83012 |
gdm-session-glue.c \
|
|
|
f83012 |
gdm-session-worker-glue.c \
|
|
|
f83012 |
gdm-session-worker-glue.h \
|
|
|
f83012 |
gdm-session-enum-types.c \
|
|
|
f83012 |
gdm-session-enum-types.h \
|
|
|
f83012 |
$(NULL)
|
|
|
f83012 |
|
|
|
f83012 |
diff --git a/daemon/gdm-session-settings.c b/daemon/gdm-session-settings.c
|
|
|
f83012 |
index 8463fad32..921e4d501 100644
|
|
|
f83012 |
--- a/daemon/gdm-session-settings.c
|
|
|
f83012 |
+++ b/daemon/gdm-session-settings.c
|
|
|
f83012 |
@@ -1,70 +1,77 @@
|
|
|
f83012 |
/* gdm-session-settings.c - Loads session and language from ~/.dmrc
|
|
|
f83012 |
*
|
|
|
f83012 |
* Copyright (C) 2008 Red Hat, Inc.
|
|
|
f83012 |
*
|
|
|
f83012 |
* This program is free software; you can redistribute it and/or modify
|
|
|
f83012 |
* it under the terms of the GNU General Public License as published by
|
|
|
f83012 |
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
f83012 |
* any later version.
|
|
|
f83012 |
*
|
|
|
f83012 |
* This program is distributed in the hope that it will be useful,
|
|
|
f83012 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
f83012 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
f83012 |
* GNU General Public License for more details.
|
|
|
f83012 |
*
|
|
|
f83012 |
* You should have received a copy of the GNU General Public License
|
|
|
f83012 |
* along with this program; if not, write to the Free Software
|
|
|
f83012 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
|
f83012 |
* 02110-1301, USA.
|
|
|
f83012 |
*
|
|
|
f83012 |
* Written by: Ray Strode <rstrode@redhat.com>
|
|
|
f83012 |
*/
|
|
|
f83012 |
#include "config.h"
|
|
|
f83012 |
#include "gdm-session-settings.h"
|
|
|
f83012 |
+#include "gdm-common.h"
|
|
|
f83012 |
+
|
|
|
f83012 |
+#include "com.redhat.AccountsServiceUser.System.h"
|
|
|
f83012 |
|
|
|
f83012 |
#include <errno.h>
|
|
|
f83012 |
#include <pwd.h>
|
|
|
f83012 |
#include <string.h>
|
|
|
f83012 |
#include <sys/types.h>
|
|
|
f83012 |
#include <unistd.h>
|
|
|
f83012 |
|
|
|
f83012 |
#include <glib.h>
|
|
|
f83012 |
#include <glib-object.h>
|
|
|
f83012 |
#include <glib/gi18n.h>
|
|
|
f83012 |
|
|
|
f83012 |
#include <act/act-user-manager.h>
|
|
|
f83012 |
|
|
|
f83012 |
struct _GdmSessionSettingsPrivate
|
|
|
f83012 |
{
|
|
|
f83012 |
ActUserManager *user_manager;
|
|
|
f83012 |
ActUser *user;
|
|
|
f83012 |
+
|
|
|
f83012 |
+ /* used for retrieving the last OS user logged in with */
|
|
|
f83012 |
+ GdmAccountsServiceUserSystem *user_system_proxy;
|
|
|
f83012 |
+
|
|
|
f83012 |
char *session_name;
|
|
|
f83012 |
char *session_type;
|
|
|
f83012 |
char *language_name;
|
|
|
f83012 |
};
|
|
|
f83012 |
|
|
|
f83012 |
static void gdm_session_settings_finalize (GObject *object);
|
|
|
f83012 |
static void gdm_session_settings_class_install_properties (GdmSessionSettingsClass *
|
|
|
f83012 |
settings_class);
|
|
|
f83012 |
|
|
|
f83012 |
static void gdm_session_settings_set_property (GObject *object,
|
|
|
f83012 |
guint prop_id,
|
|
|
f83012 |
const GValue *value,
|
|
|
f83012 |
GParamSpec *pspec);
|
|
|
f83012 |
static void gdm_session_settings_get_property (GObject *object,
|
|
|
f83012 |
guint prop_id,
|
|
|
f83012 |
GValue *value,
|
|
|
f83012 |
GParamSpec *pspec);
|
|
|
f83012 |
|
|
|
f83012 |
enum {
|
|
|
f83012 |
PROP_0 = 0,
|
|
|
f83012 |
PROP_SESSION_NAME,
|
|
|
f83012 |
PROP_SESSION_TYPE,
|
|
|
f83012 |
PROP_LANGUAGE_NAME,
|
|
|
f83012 |
PROP_IS_LOADED
|
|
|
f83012 |
};
|
|
|
f83012 |
|
|
|
f83012 |
G_DEFINE_TYPE (GdmSessionSettings, gdm_session_settings, G_TYPE_OBJECT)
|
|
|
f83012 |
|
|
|
f83012 |
static void
|
|
|
f83012 |
gdm_session_settings_class_init (GdmSessionSettingsClass *settings_class)
|
|
|
f83012 |
@@ -107,60 +114,62 @@ gdm_session_settings_class_install_properties (GdmSessionSettingsClass *settings
|
|
|
f83012 |
g_object_class_install_property (object_class, PROP_LANGUAGE_NAME, param_spec);
|
|
|
f83012 |
|
|
|
f83012 |
param_spec = g_param_spec_boolean ("is-loaded", NULL, NULL,
|
|
|
f83012 |
FALSE, G_PARAM_READABLE);
|
|
|
f83012 |
g_object_class_install_property (object_class, PROP_IS_LOADED, param_spec);
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
static void
|
|
|
f83012 |
gdm_session_settings_init (GdmSessionSettings *settings)
|
|
|
f83012 |
{
|
|
|
f83012 |
settings->priv = G_TYPE_INSTANCE_GET_PRIVATE (settings,
|
|
|
f83012 |
GDM_TYPE_SESSION_SETTINGS,
|
|
|
f83012 |
GdmSessionSettingsPrivate);
|
|
|
f83012 |
|
|
|
f83012 |
settings->priv->user_manager = act_user_manager_get_default ();
|
|
|
f83012 |
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
static void
|
|
|
f83012 |
gdm_session_settings_finalize (GObject *object)
|
|
|
f83012 |
{
|
|
|
f83012 |
GdmSessionSettings *settings;
|
|
|
f83012 |
GObjectClass *parent_class;
|
|
|
f83012 |
|
|
|
f83012 |
settings = GDM_SESSION_SETTINGS (object);
|
|
|
f83012 |
|
|
|
f83012 |
if (settings->priv->user != NULL) {
|
|
|
f83012 |
g_object_unref (settings->priv->user);
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
+ g_clear_object (&settings->priv->user_system_proxy);
|
|
|
f83012 |
+
|
|
|
f83012 |
g_free (settings->priv->session_name);
|
|
|
f83012 |
g_free (settings->priv->language_name);
|
|
|
f83012 |
|
|
|
f83012 |
parent_class = G_OBJECT_CLASS (gdm_session_settings_parent_class);
|
|
|
f83012 |
|
|
|
f83012 |
if (parent_class->finalize != NULL) {
|
|
|
f83012 |
parent_class->finalize (object);
|
|
|
f83012 |
}
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
void
|
|
|
f83012 |
gdm_session_settings_set_language_name (GdmSessionSettings *settings,
|
|
|
f83012 |
const char *language_name)
|
|
|
f83012 |
{
|
|
|
f83012 |
g_return_if_fail (GDM_IS_SESSION_SETTINGS (settings));
|
|
|
f83012 |
|
|
|
f83012 |
if (settings->priv->language_name == NULL ||
|
|
|
f83012 |
strcmp (settings->priv->language_name, language_name) != 0) {
|
|
|
f83012 |
settings->priv->language_name = g_strdup (language_name);
|
|
|
f83012 |
g_object_notify (G_OBJECT (settings), "language-name");
|
|
|
f83012 |
}
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
void
|
|
|
f83012 |
gdm_session_settings_set_session_name (GdmSessionSettings *settings,
|
|
|
f83012 |
const char *session_name)
|
|
|
f83012 |
{
|
|
|
f83012 |
g_return_if_fail (GDM_IS_SESSION_SETTINGS (settings));
|
|
|
f83012 |
|
|
|
f83012 |
if (settings->priv->session_name == NULL ||
|
|
|
f83012 |
@@ -261,69 +270,86 @@ gdm_session_settings_get_property (GObject *object,
|
|
|
f83012 |
|
|
|
f83012 |
default:
|
|
|
f83012 |
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
f83012 |
}
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
GdmSessionSettings *
|
|
|
f83012 |
gdm_session_settings_new (void)
|
|
|
f83012 |
{
|
|
|
f83012 |
GdmSessionSettings *settings;
|
|
|
f83012 |
|
|
|
f83012 |
settings = g_object_new (GDM_TYPE_SESSION_SETTINGS,
|
|
|
f83012 |
NULL);
|
|
|
f83012 |
|
|
|
f83012 |
return settings;
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
gboolean
|
|
|
f83012 |
gdm_session_settings_is_loaded (GdmSessionSettings *settings)
|
|
|
f83012 |
{
|
|
|
f83012 |
if (settings->priv->user == NULL) {
|
|
|
f83012 |
return FALSE;
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
return act_user_is_loaded (settings->priv->user);
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
static void
|
|
|
f83012 |
load_settings_from_user (GdmSessionSettings *settings)
|
|
|
f83012 |
{
|
|
|
f83012 |
+ const char *object_path;
|
|
|
f83012 |
const char *session_name;
|
|
|
f83012 |
const char *session_type;
|
|
|
f83012 |
const char *language_name;
|
|
|
f83012 |
|
|
|
f83012 |
if (!act_user_is_loaded (settings->priv->user)) {
|
|
|
f83012 |
g_warning ("GdmSessionSettings: trying to load user settings from unloaded user");
|
|
|
f83012 |
return;
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
+ object_path = act_user_get_object_path (settings->priv->user);
|
|
|
f83012 |
+
|
|
|
f83012 |
+ if (object_path != NULL) {
|
|
|
f83012 |
+ g_autoptr (GError) error = NULL;
|
|
|
f83012 |
+ settings->priv->user_system_proxy = gdm_accounts_service_user_system_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
|
|
|
f83012 |
+ G_DBUS_PROXY_FLAGS_NONE,
|
|
|
f83012 |
+ "org.freedesktop.Accounts",
|
|
|
f83012 |
+ object_path,
|
|
|
f83012 |
+ NULL,
|
|
|
f83012 |
+ &error);
|
|
|
f83012 |
+ if (error != NULL) {
|
|
|
f83012 |
+ g_debug ("GdmSessionSettings: couldn't retrieve user system proxy from accountsservice: %s",
|
|
|
f83012 |
+ error->message);
|
|
|
f83012 |
+ }
|
|
|
f83012 |
+ }
|
|
|
f83012 |
+
|
|
|
f83012 |
/* if the user doesn't have saved state, they don't have any settings worth reading */
|
|
|
f83012 |
if (!act_user_get_saved (settings->priv->user))
|
|
|
f83012 |
goto out;
|
|
|
f83012 |
|
|
|
f83012 |
session_type = act_user_get_session_type (settings->priv->user);
|
|
|
f83012 |
session_name = act_user_get_session (settings->priv->user);
|
|
|
f83012 |
|
|
|
f83012 |
g_debug ("GdmSessionSettings: saved session is %s (type %s)", session_name, session_type);
|
|
|
f83012 |
|
|
|
f83012 |
if (session_type != NULL && session_type[0] != '\0') {
|
|
|
f83012 |
gdm_session_settings_set_session_type (settings, session_type);
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
if (session_name != NULL && session_name[0] != '\0') {
|
|
|
f83012 |
gdm_session_settings_set_session_name (settings, session_name);
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
language_name = act_user_get_language (settings->priv->user);
|
|
|
f83012 |
|
|
|
f83012 |
g_debug ("GdmSessionSettings: saved language is %s", language_name);
|
|
|
f83012 |
if (language_name != NULL && language_name[0] != '\0') {
|
|
|
f83012 |
gdm_session_settings_set_language_name (settings, language_name);
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
out:
|
|
|
f83012 |
g_object_notify (G_OBJECT (settings), "is-loaded");
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
static void
|
|
|
f83012 |
on_user_is_loaded_changed (ActUser *user,
|
|
|
f83012 |
@@ -349,64 +375,136 @@ gdm_session_settings_load (GdmSessionSettings *settings,
|
|
|
f83012 |
g_return_val_if_fail (!gdm_session_settings_is_loaded (settings), FALSE);
|
|
|
f83012 |
|
|
|
f83012 |
if (settings->priv->user != NULL) {
|
|
|
f83012 |
old_user = settings->priv->user;
|
|
|
f83012 |
|
|
|
f83012 |
g_signal_handlers_disconnect_by_func (G_OBJECT (settings->priv->user),
|
|
|
f83012 |
G_CALLBACK (on_user_is_loaded_changed),
|
|
|
f83012 |
settings);
|
|
|
f83012 |
} else {
|
|
|
f83012 |
old_user = NULL;
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
settings->priv->user = act_user_manager_get_user (settings->priv->user_manager,
|
|
|
f83012 |
username);
|
|
|
f83012 |
|
|
|
f83012 |
g_clear_object (&old_user);
|
|
|
f83012 |
|
|
|
f83012 |
if (!act_user_is_loaded (settings->priv->user)) {
|
|
|
f83012 |
g_signal_connect (settings->priv->user,
|
|
|
f83012 |
"notify::is-loaded",
|
|
|
f83012 |
G_CALLBACK (on_user_is_loaded_changed),
|
|
|
f83012 |
settings);
|
|
|
f83012 |
return FALSE;
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
load_settings_from_user (settings);
|
|
|
f83012 |
|
|
|
f83012 |
return TRUE;
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
+static void
|
|
|
f83012 |
+save_os_release (GdmSessionSettings *settings,
|
|
|
f83012 |
+ ActUser *user)
|
|
|
f83012 |
+{
|
|
|
f83012 |
+ g_autoptr(GFile) file = NULL;
|
|
|
f83012 |
+ g_autoptr(GError) error = NULL;
|
|
|
f83012 |
+ g_autofree char *contents = NULL;
|
|
|
f83012 |
+ g_auto(GStrv) lines = NULL;
|
|
|
f83012 |
+ size_t i;
|
|
|
f83012 |
+
|
|
|
f83012 |
+ if (settings->priv->user_system_proxy == NULL) {
|
|
|
f83012 |
+ g_debug ("GdmSessionSettings: not saving OS version to user account because accountsservice doesn't support it");
|
|
|
f83012 |
+ return;
|
|
|
f83012 |
+ }
|
|
|
f83012 |
+
|
|
|
f83012 |
+ file = g_file_new_for_path ("/etc/os-release");
|
|
|
f83012 |
+
|
|
|
f83012 |
+ if (!g_file_load_contents (file, NULL, &contents, NULL, NULL, &error)) {
|
|
|
f83012 |
+ g_debug ("GdmSessionSettings: couldn't load /etc/os-release: %s", error->message);
|
|
|
f83012 |
+ return;
|
|
|
f83012 |
+ }
|
|
|
f83012 |
+
|
|
|
f83012 |
+ lines = g_strsplit (contents, "\n", -1);
|
|
|
f83012 |
+ for (i = 0; lines[i] != NULL; i++) {
|
|
|
f83012 |
+ char *p, *name, *name_end, *value, *value_end;
|
|
|
f83012 |
+
|
|
|
f83012 |
+ p = lines[i];
|
|
|
f83012 |
+
|
|
|
f83012 |
+ while (g_ascii_isspace (*p))
|
|
|
f83012 |
+ p++;
|
|
|
f83012 |
+
|
|
|
f83012 |
+ if (*p == '#' || *p == '\0')
|
|
|
f83012 |
+ continue;
|
|
|
f83012 |
+ name = p;
|
|
|
f83012 |
+ while (gdm_shell_var_is_valid_char (*p, p == name))
|
|
|
f83012 |
+ p++;
|
|
|
f83012 |
+ name_end = p;
|
|
|
f83012 |
+ while (g_ascii_isspace (*p))
|
|
|
f83012 |
+ p++;
|
|
|
f83012 |
+ if (name == name_end || *p != '=') {
|
|
|
f83012 |
+ continue;
|
|
|
f83012 |
+ }
|
|
|
f83012 |
+ *name_end = '\0';
|
|
|
f83012 |
+
|
|
|
f83012 |
+ p++;
|
|
|
f83012 |
+
|
|
|
f83012 |
+ while (g_ascii_isspace (*p))
|
|
|
f83012 |
+ p++;
|
|
|
f83012 |
+
|
|
|
f83012 |
+ value = p;
|
|
|
f83012 |
+ value_end = value + strlen(value) - 1;
|
|
|
f83012 |
+
|
|
|
f83012 |
+ if (value != value_end && *value == '"' && *value_end == '"') {
|
|
|
f83012 |
+ value++;
|
|
|
f83012 |
+ *value_end = '\0';
|
|
|
f83012 |
+ }
|
|
|
f83012 |
+
|
|
|
f83012 |
+ if (strcmp (name, "ID") == 0) {
|
|
|
f83012 |
+ gdm_accounts_service_user_system_set_id (settings->priv->user_system_proxy,
|
|
|
f83012 |
+ value);
|
|
|
f83012 |
+ g_debug ("GdmSessionSettings: setting system OS for user to '%s'", value);
|
|
|
f83012 |
+ } else if (strcmp (name, "VERSION_ID") == 0) {
|
|
|
f83012 |
+ gdm_accounts_service_user_system_set_version_id (settings->priv->user_system_proxy,
|
|
|
f83012 |
+ value);
|
|
|
f83012 |
+ g_debug ("GdmSessionSettings: setting system OS version for user to '%s'", value);
|
|
|
f83012 |
+ }
|
|
|
f83012 |
+ }
|
|
|
f83012 |
+}
|
|
|
f83012 |
+
|
|
|
f83012 |
gboolean
|
|
|
f83012 |
gdm_session_settings_save (GdmSessionSettings *settings,
|
|
|
f83012 |
const char *username)
|
|
|
f83012 |
{
|
|
|
f83012 |
ActUser *user;
|
|
|
f83012 |
|
|
|
f83012 |
g_return_val_if_fail (GDM_IS_SESSION_SETTINGS (settings), FALSE);
|
|
|
f83012 |
g_return_val_if_fail (username != NULL, FALSE);
|
|
|
f83012 |
g_return_val_if_fail (gdm_session_settings_is_loaded (settings), FALSE);
|
|
|
f83012 |
|
|
|
f83012 |
user = act_user_manager_get_user (settings->priv->user_manager,
|
|
|
f83012 |
username);
|
|
|
f83012 |
|
|
|
f83012 |
|
|
|
f83012 |
if (!act_user_is_loaded (user)) {
|
|
|
f83012 |
g_object_unref (user);
|
|
|
f83012 |
return FALSE;
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
if (settings->priv->session_name != NULL) {
|
|
|
f83012 |
act_user_set_session (user, settings->priv->session_name);
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
if (settings->priv->session_type != NULL) {
|
|
|
f83012 |
act_user_set_session_type (user, settings->priv->session_type);
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
if (settings->priv->language_name != NULL) {
|
|
|
f83012 |
act_user_set_language (user, settings->priv->language_name);
|
|
|
f83012 |
}
|
|
|
f83012 |
+
|
|
|
f83012 |
+ save_os_release (settings, user);
|
|
|
f83012 |
+
|
|
|
f83012 |
g_object_unref (user);
|
|
|
f83012 |
|
|
|
f83012 |
return TRUE;
|
|
|
f83012 |
}
|
|
|
f83012 |
diff --git a/data/Makefile.am b/data/Makefile.am
|
|
|
f83012 |
index 192dfa052..d69021985 100644
|
|
|
f83012 |
--- a/data/Makefile.am
|
|
|
f83012 |
+++ b/data/Makefile.am
|
|
|
f83012 |
@@ -8,60 +8,62 @@ SUBDIRS = \
|
|
|
f83012 |
$(NULL)
|
|
|
f83012 |
|
|
|
f83012 |
initdir = $(gdmconfdir)/Init
|
|
|
f83012 |
postdir = $(gdmconfdir)/PostSession
|
|
|
f83012 |
predir = $(gdmconfdir)/PreSession
|
|
|
f83012 |
postlogindir = $(gdmconfdir)/PostLogin
|
|
|
f83012 |
workingdir = $(GDM_WORKING_DIR)
|
|
|
f83012 |
xauthdir = $(GDM_XAUTH_DIR)
|
|
|
f83012 |
screenshotdir = $(GDM_SCREENSHOT_DIR)
|
|
|
f83012 |
cachedir = $(localstatedir)/cache/gdm
|
|
|
f83012 |
|
|
|
f83012 |
Init: $(srcdir)/Init.in
|
|
|
f83012 |
sed -e 's,[@]X_PATH[@],$(X_PATH),g' \
|
|
|
f83012 |
<$(srcdir)/Init.in >Init
|
|
|
f83012 |
|
|
|
f83012 |
PreSession: $(srcdir)/PreSession.in
|
|
|
f83012 |
sed -e 's,[@]X_PATH[@],$(X_PATH),g' \
|
|
|
f83012 |
<$(srcdir)/PreSession.in >PreSession
|
|
|
f83012 |
PostSession: $(srcdir)/PostSession.in
|
|
|
f83012 |
sed -e 's,[@]X_PATH[@],$(X_PATH),g' \
|
|
|
f83012 |
<$(srcdir)/PostSession.in >PostSession
|
|
|
f83012 |
|
|
|
f83012 |
gdm.conf-custom: $(srcdir)/gdm.conf-custom.in
|
|
|
f83012 |
sed -e 's,[@]GDM_DEFAULTS_CONF[@],$(GDM_DEFAULTS_CONF),g' \
|
|
|
f83012 |
<$(srcdir)/gdm.conf-custom.in >gdm.conf-custom
|
|
|
f83012 |
|
|
|
f83012 |
dbusconfdir = $(DBUS_SYS_DIR)
|
|
|
f83012 |
dbusconf_in_files = gdm.conf.in
|
|
|
f83012 |
dbusconf_DATA = $(dbusconf_in_files:.conf.in=.conf)
|
|
|
f83012 |
|
|
|
f83012 |
+EXTRA_DIST += com.redhat.AccountsServiceUser.System.xml
|
|
|
f83012 |
+
|
|
|
f83012 |
@INTLTOOL_SCHEMAS_RULE@
|
|
|
f83012 |
@INTLTOOL_XML_NOMERGE_RULE@
|
|
|
f83012 |
|
|
|
f83012 |
# dconf database and profile
|
|
|
f83012 |
dconf_db_files = \
|
|
|
f83012 |
dconf/defaults/00-upstream-settings \
|
|
|
f83012 |
dconf/defaults/locks/00-upstream-settings-locks
|
|
|
f83012 |
|
|
|
f83012 |
dconfdbdir = $(pkgdatadir)
|
|
|
f83012 |
dconfdb_DATA = greeter-dconf-defaults
|
|
|
f83012 |
greeter-dconf-defaults: $(dconf_db_files)
|
|
|
f83012 |
$(AM_V_GEN) dconf compile $@ $(srcdir)/dconf/defaults
|
|
|
f83012 |
|
|
|
f83012 |
dconfprofiledir = $(DATADIR)/dconf/profile
|
|
|
f83012 |
dconfprofile_DATA = dconf/gdm
|
|
|
f83012 |
|
|
|
f83012 |
gsettings_SCHEMAS = org.gnome.login-screen.gschema.xml
|
|
|
f83012 |
@GSETTINGS_RULES@
|
|
|
f83012 |
|
|
|
f83012 |
schemasdir = $(pkgdatadir)
|
|
|
f83012 |
schemas_in_files = gdm.schemas.in
|
|
|
f83012 |
schemas_DATA = $(schemas_in_files:.schemas.in=.schemas)
|
|
|
f83012 |
|
|
|
f83012 |
gdm.schemas.in: $(srcdir)/gdm.schemas.in.in
|
|
|
f83012 |
sed -e 's,[@]GDMPREFETCHCMD[@],$(GDMPREFETCHCMD),g' \
|
|
|
f83012 |
-e 's,[@]GDM_CUSTOM_CONF[@],$(GDM_CUSTOM_CONF),g' \
|
|
|
f83012 |
-e 's,[@]GDM_USER_PATH[@],$(GDM_USER_PATH),g' \
|
|
|
f83012 |
-e 's,[@]GDM_USERNAME[@],$(GDM_USERNAME),g' \
|
|
|
f83012 |
-e 's,[@]GDM_GROUPNAME[@],$(GDM_GROUPNAME),g' \
|
|
|
f83012 |
-e 's,[@]HALT_COMMAND[@],$(HALT_COMMAND),g' \
|
|
|
f83012 |
diff --git a/data/com.redhat.AccountsServiceUser.System.xml b/data/com.redhat.AccountsServiceUser.System.xml
|
|
|
f83012 |
new file mode 100644
|
|
|
f83012 |
index 000000000..67f5f302c
|
|
|
f83012 |
--- /dev/null
|
|
|
f83012 |
+++ b/data/com.redhat.AccountsServiceUser.System.xml
|
|
|
f83012 |
@@ -0,0 +1,10 @@
|
|
|
f83012 |
+<node>
|
|
|
f83012 |
+ <interface name="com.redhat.AccountsServiceUser.System">
|
|
|
f83012 |
+
|
|
|
f83012 |
+ <annotation name="org.freedesktop.Accounts.VendorExtension" value="true"/>
|
|
|
f83012 |
+
|
|
|
f83012 |
+ <property name="id" type="s" access="readwrite"/>
|
|
|
f83012 |
+ <property name="version-id" type="s" access="readwrite"/>
|
|
|
f83012 |
+
|
|
|
f83012 |
+ </interface>
|
|
|
f83012 |
+</node>
|
|
|
f83012 |
--
|
|
|
f83012 |
2.17.1
|
|
|
f83012 |
|