Browse Source

import accountsservice-0.6.55-1.el8

c8 imports/c8/accountsservice-0.6.55-1.el8
CentOS Sources 1 year ago
committed by Andrew Lukoshko
parent
commit
1ac0e10c54
  1. 2
      .accountsservice.metadata
  2. 2
      .gitignore
  3. 349
      SOURCES/0001-daemon-Fix-warnings-about-type-punning.patch
  4. 222
      SOURCES/0001-daemon-if-no-local-users-check-if-machine-is-enrolle.patch
  5. 4
      SOURCES/0001-data-don-t-send-change-updates-for-login-history.patch
  6. 90
      SOURCES/0001-lib-don-t-set-loaded-state-until-seat-is-fetched.patch
  7. 523
      SOURCES/0001-lib-save-os-when-creating-user.patch
  8. 910
      SOURCES/0001-user-add-new-Session-SessionType-properties-to-repla.patch
  9. 629
      SOURCES/0002-user-export-new-Saved-property.patch
  10. 46
      SPECS/accountsservice.spec

2
.accountsservice.metadata

@ -1 +1 @@
8d59b9cdc4121b34748442ee653b92d60607f2cb SOURCES/accountsservice-0.6.50.tar.xz
bab4f37144196d8ba06195bc72b4a9937c62b9fd SOURCES/accountsservice-0.6.55.tar.xz

2
.gitignore

@ -1 +1 @@
SOURCES/accountsservice-0.6.50.tar.xz
SOURCES/accountsservice-0.6.55.tar.xz

349
SOURCES/0001-daemon-Fix-warnings-about-type-punning.patch

@ -1,349 +0,0 @@
From dee5f443807fee3b5b279d0488df617eeed52230 Mon Sep 17 00:00:00 2001
From: Robert Ancell <robert.ancell@canonical.com>
Date: Thu, 6 Sep 2018 14:37:39 +1200
Subject: [PATCH] daemon: Fix warnings about type-punning
---
src/daemon.c | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/src/daemon.c b/src/daemon.c
index 2587b8a..00dff51 100644
--- a/src/daemon.c
+++ b/src/daemon.c
@@ -232,117 +232,118 @@ entry_generator_fgetpwent (Daemon *daemon,
pwent = fgetpwent (generator_state->fp);
if (pwent != NULL) {
shadow_entry_buffers = g_hash_table_lookup (generator_state->users, pwent->pw_name);
if (shadow_entry_buffers != NULL) {
*spent = &shadow_entry_buffers->spbuf;
}
return pwent;
}
}
/* Last iteration */
fclose (generator_state->fp);
g_hash_table_unref (generator_state->users);
g_free (generator_state);
*state = NULL;
return NULL;
}
static struct passwd *
entry_generator_cachedir (Daemon *daemon,
GHashTable *users,
gpointer *state,
struct spwd **shadow_entry)
{
struct passwd *pwent;
g_autoptr(GError) error = NULL;
gboolean regular;
GHashTableIter iter;
- const gchar *name;
- User *user;
+ gpointer key, value;
GDir *dir;
/* First iteration */
if (*state == NULL) {
*state = g_dir_open (USERDIR, 0, &error);
if (error != NULL) {
if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT))
g_warning ("couldn't list user cache directory: %s", USERDIR);
return NULL;
}
}
/* Every iteration */
/*
* Use names of files of regular type to lookup information
* about each user. Loop until we find something valid.
*/
dir = *state;
while (TRUE) {
const gchar *name;
g_autofree gchar *filename = NULL;
name = g_dir_read_name (dir);
if (name == NULL)
break;
/* Only load files in this directory */
filename = g_build_filename (USERDIR, name, NULL);
regular = g_file_test (filename, G_FILE_TEST_IS_REGULAR);
if (regular) {
errno = 0;
pwent = getpwnam (name);
if (pwent != NULL) {
*shadow_entry = getspnam (pwent->pw_name);
return pwent;
} else if (errno == 0) {
g_debug ("user '%s' in cache dir but not present on system, removing", name);
remove_cache_files (name);
}
else {
g_warning ("failed to check if user '%s' in cache dir is present on system: %s",
name, g_strerror (errno));
}
}
}
/* Last iteration */
g_dir_close (dir);
/* Update all the users from the files in the cache dir */
g_hash_table_iter_init (&iter, users);
- while (g_hash_table_iter_next (&iter, (gpointer *)&name, (gpointer *)&user)) {
+ while (g_hash_table_iter_next (&iter, &key, &value)) {
+ const gchar *name = key;
+ User *user = value;
g_autofree gchar *filename = NULL;
g_autoptr(GKeyFile) key_file = NULL;
filename = g_build_filename (USERDIR, name, NULL);
key_file = g_key_file_new ();
if (g_key_file_load_from_file (key_file, filename, 0, NULL))
user_update_from_keyfile (user, key_file);
}
*state = NULL;
return NULL;
}
static struct passwd *
entry_generator_requested_users (Daemon *daemon,
GHashTable *users,
gpointer *state,
struct spwd **shadow_entry)
{
struct passwd *pwent;
GList *node;
/* First iteration */
if (*state == NULL) {
*state = daemon->priv->explicitly_requested_users;
}
/* Every iteration */
if (g_hash_table_size (users) < MAX_LOCAL_USERS) {
@@ -423,129 +424,131 @@ load_entries (Daemon *daemon,
}
if (!explicitly_requested) {
user_set_cached (user, TRUE);
}
}
/* Generator should have cleaned up */
g_assert (generator_state == NULL);
}
static GHashTable *
create_users_hash_table (void)
{
return g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
g_object_unref);
}
static void
reload_users (Daemon *daemon)
{
AccountsAccounts *accounts = ACCOUNTS_ACCOUNTS (daemon);
gboolean had_no_users, has_no_users, had_multiple_users, has_multiple_users;
GHashTable *users;
GHashTable *old_users;
GHashTable *local;
GHashTableIter iter;
gsize number_of_normal_users = 0;
- gpointer name;
- User *user;
+ gpointer name, value;
/* Track the users that we saw during our (re)load */
users = create_users_hash_table ();
/*
* NOTE: As we load data from all the sources, notifies are
* frozen in load_entries() and then thawed as we process
* them below.
*/
/* Load the local users into our hash table */
load_entries (daemon, users, FALSE, entry_generator_fgetpwent);
local = g_hash_table_new (g_str_hash, g_str_equal);
g_hash_table_iter_init (&iter, users);
while (g_hash_table_iter_next (&iter, &name, NULL))
g_hash_table_add (local, name);
/* and add users to hash table that were explicitly requested */
load_entries (daemon, users, TRUE, entry_generator_requested_users);
/* Now add/update users from other sources, possibly non-local */
load_entries (daemon, users, FALSE, entry_generator_cachedir);
wtmp_helper_update_login_frequencies (users);
/* Count the non-system users. Mark which users are local, which are not. */
g_hash_table_iter_init (&iter, users);
- while (g_hash_table_iter_next (&iter, &name, (gpointer *)&user)) {
+ while (g_hash_table_iter_next (&iter, &name, &value)) {
+ User *user = value;
if (!user_get_system_account (user))
number_of_normal_users++;
user_update_local_account_property (user, g_hash_table_lookup (local, name) != NULL);
}
g_hash_table_destroy (local);
had_no_users = accounts_accounts_get_has_no_users (accounts);
has_no_users = number_of_normal_users == 0;
if (had_no_users != has_no_users)
accounts_accounts_set_has_no_users (accounts, has_no_users);
had_multiple_users = accounts_accounts_get_has_multiple_users (accounts);
has_multiple_users = number_of_normal_users > 1;
if (had_multiple_users != has_multiple_users)
accounts_accounts_set_has_multiple_users (accounts, has_multiple_users);
/* Swap out the users */
old_users = daemon->priv->users;
daemon->priv->users = users;
/* Remove all the old users */
g_hash_table_iter_init (&iter, old_users);
- while (g_hash_table_iter_next (&iter, &name, (gpointer *)&user)) {
+ while (g_hash_table_iter_next (&iter, &name, &value)) {
+ User *user = value;
User *refreshed_user;
refreshed_user = g_hash_table_lookup (users, name);
if (!refreshed_user || (user_get_cached (user) && !user_get_cached (refreshed_user))) {
accounts_accounts_emit_user_deleted (ACCOUNTS_ACCOUNTS (daemon),
user_get_object_path (user));
user_unregister (user);
}
}
/* Register all the new users */
g_hash_table_iter_init (&iter, users);
- while (g_hash_table_iter_next (&iter, &name, (gpointer *)&user)) {
+ while (g_hash_table_iter_next (&iter, &name, &value)) {
+ User *user = value;
User *stale_user;
stale_user = g_hash_table_lookup (old_users, name);
if (!stale_user || (!user_get_cached (stale_user) && user_get_cached (user))) {
user_register (user);
accounts_accounts_emit_user_added (ACCOUNTS_ACCOUNTS (daemon),
user_get_object_path (user));
}
g_object_thaw_notify (G_OBJECT (user));
}
g_hash_table_destroy (old_users);
}
static gboolean
reload_users_timeout (Daemon *daemon)
{
reload_users (daemon);
daemon->priv->reload_id = 0;
return FALSE;
}
static gboolean load_autologin (Daemon *daemon,
gchar **name,
gboolean *enabled,
GError **error);
static gboolean
@@ -932,69 +935,70 @@ typedef struct {
} ListUserData;
static ListUserData *
list_user_data_new (Daemon *daemon,
GDBusMethodInvocation *context)
{
ListUserData *data;
data = g_new0 (ListUserData, 1);
data->daemon = g_object_ref (daemon);
data->context = context;
return data;
}
static void
list_user_data_free (ListUserData *data)
{
g_object_unref (data->daemon);
g_free (data);
}
static gboolean
finish_list_cached_users (gpointer user_data)
{
ListUserData *data = user_data;
g_autoptr(GPtrArray) object_paths = NULL;
GHashTableIter iter;
- const gchar *name;
- User *user;
+ gpointer key, value;
uid_t uid;
const gchar *shell;
object_paths = g_ptr_array_new ();
g_hash_table_iter_init (&iter, data->daemon->priv->users);
- while (g_hash_table_iter_next (&iter, (gpointer *)&name, (gpointer *)&user)) {
+ while (g_hash_table_iter_next (&iter, &key, &value)) {
+ const gchar *name = key;
+ User *user = value;
uid = user_get_uid (user);
shell = user_get_shell (user);
if (!user_classify_is_human (uid, name, shell, NULL)) {
g_debug ("user %s %ld excluded", name, (long) uid);
continue;
}
if (!user_get_cached (user)) {
g_debug ("user %s %ld not cached", name, (long) uid);
continue;
}
g_debug ("user %s %ld not excluded", name, (long) uid);
g_ptr_array_add (object_paths, (gpointer) user_get_object_path (user));
}
g_ptr_array_add (object_paths, NULL);
accounts_accounts_complete_list_cached_users (NULL, data->context, (const gchar * const *) object_paths->pdata);
list_user_data_free (data);
return FALSE;
}
static gboolean
daemon_list_cached_users (AccountsAccounts *accounts,
GDBusMethodInvocation *context)
{
Daemon *daemon = (Daemon*)accounts;
--
2.17.1

222
SOURCES/0001-daemon-if-no-local-users-check-if-machine-is-enrolle.patch

@ -1,4 +1,4 @@
From 967603c6823180b055c6f1b5e76b05c377076eda Mon Sep 17 00:00:00 2001
From 54b207649979475ea7f1fa5eaaea94be31d20935 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Fri, 13 Dec 2019 15:16:06 -0500
Subject: [PATCH] daemon: if no local users, check if machine is enrolled in
@ -11,59 +11,14 @@ and shouldn't have a local user.
This commit detects that case, and avoids setting the HasNoUsers
property.
---
data/Makefile.am | 1 +
data/org.freedesktop.realmd.xml | 730 ++++++++++++++++++++++++++++++++
src/Makefile.am | 5 +
src/daemon.c | 61 ++-
src/daemon.c | 63 ++-
src/meson.build | 1 +
src/org.freedesktop.realmd.xml | 730 ++++++++++++++++++++++++++++++++
5 files changed, 1523 insertions(+), 4 deletions(-)
4 files changed, 1520 insertions(+), 4 deletions(-)
create mode 100644 data/org.freedesktop.realmd.xml
create mode 100644 src/org.freedesktop.realmd.xml
diff --git a/data/Makefile.am b/data/Makefile.am
index 521c6c2..6cf5e30 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -7,38 +7,39 @@ dbusif_DATA = \
dbusconfdir = $(sysconfdir)/dbus-1/system.d
dbusconf_DATA = org.freedesktop.Accounts.conf
servicedir = $(datadir)/dbus-1/system-services
service_in_files = org.freedesktop.Accounts.service.in
service_DATA = $(service_in_files:.service.in=.service)
$(service_DATA): $(service_in_files) Makefile
@sed -e "s|\@libexecdir\@|$(libexecdir)|" $< >$@
policydir = $(datadir)/polkit-1/actions
policy_in_files = org.freedesktop.accounts.policy.in
policy_DATA = $(policy_in_files:.policy.in=.policy)
@INTLTOOL_POLICY_RULE@
if HAVE_SYSTEMD
systemdsystemunit_DATA = \
accounts-daemon.service
accounts-daemon.service: accounts-daemon.service.in
@sed -e "s|\@libexecdir\@|$(libexecdir)|" $< >$@
endif
EXTRA_DIST = \
$(dbusif_DATA) \
$(dbusconf_DATA) \
$(service_in_files) \
$(policy_in_files) \
+ org.freedesktop.realmd.xml \
accounts-daemon.service.in
DISTCLEANFILES = \
$(service_DATA) \
$(policy_DATA)
CLEANFILES = \
accounts-daemon.service
diff --git a/data/org.freedesktop.realmd.xml b/data/org.freedesktop.realmd.xml
new file mode 100644
index 0000000..c34a47a
@ -800,77 +755,8 @@ index 0000000..c34a47a
+ </interface>
+
+</node>
diff --git a/src/Makefile.am b/src/Makefile.am
index f53e3e1..7a5b382 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,59 +1,64 @@
NULL =
BUILT_SOURCES =
SUBDIRS = . libaccountsservice
INCLUDES = \
-DLOCALSTATEDIR=\""$(localstatedir)"\" \
-DDATADIR=\""$(datadir)"\" \
-DICONDIR=\"$(localstatedir)/lib/AccountsService/icons\" \
-DUSERDIR=\"$(localstatedir)/lib/AccountsService/users\" \
-I$(srcdir) \
-I$(builddir) \
$(ACCOUNTS_DAEMON_CFLAGS) \
$(WARN_CFLAGS)
noinst_LTLIBRARIES = libaccounts-generated.la
libaccounts_generated_la_SOURCES = \
accounts-generated.c \
accounts-generated.h \
accounts-user-generated.c \
accounts-user-generated.h \
+ realmd-generated.c \
+ realmd-generated.h \
$(NULL)
BUILT_SOURCES += $(libaccounts_generated_la_SOURCES)
accounts-generated.c accounts-generated.h: $(top_srcdir)/data/org.freedesktop.Accounts.xml Makefile
gdbus-codegen --generate-c-code accounts-generated --c-namespace Accounts --interface-prefix=org.freedesktop. $(top_srcdir)/data/org.freedesktop.Accounts.xml
accounts-user-generated.c accounts-user-generated.h: $(top_srcdir)/data/org.freedesktop.Accounts.User.xml Makefile
gdbus-codegen --generate-c-code accounts-user-generated --c-namespace Accounts --interface-prefix=org.freedesktop.Accounts. $(top_srcdir)/data/org.freedesktop.Accounts.User.xml
+realmd-generated.c realmd-generated.h: $(top_srcdir)/data/org.freedesktop.realmd.xml Makefile
+ gdbus-codegen --c-generate-autocleanup all --c-generate-object-manager --generate-c-code realmd-generated --c-namespace Accounts --interface-prefix=org.freedesktop. $(top_srcdir)/data/org.freedesktop.realmd.xml
+
libexec_PROGRAMS = accounts-daemon
accounts_daemon_SOURCES = \
$(enums_h_sources) \
types.h \
daemon.h \
daemon.c \
extensions.c \
user-classify.h \
user-classify.c \
user.h \
user.c \
util.h \
util.c \
wtmp-helper.h \
wtmp-helper.c \
main.c
accounts_daemon_LDADD = \
libaccounts-generated.la \
$(ACCOUNTS_DAEMON_LIBS)
EXTRA_DIST = \
fgetpwent.c \
$(NULL)
CLEANFILES = \
$(BUILT_SOURCES) \
*.gcda \
*.gcno \
diff --git a/src/daemon.c b/src/daemon.c
index 00dff51..23e60ce 100644
index c52bda3..5ce0216 100644
--- a/src/daemon.c
+++ b/src/daemon.c
@@ -20,60 +20,61 @@
@ -915,7 +801,7 @@ index 00dff51..23e60ce 100644
PROP_DAEMON_VERSION
};
struct DaemonPrivate {
typedef struct {
GDBusConnection *bus_connection;
GHashTable *users;
@ -930,12 +816,12 @@ index 00dff51..23e60ce 100644
GFileMonitor *gdm_monitor;
GFileMonitor *wtmp_monitor;
GQueue *pending_list_cached_users;
guint reload_id;
guint autologin_id;
PolkitAuthority *authority;
GHashTable *extension_ifaces;
@@ -414,109 +415,164 @@ load_entries (Daemon *daemon,
@@ -425,110 +426,167 @@ load_entries (Daemon *daemon,
} else {
g_object_ref (user);
}
@ -969,13 +855,14 @@ index 00dff51..23e60ce 100644
+static gboolean
+ensure_bus_connection (Daemon *daemon)
+{
+ DaemonPrivate *priv = daemon_get_instance_private (daemon);
+ g_autoptr (GError) error = NULL;
+
+ if (daemon->priv->bus_connection != NULL)
+ if (priv->bus_connection != NULL)
+ return TRUE;
+
+ daemon->priv->bus_connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
+ if (daemon->priv->bus_connection == NULL) {
+ priv->bus_connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
+ if (priv->bus_connection == NULL) {
+ if (error != NULL)
+ g_critical ("error getting system bus: %s", error->message);
+ return FALSE;
@ -987,6 +874,7 @@ index 00dff51..23e60ce 100644
+static gboolean
+has_network_realms (Daemon *daemon)
+{
+ DaemonPrivate *priv = daemon_get_instance_private (daemon);
+ g_autoptr (AccountsRealmdProvider) realmd_provider = NULL;
+ g_autoptr (GError) error = NULL;
+ const char *const *realms = NULL;
@ -995,7 +883,7 @@ index 00dff51..23e60ce 100644
+ return FALSE;
+ }
+
+ realmd_provider = accounts_realmd_provider_proxy_new_sync (daemon->priv->bus_connection,
+ realmd_provider = accounts_realmd_provider_proxy_new_sync (priv->bus_connection,
+ G_DBUS_PROXY_FLAGS_NONE,
+ "org.freedesktop.realmd",
+ "/org/freedesktop/realmd",
@ -1019,6 +907,7 @@ index 00dff51..23e60ce 100644
static void
reload_users (Daemon *daemon)
{
DaemonPrivate *priv = daemon_get_instance_private (daemon);
AccountsAccounts *accounts = ACCOUNTS_ACCOUNTS (daemon);
gboolean had_no_users, has_no_users, had_multiple_users, has_multiple_users;
GHashTable *users;
@ -1080,8 +969,8 @@ index 00dff51..23e60ce 100644
accounts_accounts_set_has_multiple_users (accounts, has_multiple_users);
/* Swap out the users */
old_users = daemon->priv->users;
daemon->priv->users = users;
old_users = priv->users;
priv->users = users;
/* Remove all the old users */
g_hash_table_iter_init (&iter, old_users);
@ -1100,21 +989,20 @@ index 00dff51..23e60ce 100644
/* Register all the new users */
g_hash_table_iter_init (&iter, users);
@@ -733,64 +789,61 @@ daemon_finalize (GObject *object)
Daemon *daemon;
g_return_if_fail (IS_DAEMON (object));
@@ -766,64 +824,61 @@ daemon_finalize (GObject *object)
priv = daemon_get_instance_private (daemon);
daemon = DAEMON (object);
if (priv->bus_connection != NULL)
g_object_unref (priv->bus_connection);
if (daemon->priv->bus_connection != NULL)
g_object_unref (daemon->priv->bus_connection);
g_queue_free_full (priv->pending_list_cached_users,
(GDestroyNotify) list_user_data_free);
g_list_free_full (daemon->priv->explicitly_requested_users, g_free);
g_list_free_full (priv->explicitly_requested_users, g_free);
g_hash_table_destroy (daemon->priv->users);
g_hash_table_destroy (priv->users);
g_hash_table_unref (daemon->priv->extension_ifaces);
g_hash_table_unref (priv->extension_ifaces);
G_OBJECT_CLASS (daemon_parent_class)->finalize (object);
}
@ -1122,17 +1010,18 @@ index 00dff51..23e60ce 100644
static gboolean
register_accounts_daemon (Daemon *daemon)
{
DaemonPrivate *priv = daemon_get_instance_private (daemon);
g_autoptr(GError) error = NULL;
daemon->priv->authority = polkit_authority_get_sync (NULL, &error);
if (daemon->priv->authority == NULL) {
priv->authority = polkit_authority_get_sync (NULL, &error);
if (priv->authority == NULL) {
if (error != NULL)
g_critical ("error getting polkit authority: %s", error->message);
return FALSE;
}
- daemon->priv->bus_connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
- if (daemon->priv->bus_connection == NULL) {
- priv->bus_connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
- if (priv->bus_connection == NULL) {
- if (error != NULL)
- g_critical ("error getting system bus: %s", error->message);
+ if (!ensure_bus_connection (daemon)) {
@ -1140,7 +1029,7 @@ index 00dff51..23e60ce 100644
}
if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (daemon),
daemon->priv->bus_connection,
priv->bus_connection,
"/org/freedesktop/Accounts",
&error)) {
if (error != NULL)
@ -1166,6 +1055,49 @@ index 00dff51..23e60ce 100644
}
static void
diff --git a/src/meson.build b/src/meson.build
index 20d5276..3970749 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,37 +1,38 @@
sources = []
gdbus_headers = []
ifaces = [
['accounts-generated', 'org.freedesktop.', 'Accounts'],
['accounts-user-generated', act_namespace + '.', 'User'],
+ ['realmd-generated', 'org.freedesktop.', 'realmd'],
]
foreach iface: ifaces
gdbus_sources = gnome.gdbus_codegen(
iface[0],
join_paths(data_dir, iface[1] + iface[2] + '.xml'),
interface_prefix: iface[1],
namespace: 'Accounts',
)
sources += gdbus_sources
gdbus_headers += gdbus_sources[1]
endforeach
deps = [
gio_dep,
gio_unix_dep,
]
cflags = [
'-DLOCALSTATEDIR="@0@"'.format(act_localstatedir),
'-DDATADIR="@0@"'.format(act_datadir),
'-DICONDIR="@0@"'.format(join_paths(act_localstatedir, 'lib', 'AccountsService', 'icons')),
'-DUSERDIR="@0@"'.format(join_paths(act_localstatedir, 'lib', 'AccountsService', 'users')),
]
libaccounts_generated = static_library(
'accounts-generated',
sources: sources,
include_directories: top_inc,
dependencies: deps,
diff --git a/src/org.freedesktop.realmd.xml b/src/org.freedesktop.realmd.xml
new file mode 100644
index 0000000..c34a47a
@ -1903,5 +1835,5 @@ index 0000000..c34a47a
+
+</node>
--
2.21.0
2.27.0

4
SOURCES/0001-data-don-t-send-change-updates-for-login-history.patch

@ -1,4 +1,4 @@
From b4f85d66280affcb52e998661f782c2ab4f806a7 Mon Sep 17 00:00:00 2001
From 50edc5e45bb984576506e7b2bfb4c267ac566099 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Thu, 9 May 2019 14:58:34 -0400
Subject: [PATCH] data: don't send change updates for login-history
@ -84,5 +84,5 @@ index 8d3fe1c..3b839a3 100644
<doc:description>
<doc:para>
--
2.21.0
2.27.0

90
SOURCES/0001-lib-don-t-set-loaded-state-until-seat-is-fetched.patch

@ -1,90 +0,0 @@
From c7fa612023a163e8b2352e1170c6df3fceb19b27 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Thu, 19 Jul 2018 13:14:09 -0400
Subject: [PATCH] lib: don't set loaded state until seat is fetched
At the moment we set is-loaded on the user-manager
object as soon as we start fetching the seat, but
we should waiting until the seat is fetched, so
that can_switch() will return the correct value
if the caller waited until the loaded signal
to use it.
This commit changes the >= to > which I believe
was the original intention anyway.
https://bugs.freedesktop.org/show_bug.cgi?id=107298
---
src/libaccountsservice/act-user-manager.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libaccountsservice/act-user-manager.c b/src/libaccountsservice/act-user-manager.c
index 325421b..e7e26b1 100644
--- a/src/libaccountsservice/act-user-manager.c
+++ b/src/libaccountsservice/act-user-manager.c
@@ -2355,61 +2355,61 @@ act_user_manager_list_users (ActUserManager *manager)
queue_load_seat_incrementally (manager);
}
retval = NULL;
g_hash_table_foreach (manager->priv->normal_users_by_name, listify_hash_values_hfunc, &retval);
return g_slist_sort (retval, (GCompareFunc) act_user_collate);
}
static void
maybe_set_is_loaded (ActUserManager *manager)
{
if (manager->priv->is_loaded) {
g_debug ("ActUserManager: already loaded, so not setting loaded property");
return;
}
if (manager->priv->getting_sessions) {
g_debug ("ActUserManager: GetSessions call pending, so not setting loaded property");
return;
}
if (manager->priv->new_users_inhibiting_load != NULL) {
g_debug ("ActUserManager: Loading new users, so not setting loaded property");
return;
}
/* Don't set is_loaded yet unless the seat is already loaded enough
* or failed to load.
*/
- if (manager->priv->seat.state >= ACT_USER_MANAGER_SEAT_STATE_GET_ID) {
+ if (manager->priv->seat.state > ACT_USER_MANAGER_SEAT_STATE_GET_ID) {
g_debug ("ActUserManager: Seat loaded, so now setting loaded property");
} else if (manager->priv->seat.state == ACT_USER_MANAGER_SEAT_STATE_UNLOADED) {
g_debug ("ActUserManager: Seat wouldn't load, so giving up on it and setting loaded property");
} else {
g_debug ("ActUserManager: Seat still actively loading, so not setting loaded property");
return;
}
set_is_loaded (manager, TRUE);
}
static GSList *
slist_deep_copy (const GSList *list)
{
GSList *retval;
GSList *l;
if (list == NULL)
return NULL;
retval = g_slist_copy ((GSList *) list);
for (l = retval; l != NULL; l = l->next) {
l->data = g_strdup (l->data);
}
return retval;
}
static void
--
2.17.1

523
SOURCES/0001-lib-save-os-when-creating-user.patch

@ -1,6 +1,6 @@
From 51d5c9e9baec33aa74a60a4ac11f1de8f71acb2a Mon Sep 17 00:00:00 2001
From 5124220f12a157ff285072a4f786db2c94c3ca8a Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Fri, 12 Oct 2018 15:53:52 -0400
Date: Thu, 14 Jan 2021 15:07:34 -0500
Subject: [PATCH] lib: save os when creating user
In order to identify that a user has upgraded from rhel 7 to
@ -9,76 +9,15 @@ rhel 8, we need to know what os they were using when created.
This commit saves that information using a red hat specific
extension to accountsservice.
---
data/Makefile.am | 14 +-
.../com.redhat.AccountsServiceUser.System.xml | 10 ++
src/libaccountsservice/Makefile.am | 12 +-
data/meson.build | 1 +
meson.build | 1 +
meson_post_install.py | 15 +++
src/libaccountsservice/act-user-manager.c | 123 ++++++++++++++++++
4 files changed, 157 insertions(+), 2 deletions(-)
src/libaccountsservice/meson.build | 7 +
6 files changed, 157 insertions(+)
create mode 100644 data/com.redhat.AccountsServiceUser.System.xml
diff --git a/data/Makefile.am b/data/Makefile.am
index 6cf5e30..648774c 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,45 +1,57 @@
dbusifdir = $(datadir)/dbus-1/interfaces
dbusif_DATA = \
org.freedesktop.Accounts.xml \
- org.freedesktop.Accounts.User.xml
+ org.freedesktop.Accounts.User.xml \
+ com.redhat.AccountsServiceUser.System.xml
dbusconfdir = $(sysconfdir)/dbus-1/system.d
dbusconf_DATA = org.freedesktop.Accounts.conf
+accountsserviceifdir = $(datadir)/accountsservice/interfaces
+
servicedir = $(datadir)/dbus-1/system-services
service_in_files = org.freedesktop.Accounts.service.in
service_DATA = $(service_in_files:.service.in=.service)
$(service_DATA): $(service_in_files) Makefile
@sed -e "s|\@libexecdir\@|$(libexecdir)|" $< >$@
policydir = $(datadir)/polkit-1/actions
policy_in_files = org.freedesktop.accounts.policy.in
policy_DATA = $(policy_in_files:.policy.in=.policy)
@INTLTOOL_POLICY_RULE@
if HAVE_SYSTEMD
systemdsystemunit_DATA = \
accounts-daemon.service
accounts-daemon.service: accounts-daemon.service.in
@sed -e "s|\@libexecdir\@|$(libexecdir)|" $< >$@
endif
EXTRA_DIST = \
$(dbusif_DATA) \
$(dbusconf_DATA) \
$(service_in_files) \
$(policy_in_files) \
org.freedesktop.realmd.xml \
accounts-daemon.service.in
DISTCLEANFILES = \
$(service_DATA) \
$(policy_DATA)
CLEANFILES = \
accounts-daemon.service
+
+install-data-hook: com.redhat.AccountsServiceUser.System.xml
+ if test '!' -d $(DESTDIR)$(accountsserviceifdir); then \
+ $(mkinstalldirs) $(DESTDIR)$(accountsserviceifdir); \
+ chmod 755 $(DESTDIR)$(accountsserviceifdir); \
+ fi
+ if test '!' -L $(DESTDIR)$(accountsserviceifdir)/com.redhat.AccountsServiceUser.System.xml; then \
+ (cd $(DESTDIR)$(accountsserviceifdir); $(LN_S) ../../dbus-1/interfaces/com.redhat.AccountsServiceUser.System.xml) \
+ fi
diff --git a/data/com.redhat.AccountsServiceUser.System.xml b/data/com.redhat.AccountsServiceUser.System.xml
new file mode 100644
index 0000000..67f5f30
@ -95,93 +34,129 @@ index 0000000..67f5f30
+
+ </interface>
+</node>
diff --git a/src/libaccountsservice/Makefile.am b/src/libaccountsservice/Makefile.am
index 408d91f..d711d65 100644
--- a/src/libaccountsservice/Makefile.am
+++ b/src/libaccountsservice/Makefile.am
@@ -20,69 +20,79 @@ act-user-enum-types.h: act-user.h act-user-manager.h
$(AM_V_GEN) (cd $(srcdir) && \
glib-mkenums \
--fhead "#ifndef __ACT_USER_ENUM_TYPES_H__\n#define __ACT_USER_ENUM_TYPES_H__\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
--fprod "/* enumerations from \"@filename@\" */\n" \
--vhead "GType @enum_name@_get_type (void);\n#define ACT_USER_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
--ftail "G_END_DECLS\n\n#endif /* __ACT_USER_ENUM_TYPES_H__ */" \
$(^F) ) > $@
act-user-enum-types.c: act-user.h act-user-manager.h act-user-enum-types.h
$(AM_V_GEN) (cd $(srcdir) && \
glib-mkenums \
--fhead "#include \"act-user.h\"\n" \
--fhead "#include \"act-user-manager.h\"\n" \
--fhead "#include \"act-user-enum-types.h\"\n" \
--fhead "#include <glib-object.h>" \
--fprod "\n/* enumerations from \"@filename@\" */" \
--vhead "GType\n@enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G@Type@Value values[] = {" \
--vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
--vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (\"@EnumName@\", values);\n }\n return etype;\n}\n" \
$(^F) ) > $@
ck-manager-generated.c ck-manager-generated.h: org.freedesktop.ConsoleKit.Manager.xml Makefile
$(AM_V_GEN) gdbus-codegen --generate-c-code ck-manager-generated --c-namespace ConsoleKit --interface-prefix=org.freedesktop.ConsoleKit $(srcdir)/org.freedesktop.ConsoleKit.Manager.xml
ck-seat-generated.c ck-seat-generated.h: org.freedesktop.ConsoleKit.Seat.xml Makefile
$(AM_V_GEN) gdbus-codegen --generate-c-code ck-seat-generated --c-namespace ConsoleKit --interface-prefix=org.freedesktop.ConsoleKit $(srcdir)/org.freedesktop.ConsoleKit.Seat.xml
ck-session-generated.c ck-session-generated.h: org.freedesktop.ConsoleKit.Session.xml Makefile
$(AM_V_GEN) gdbus-codegen --generate-c-code ck-session-generated --c-namespace ConsoleKit --interface-prefix=org.freedesktop.ConsoleKit $(srcdir)/org.freedesktop.ConsoleKit.Session.xml
+com.redhat.AccountsServiceUser.System.c com.redhat.AccountsServiceUser.System.h: $(top_srcdir)/data/com.redhat.AccountsServiceUser.System.xml Makefile
+ $(AM_V_GEN)gdbus-codegen \
+ --c-namespace=Act \
+ --interface-prefix=com.redhat.AccountsService \
+ --generate-c-code=com.redhat.AccountsServiceUser.System \
+ $(top_srcdir)/data/com.redhat.AccountsServiceUser.System.xml
+
+
BUILT_SOURCES += \
act-user-enum-types.c \
act-user-enum-types.h \
ck-manager-generated.c \
ck-manager-generated.h \
ck-seat-generated.c \
ck-seat-generated.h \
ck-session-generated.c \
- ck-session-generated.h
+ ck-session-generated.h \
+ com.redhat.AccountsServiceUser.System.h \
+ com.redhat.AccountsServiceUser.System.c
CLEANFILES += $(BUILT_SOURCES)
libaccountsservicedir = $(includedir)/accountsservice-1.0/act
libaccountsservice_headers = \
act-user.h \
act-user-manager.h \
act-user-enum-types.h \
$(END_OF_LIST)
libaccountsservice_HEADERS = \
act.h \
$(libaccountsservice_headers) \
$(END_OF_LIST)
libaccountsservice_la_CFLAGS = $(LIBACCOUNTSSERVICE_CFLAGS)
libaccountsservice_la_LDFLAGS = \
-export-symbols-regex '^[^_].*' \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
-no-undefined \
$(END_OF_LIST)
libaccountsservice_la_LIBADD = \
../libaccounts-generated.la \
$(LIBACCOUNTSSERVICE_LIBS) \
-lcrypt \
$(END_OF_LIST)
libaccountsservice_la_sources = \
diff --git a/data/meson.build b/data/meson.build
index 4987937..2dc57c2 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -1,33 +1,34 @@
ifaces = files(
act_namespace + '.xml',
act_namespace + '.User.xml',
+ 'com.redhat.AccountsServiceUser.System.xml',
)
install_data(
ifaces,
install_dir: dbus_ifaces_dir,
)
install_data(
act_namespace + '.conf',
install_dir: dbus_conf_dir,
)
service_conf = configuration_data()
service_conf.set('libexecdir', act_libexecdir)
service = act_namespace + '.service'
configure_file(
input: service + '.in',
output: service,
configuration: service_conf,
install: true,
install_dir: dbus_sys_dir,
)
policy = act_namespace.to_lower() + '.policy'
i18n.merge_file(
policy,
input: policy + '.in',
diff --git a/meson.build b/meson.build
index 4465a26..e37c451 100644
--- a/meson.build
+++ b/meson.build
@@ -174,38 +174,39 @@ assert(not enable_systemd or not enable_elogind, 'systemd and elogind support re
if enable_systemd
logind_dep = dependency('libsystemd', version: '>= 186')
endif
if enable_elogind
logind_dep = dependency('libelogind', version: '>= 229.4')
endif
config_h.set('WITH_SYSTEMD', enable_systemd or enable_elogind)
subdir('data')
subdir('src')
subdir('po')
enable_docbook = get_option('docbook')
if enable_docbook
subdir('doc/dbus')
endif
if get_option('gtk_doc')
subdir('doc/libaccountsservice')
endif
configure_file(
output: 'config.h',
configuration: config_h,
)
meson.add_install_script(
'meson_post_install.py',
act_localstatedir,
+ act_datadir,
)
output = '\n' + meson.project_name() + ' was configured with the following options:\n'
output += '** DocBook documentation build: ' + enable_docbook.to_string() + '\n'
output += '** Administrator group: ' + admin_group + '\n'
output += '** Extra administrator groups: ' + extra_admin_groups + '\n'
output += '** GDM configuration: ' + gdm_conf_file
message(output)
diff --git a/meson_post_install.py b/meson_post_install.py
index 5cc2dc4..e1d5a71 100644
--- a/meson_post_install.py
+++ b/meson_post_install.py
@@ -1,18 +1,33 @@
#!/usr/bin/env python3
import os
import sys
destdir = os.environ.get('DESTDIR', '')
localstatedir = os.path.normpath(destdir + os.sep + sys.argv[1])
+datadir = os.path.normpath(destdir + os.sep + sys.argv[2])
+interfacedir = os.path.join(datadir, 'accountsservice', 'interfaces')
# FIXME: meson will not track the creation of these directories
# https://github.com/mesonbuild/meson/blob/master/mesonbuild/scripts/uninstall.py#L39
dst_dirs = [
(os.path.join(localstatedir, 'lib', 'AccountsService', 'icons'), 0o775),
(os.path.join(localstatedir, 'lib', 'AccountsService', 'users'), 0o700),
+ (interfacedir, 0o775),
]
for (dst_dir, dst_dir_mode) in dst_dirs:
if not os.path.exists(dst_dir):
os.makedirs(dst_dir, mode=dst_dir_mode)
+
+interface_files = [
+ 'com.redhat.AccountsServiceUser.System.xml',
+]
+
+for interface_file in interface_files:
+ src_path = os.path.join('../../dbus-1/interfaces', interface_file)
+ dst_path = os.path.join(interfacedir, interface_file)
+ if not os.path.exists(dst_path):
+ os.symlink(src_path, dst_path)
+
+
diff --git a/src/libaccountsservice/act-user-manager.c b/src/libaccountsservice/act-user-manager.c
index e7e26b1..9f3d6e5 100644
index 1b5298d..f4598c4 100644
--- a/src/libaccountsservice/act-user-manager.c
+++ b/src/libaccountsservice/act-user-manager.c
@@ -27,60 +27,61 @@
@ -246,7 +221,7 @@ index e7e26b1..9f3d6e5 100644
* @ACT_USER_MANAGER_ERROR_FAILED: Generic failure
* @ACT_USER_MANAGER_ERROR_USER_EXISTS: The user already exists
* @ACT_USER_MANAGER_ERROR_USER_DOES_NOT_EXIST: The user does not exist
@@ -167,60 +168,63 @@ typedef struct
@@ -165,60 +166,63 @@ typedef struct
ActUser *user;
ActUserManagerFetchUserRequestType type;
union {
@ -257,7 +232,7 @@ index e7e26b1..9f3d6e5 100644
char *description;
} ActUserManagerFetchUserRequest;
struct ActUserManagerPrivate
typedef struct
{
GHashTable *normal_users_by_name;
GHashTable *system_users_by_name;
@ -286,7 +261,7 @@ index e7e26b1..9f3d6e5 100644
gboolean has_multiple_users;
gboolean getting_sessions;
gboolean list_cached_users_done;
};
} ActUserManagerPrivate;
enum {
PROP_0,
@ -310,30 +285,30 @@ index e7e26b1..9f3d6e5 100644
static void act_user_manager_init (ActUserManager *user_manager);
static void act_user_manager_finalize (GObject *object);
@@ -2763,101 +2767,174 @@ ensure_accounts_proxy (ActUserManager *manager)
G_DBUS_PROXY_FLAGS_NONE,
ACCOUNTS_NAME,
ACCOUNTS_PATH,
NULL,
&error);
@@ -2942,100 +2946,173 @@ ensure_accounts_proxy (ActUserManager *manager)
G_DBUS_PROXY_FLAGS_NONE,
ACCOUNTS_NAME,
ACCOUNTS_PATH,
NULL,
&error);
if (error != NULL) {
g_debug ("ActUserManager: getting account proxy failed: %s", error->message);
return FALSE;
}
g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (manager->priv->accounts_proxy), G_MAXINT);
g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (priv->accounts_proxy), G_MAXINT);
g_object_bind_property (G_OBJECT (manager->priv->accounts_proxy),
g_object_bind_property (G_OBJECT (priv->accounts_proxy),
"has-multiple-users",
G_OBJECT (manager),
"has-multiple-users",
G_BINDING_SYNC_CREATE);
g_signal_connect (manager->priv->accounts_proxy,
g_signal_connect (priv->accounts_proxy,
"user-added",
G_CALLBACK (on_new_user_in_accounts_service),
manager);
g_signal_connect (manager->priv->accounts_proxy,
g_signal_connect (priv->accounts_proxy,
"user-deleted",
G_CALLBACK (on_user_removed_in_accounts_service),
manager);
@ -353,7 +328,7 @@ index e7e26b1..9f3d6e5 100644
+static void
+load_os_release (ActUserManager *manager)
+{
+ ActUserManagerPrivate *priv = manager->priv;
+ ActUserManagerPrivate *priv = act_user_manager_get_instance_private (manager);
+ g_autoptr(GFile) file = NULL;
+ g_autoptr(GError) error = NULL;
+ g_autofree char *contents = NULL;
@ -415,34 +390,33 @@ index e7e26b1..9f3d6e5 100644
static void
act_user_manager_init (ActUserManager *manager)
{
ActUserManagerPrivate *priv = act_user_manager_get_instance_private (manager);
g_autoptr(GError) error = NULL;
manager->priv = ACT_USER_MANAGER_GET_PRIVATE (manager);
act_user_manager_error_quark (); /* register dbus errors */
/* sessions */
manager->priv->sessions = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
g_object_unref);
priv->sessions = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
g_object_unref);
/* users */
manager->priv->normal_users_by_name = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
g_object_unref);
manager->priv->system_users_by_name = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
g_object_unref);
manager->priv->users_by_object_path = g_hash_table_new_full (g_str_hash,
g_str_equal,
NULL,
g_object_unref);
manager->priv->connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
if (manager->priv->connection == NULL) {
priv->normal_users_by_name = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
g_object_unref);
priv->system_users_by_name = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
g_object_unref);
priv->users_by_object_path = g_hash_table_new_full (g_str_hash,
g_str_equal,
NULL,
g_object_unref);
priv->connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
if (priv->connection == NULL) {
if (error != NULL) {
g_warning ("Failed to connect to the D-Bus daemon: %s", error->message);
} else {
@ -455,69 +429,69 @@ index e7e26b1..9f3d6e5 100644
+ load_os_release (manager);
+
manager->priv->seat.state = ACT_USER_MANAGER_SEAT_STATE_UNLOADED;
priv->seat.state = ACT_USER_MANAGER_SEAT_STATE_UNLOADED;
}
static void
act_user_manager_finalize (GObject *object)
{
ActUserManager *manager;
ActUserManager *manager = ACT_USER_MANAGER (object);
ActUserManagerPrivate *priv = act_user_manager_get_instance_private (manager);
GSList *node;
g_debug ("ActUserManager: finalizing user manager");
g_return_if_fail (object != NULL);
g_return_if_fail (ACT_IS_USER_MANAGER (object));
manager = ACT_USER_MANAGER (object);
g_return_if_fail (manager->priv != NULL);
g_slist_foreach (manager->priv->new_sessions,
g_slist_foreach (priv->new_sessions,
(GFunc) unload_new_session, NULL);
g_slist_free (manager->priv->new_sessions);
g_slist_free (priv->new_sessions);
g_slist_foreach (manager->priv->fetch_user_requests,
g_slist_foreach (priv->fetch_user_requests,
(GFunc) free_fetch_user_request, NULL);
g_slist_free (manager->priv->fetch_user_requests);
g_slist_free (priv->fetch_user_requests);
g_slist_free (manager->priv->new_users_inhibiting_load);
g_slist_free (priv->new_users_inhibiting_load);
node = manager->priv->new_users;
node = priv->new_users;
while (node != NULL) {
@@ -2899,141 +2976,179 @@ act_user_manager_finalize (GObject *object)
ActUser *user;
GSList *next_node;
user = ACT_USER (node->data);
next_node = node->next;
@@ -3071,143 +3148,181 @@ act_user_manager_finalize (GObject *object)
#ifdef WITH_SYSTEMD
if (manager->priv->seat.session_monitor != NULL) {
sd_login_monitor_unref (manager->priv->seat.session_monitor);
if (priv->seat.session_monitor != NULL) {
sd_login_monitor_unref (priv->seat.session_monitor);
}
if (manager->priv->seat.session_monitor_stream != NULL) {
g_object_unref (manager->priv->seat.session_monitor_stream);
if (priv->seat.session_monitor_stream != NULL) {
g_object_unref (priv->seat.session_monitor_stream);
}
if (manager->priv->seat.session_monitor_source_id != 0) {
g_source_remove (manager->priv->seat.session_monitor_source_id);
if (priv->seat.session_monitor_source_id != 0) {
g_source_remove (priv->seat.session_monitor_source_id);
}
#endif
if (manager->priv->accounts_proxy != NULL) {
g_object_unref (manager->priv->accounts_proxy);
if (priv->accounts_proxy != NULL) {
g_object_unref (priv->accounts_proxy);
}
if (manager->priv->load_id > 0) {
g_source_remove (manager->priv->load_id);
manager->priv->load_id = 0;
if (priv->load_id > 0) {
g_source_remove (priv->load_id);
priv->load_id = 0;
}
g_hash_table_destroy (manager->priv->sessions);
g_hash_table_destroy (priv->sessions);
g_hash_table_destroy (manager->priv->normal_users_by_name);
g_hash_table_destroy (manager->priv->system_users_by_name);
g_hash_table_destroy (manager->priv->users_by_object_path);
g_hash_table_destroy (priv->normal_users_by_name);
g_hash_table_destroy (priv->system_users_by_name);
g_hash_table_destroy (priv->users_by_object_path);
+ g_free (manager->priv->os_id);
+ g_free (manager->priv->os_version_id);
+ g_free (priv->os_id);
+ g_free (priv->os_version_id);
+
G_OBJECT_CLASS (act_user_manager_parent_class)->finalize (object);
}
@ -556,14 +530,15 @@ index e7e26b1..9f3d6e5 100644
gboolean
act_user_manager_no_service (ActUserManager *manager)
{
return manager->priv->accounts_proxy == NULL;
ActUserManagerPrivate *priv = act_user_manager_get_instance_private (manager);
return priv->accounts_proxy == NULL;
}
+static void
+save_system_info (ActUserManager *manager,
+ const char *user_path)
+{
+ ActUserManagerPrivate *priv = manager->priv;
+ ActUserManagerPrivate *priv = act_user_manager_get_instance_private (manager);
+ ActUserSystem *user_system_proxy = NULL;
+ g_autoptr(GError) error = NULL;
+
@ -611,6 +586,7 @@ index e7e26b1..9f3d6e5 100644
ActUserAccountType accounttype,
GError **error)
{
ActUserManagerPrivate *priv = act_user_manager_get_instance_private (manager);
GError *local_error = NULL;
gboolean res;
g_autofree gchar *path = NULL;
@ -619,9 +595,9 @@ index e7e26b1..9f3d6e5 100644
g_debug ("ActUserManager: Creating user '%s', '%s', %d",
username, fullname, accounttype);
g_assert (manager->priv->accounts_proxy != NULL);
g_assert (priv->accounts_proxy != NULL);
res = accounts_accounts_call_create_user_sync (manager->priv->accounts_proxy,
res = accounts_accounts_call_create_user_sync (priv->accounts_proxy,
username,
fullname,
accounttype,
@ -665,8 +641,7 @@ index e7e26b1..9f3d6e5 100644
*
* Asynchronously creates a user account on the system.
*
@@ -3077,105 +3192,110 @@ act_user_manager_create_user_async (ActUserManager *manager,
* act_user_manager_create_user_finish:
@@ -3253,106 +3368,111 @@ act_user_manager_create_user_async (ActUserManager *manager,
* @manager: a #ActUserManager
* @result: a #GAsyncResult
* @error: a #GError
@ -684,6 +659,7 @@ index e7e26b1..9f3d6e5 100644
GAsyncResult *result,
GError **error)
{
ActUserManagerPrivate *priv = act_user_manager_get_instance_private (manager);
GAsyncResult *inner_result;
ActUser *user = NULL;
g_autofree gchar *path = NULL;
@ -694,7 +670,7 @@ index e7e26b1..9f3d6e5 100644
return FALSE;
}
if (accounts_accounts_call_create_user_finish (manager->priv->accounts_proxy,
if (accounts_accounts_call_create_user_finish (priv->accounts_proxy,
&path, inner_result, &remote_error)) {
+
+ save_system_info (manager, path);
@ -725,6 +701,7 @@ index e7e26b1..9f3d6e5 100644
const char *username,
GError **error)
{
ActUserManagerPrivate *priv = act_user_manager_get_instance_private (manager);
GError *local_error = NULL;
gboolean res;
g_autofree gchar *path = NULL;
@ -732,9 +709,9 @@ index e7e26b1..9f3d6e5 100644
g_debug ("ActUserManager: Caching user '%s'",
username);
g_assert (manager->priv->accounts_proxy != NULL);
g_assert (priv->accounts_proxy != NULL);
res = accounts_accounts_call_cache_user_sync (manager->priv->accounts_proxy,
res = accounts_accounts_call_cache_user_sync (priv->accounts_proxy,
username,
&path,
NULL,
@ -775,9 +752,8 @@ index e7e26b1..9f3d6e5 100644
GAsyncReadyCallback callback,
gpointer user_data)
{
GTask *task;
@@ -3199,60 +3319,63 @@ act_user_manager_cache_user_async (ActUserManager *manager,
* act_user_manager_cache_user_finish:
ActUserManagerPrivate *priv = act_user_manager_get_instance_private (manager);
@@ -3378,60 +3498,63 @@ act_user_manager_cache_user_async (ActUserManager *manager,
* @manager: a #ActUserManager
* @result: a #GAsyncResult
* @error: a #GError
@ -795,6 +771,7 @@ index e7e26b1..9f3d6e5 100644
GAsyncResult *result,
GError **error)
{
ActUserManagerPrivate *priv = act_user_manager_get_instance_private (manager);
GAsyncResult *inner_result;
ActUser *user = NULL;
g_autofree gchar *path = NULL;
@ -805,7 +782,7 @@ index e7e26b1..9f3d6e5 100644
return FALSE;
}
if (accounts_accounts_call_cache_user_finish (manager->priv->accounts_proxy,
if (accounts_accounts_call_cache_user_finish (priv->accounts_proxy,
&path, inner_result, &remote_error)) {
+
+ save_system_info (manager, path);
@ -839,7 +816,79 @@ index e7e26b1..9f3d6e5 100644
const char *username,
GError **error)
{
GError *local_error = NULL;
ActUserManagerPrivate *priv = act_user_manager_get_instance_private (manager);
diff --git a/src/libaccountsservice/meson.build b/src/libaccountsservice/meson.build
index 4e134db..9e85bba 100644
--- a/src/libaccountsservice/meson.build
+++ b/src/libaccountsservice/meson.build
@@ -21,60 +21,67 @@ enum_types = 'act-user-enum-types'
enum_sources = gnome.mkenums(
enum_types,
sources: headers,
c_template: enum_types + '.c.template',
h_template: enum_types + '.h.template',
install_header: true,
install_dir: join_paths(act_pkgincludedir, subdir),
)
dbus_sources = []
ifaces = [
'Manager',
'Seat',
'Session',
]
namespace = 'ConsoleKit'
prefix = 'org.freedesktop.' + namespace
foreach iface: ifaces
dbus_sources += gnome.gdbus_codegen(
'ck-@0@-generated'.format(iface.to_lower()),
'@0@.@1@.xml'.format(prefix, iface),
interface_prefix: prefix,
namespace: namespace,
)
endforeach
+dbus_sources += gnome.gdbus_codegen(
+ 'com.redhat.AccountsServiceUser.System',
+ join_paths(data_dir, 'com.redhat.AccountsServiceUser.System.xml'),
+ interface_prefix: 'com.redhat.AccountsService',
+ namespace: 'Act',
+)
+
deps = [
crypt_dep,
gio_unix_dep,
glib_dep,
libaccounts_generated_dep,
]
symbol_map = join_paths(meson.current_source_dir(), 'symbol.map')
ldflags = cc.get_supported_link_arguments('-Wl,--version-script,@0@'.format(symbol_map))
if enable_systemd or enable_elogind
deps += logind_dep
endif
libaccountsservice = shared_library(
act_name,
sources: sources + enum_sources + dbus_sources,
version: libversion,
include_directories: top_inc,
dependencies: deps,
c_args: '-DG_LOG_DOMAIN="@0@"'.format(meson.project_name()),
link_args: ldflags,
link_depends: symbol_map,
install: true,
)
libaccountsservice_dep = declare_dependency(
sources: enum_sources[1],
include_directories: include_directories('.'),
dependencies: [gio_dep, glib_dep],
--
2.21.0
2.27.0

910
SOURCES/0001-user-add-new-Session-SessionType-properties-to-repla.patch

@ -1,910 +0,0 @@
From c66cee942242a731082f0fac649f3f9569ae99a3 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 8 Aug 2018 16:11:56 -0400
Subject: [PATCH 1/2] user: add new Session/SessionType properties to replace
XSession
Having a property called XSession in the API makes little
sense when wayland has taken the world by storm.
This commit adds new "Session" property without the "X" in the name,
and an additional property "SessionType" that can be either
"wayland" or "x11".
---
data/org.freedesktop.Accounts.User.xml | 103 +++++++++++++++++++++
src/libaccountsservice/act-user.c | 93 +++++++++++++++++++
src/libaccountsservice/act-user.h | 6 ++
src/user.c | 121 +++++++++++++++++++++++++
4 files changed, 323 insertions(+)
diff --git a/data/org.freedesktop.Accounts.User.xml b/data/org.freedesktop.Accounts.User.xml
index 4ab989a..7fc3c61 100644
--- a/data/org.freedesktop.Accounts.User.xml
+++ b/data/org.freedesktop.Accounts.User.xml
@@ -141,60 +141,143 @@
<doc:term>org.freedesktop.accounts.user-administration</doc:term>
<doc:definition>To change the language of another user</doc:definition>
</doc:item>
</doc:list>
</doc:permission>
<doc:errors>
<doc:error name="org.freedesktop.Accounts.Error.PermissionDenied">if the caller lacks the appropriate PolicyKit authorization</doc:error>
<doc:error name="org.freedesktop.Accounts.Error.Failed">if the operation failed</doc:error>
</doc:errors>
</doc:doc>
</method>
<method name="SetXSession">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="user_set_x_session"/>
<arg name="x_session" direction="in" type="s">
<doc:doc>
<doc:summary>
The new xsession to start (e.g. "gnome")
</doc:summary>
</doc:doc>
</arg>
<doc:doc>
<doc:description>
<doc:para>
Sets the users x session.
</doc:para>
<doc:para>
The expectation is that display managers will log the user in to this
specified session, if available.
+
+ Note this call is deprecated and has been superceded by SetSession since
+ not all graphical sessions use X as the display server.
+ </doc:para>
+ </doc:description>
+ <doc:permission>
+ The caller needs one of the following PolicyKit authorizations:
+ <doc:list>
+ <doc:item>
+ <doc:term>org.freedesktop.accounts.change-own-user-data</doc:term>
+ <doc:definition>To change his own language</doc:definition>
+ </doc:item>
+ <doc:item>
+ <doc:term>org.freedesktop.accounts.user-administration</doc:term>
+ <doc:definition>To change the language of another user</doc:definition>
+ </doc:item>
+ </doc:list>
+ </doc:permission>
+ <doc:errors>
+ <doc:error name="org.freedesktop.Accounts.Error.PermissionDenied">if the caller lacks the appropriate PolicyKit authorization</doc:error>
+ <doc:error name="org.freedesktop.Accounts.Error.Failed">if the operation failed</doc:error>
+ </doc:errors>
+ </doc:doc>
+ </method>
+
+ <method name="SetSession">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="user_set_session"/>
+ <arg name="session" direction="in" type="s">
+ <doc:doc>
+ <doc:summary>
+ The new session to start (e.g. "gnome-xorg")
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ Sets the users wayland or x session.
+ </doc:para>
+ <doc:para>
+ The expectation is that display managers will log the user in to this
+ specified session, if available.
+ </doc:para>
+ </doc:description>
+ <doc:permission>
+ The caller needs one of the following PolicyKit authorizations:
+ <doc:list>
+ <doc:item>
+ <doc:term>org.freedesktop.accounts.change-own-user-data</doc:term>
+ <doc:definition>To change his own language</doc:definition>
+ </doc:item>
+ <doc:item>
+ <doc:term>org.freedesktop.accounts.user-administration</doc:term>
+ <doc:definition>To change the language of another user</doc:definition>
+ </doc:item>
+ </doc:list>
+ </doc:permission>
+ <doc:errors>
+ <doc:error name="org.freedesktop.Accounts.Error.PermissionDenied">if the caller lacks the appropriate PolicyKit authorization</doc:error>
+ <doc:error name="org.freedesktop.Accounts.Error.Failed">if the operation failed</doc:error>
+ </doc:errors>
+ </doc:doc>
+ </method>
+
+ <method name="SetSessionType">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="user_set_session_type"/>
+ <arg name="session_type" direction="in" type="s">
+ <doc:doc>
+ <doc:summary>
+ The type of the new session to start (e.g. "wayland" or "x11")
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ Sets the session type of the users session.
+ </doc:para>
+ <doc:para>
+ Display managers may use this property to decide what type of display server to use when
+ loading the session
</doc:para>
</doc:description>
<doc:permission>
The caller needs one of the following PolicyKit authorizations:
<doc:list>
<doc:item>
<doc:term>org.freedesktop.accounts.change-own-user-data</doc:term>
<doc:definition>To change his own language</doc:definition>
</doc:item>
<doc:item>
<doc:term>org.freedesktop.accounts.user-administration</doc:term>
<doc:definition>To change the language of another user</doc:definition>
</doc:item>
</doc:list>
</doc:permission>
<doc:errors>
<doc:error name="org.freedesktop.Accounts.Error.PermissionDenied">if the caller lacks the appropriate PolicyKit authorization</doc:error>
<doc:error name="org.freedesktop.Accounts.Error.Failed">if the operation failed</doc:error>
</doc:errors>
</doc:doc>
</method>
<method name="SetLocation">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="location" direction="in" type="s">
<doc:doc>
<doc:summary>
The new location as a freeform string.
</doc:summary>
</doc:doc>
@@ -641,60 +724,80 @@
<property name="Shell" type="s" access="read">
<doc:doc>
<doc:description>
<doc:para>
The users shell.
</doc:para>
</doc:description>
</doc:doc>
</property>
<property name="Email" type="s" access="read">
<doc:doc>
<doc:description>
<doc:para>
The email address.
</doc:para>
</doc:description>
</doc:doc>
</property>
<property name="Language" type="s" access="read">
<doc:doc>
<doc:description>
<doc:para>
The users language, as a locale specification like "de_DE.UTF-8".
</doc:para>
</doc:description>
</doc:doc>
</property>
+ <property name="Session" type="s" access="read">
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ The users Wayland or X session.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </property>
+
+ <property name="SessionType" type="s" access="read">
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ The type of session the user should use (e.g. "wayland" or "x11")
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </property>
+
<property name="XSession" type="s" access="read">
<doc:doc>
<doc:description>
<doc:para>
The users x session.
</doc:para>
</doc:description>
</doc:doc>
</property>
<property name="Location" type="s" access="read">
<doc:doc>