diff --git a/SOURCES/0001-Add-asynchronous-api-for-user-uncaching.patch b/SOURCES/0001-Add-asynchronous-api-for-user-uncaching.patch new file mode 100644 index 0000000..4cc5f26 --- /dev/null +++ b/SOURCES/0001-Add-asynchronous-api-for-user-uncaching.patch @@ -0,0 +1,128 @@ +From 564dc2f4a923c6e2c45a9920776ae93a97bebede Mon Sep 17 00:00:00 2001 +From: Ondrej Holy +Date: Thu, 18 Sep 2014 18:55:36 +0200 +Subject: [PATCH] Add asynchronous api for user uncaching + +It is needed for deleting enterprise accounts in gnome-control-center. +See https://bugzilla.gnome.org/show_bug.cgi?id=727871 for details. +--- + src/libaccountsservice/act-user-manager.c | 83 +++++++++++++++++++++++++++++++ + src/libaccountsservice/act-user-manager.h | 8 +++ + 2 files changed, 91 insertions(+) + +diff --git a/src/libaccountsservice/act-user-manager.c b/src/libaccountsservice/act-user-manager.c +index c1c6f5a..e7c3305 100644 +--- a/src/libaccountsservice/act-user-manager.c ++++ b/src/libaccountsservice/act-user-manager.c +@@ -3353,6 +3353,89 @@ act_user_manager_uncache_user (ActUserManager *manager, + return TRUE; + } + ++/* ++ * act_user_manager_uncache_user_async: ++ * @manager: a #ActUserManager ++ * @username: a unix user name ++ * @cancellable: (allow-none): optional #GCancellable object, ++ * %NULL to ignore ++ * @callback: (scope async): a #GAsyncReadyCallback to call ++ * when the request is satisfied ++ * @user_data: (closure): the data to pass to @callback ++ * ++ * Asynchronously uncaches a user account. ++ * ++ * For more details, see act_user_manager_uncache_user(), which ++ * is the synchronous version of this call. ++ * ++ * Since: 0.6.39 ++ */ ++void ++act_user_manager_uncache_user_async (ActUserManager *manager, ++ const char *username, ++ GCancellable *cancellable, ++ GAsyncReadyCallback callback, ++ gpointer user_data) ++{ ++ GSimpleAsyncResult *res; ++ ++ g_return_if_fail (ACT_IS_USER_MANAGER (manager)); ++ g_return_if_fail (manager->priv->accounts_proxy != NULL); ++ ++ g_debug ("ActUserManager: Uncaching user (async) '%s'", username); ++ ++ res = g_simple_async_result_new (G_OBJECT (manager), ++ callback, user_data, ++ act_user_manager_uncache_user_async); ++ g_simple_async_result_set_check_cancellable (res, cancellable); ++ ++ accounts_accounts_call_uncache_user (manager->priv->accounts_proxy, ++ username, ++ cancellable, ++ act_user_manager_async_complete_handler, res); ++} ++ ++/** ++ * act_user_manager_uncache_user_finish: ++ * @manager: a #ActUserManager ++ * @result: a #GAsyncResult ++ * @error: a #GError ++ * ++ * Finishes an asynchronous user uncaching. ++ * ++ * See act_user_manager_uncache_user_async(). ++ * ++ * Returns: %TRUE if the user account was successfully uncached ++ * ++ * Since: 0.6.39 ++ */ ++gboolean ++act_user_manager_uncache_user_finish (ActUserManager *manager, ++ GAsyncResult *result, ++ GError **error) ++{ ++ GAsyncResult *inner_result; ++ gboolean success; ++ GSimpleAsyncResult *res; ++ GError *remote_error = NULL; ++ ++ g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (manager), act_user_manager_uncache_user_async), FALSE); ++ ++ res = G_SIMPLE_ASYNC_RESULT (result); ++ inner_result = g_simple_async_result_get_op_res_gpointer (res); ++ g_assert (inner_result); ++ ++ success = accounts_accounts_call_uncache_user_finish (manager->priv->accounts_proxy, ++ inner_result, &remote_error); ++ ++ if (remote_error) { ++ g_dbus_error_strip_remote_error (remote_error); ++ g_propagate_error (error, remote_error); ++ } ++ ++ return success; ++} ++ + /** + * act_user_manager_delete_user: + * @manager: a #ActUserManager +diff --git a/src/libaccountsservice/act-user-manager.h b/src/libaccountsservice/act-user-manager.h +index 3d91f83..ae5fd2e 100644 +--- a/src/libaccountsservice/act-user-manager.h ++++ b/src/libaccountsservice/act-user-manager.h +@@ -122,6 +122,14 @@ ActUser * act_user_manager_cache_user_finish (ActUserManager * + gboolean act_user_manager_uncache_user (ActUserManager *manager, + const char *username, + GError **error); ++void act_user_manager_uncache_user_async (ActUserManager *manager, ++ const gchar *username, ++ GCancellable *cancellable, ++ GAsyncReadyCallback callback, ++ gpointer user_data); ++gboolean act_user_manager_uncache_user_finish (ActUserManager *manager, ++ GAsyncResult *result, ++ GError **error); + + gboolean act_user_manager_delete_user (ActUserManager *manager, + ActUser *user, +-- +1.9.3 + diff --git a/SOURCES/0001-systemd-ensure-that-accounts-service-starts-after-NS.patch b/SOURCES/0001-systemd-ensure-that-accounts-service-starts-after-NS.patch new file mode 100644 index 0000000..a4b112b --- /dev/null +++ b/SOURCES/0001-systemd-ensure-that-accounts-service-starts-after-NS.patch @@ -0,0 +1,49 @@ +From 3d6d125917073b06849c336c93e475a5a43c0dd9 Mon Sep 17 00:00:00 2001 +From: Stephen Gallagher +Date: Fri, 17 Oct 2014 11:43:39 -0400 +Subject: [PATCH] systemd: ensure that accounts service starts after NSS + initializes + +The various NSS calls don't give accurate results in some configurations +until midway through boot up. This is because SSSD or winbind (or +whatever) needs to initialize. + +In order to prevent accounts service from using NSS prematurely, we need +to add an ordering constraint between the nss-user-lookup.target and +accountsservice. + +This commit accomplishes this by adding the appropriate Wants= and +After= directives to the accountsservice systemd unit file. +--- + data/accounts-daemon.service.in | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/data/accounts-daemon.service.in b/data/accounts-daemon.service.in +index 105bf6a..feedf3e 100644 +--- a/data/accounts-daemon.service.in ++++ b/data/accounts-daemon.service.in +@@ -1,15 +1,21 @@ + [Unit] + Description=Accounts Service + ++# In order to avoid races with identity-providing services like SSSD or ++# winbind, we need to ensure that Accounts Service starts after ++# nss-user-lookup.target ++After=nss-user-lookup.target ypbind.service ++Wants=nss-user-lookup.target ++ + [Service] + Type=dbus + BusName=org.freedesktop.Accounts + ExecStart=@libexecdir@/accounts-daemon + StandardOutput=syslog + + [Install] + # We pull this in by graphical.target instead of waiting for the bus + # activation, to speed things up a little: gdm uses this anyway so it is nice + # if it is already around when gdm wants to use it and doesn't have to wait for + # it. + WantedBy=graphical.target +-- +2.3.7 + diff --git a/SPECS/accountsservice.spec b/SPECS/accountsservice.spec index c9e6be8..e21e4fa 100644 --- a/SPECS/accountsservice.spec +++ b/SPECS/accountsservice.spec @@ -2,7 +2,7 @@ Name: accountsservice Version: 0.6.35 -Release: 7%{?dist} +Release: 9%{?dist} Summary: D-Bus interfaces for querying and manipulating user account information Group: System Environment/Daemons @@ -33,6 +33,8 @@ Patch1: 0001-Avoid-deleting-the-root-user.patch Patch2: fix-user-classification-logic.patch Patch3: userdel-f.patch Patch4: fix-leak.patch +Patch5: 0001-Add-asynchronous-api-for-user-uncaching.patch +Patch6: 0001-systemd-ensure-that-accounts-service-starts-after-NS.patch %package libs Summary: Client-side library to talk to accountsservice @@ -68,6 +70,8 @@ of these interfaces, based on the useradd, usermod and userdel commands. %patch2 -p1 -b .fix-user-classification-logic %patch3 -p1 -b .userdel-f %patch4 -p1 -b .fix-leak +%patch5 -p1 -b .async-api-uncaching +%patch6 -p1 -b .start-after-nsswitch %build autoreconf -f -i @@ -122,6 +126,14 @@ rm $RPM_BUILD_ROOT%{_libdir}/*.a %{_datadir}/gtk-doc/html/libaccountsservice/* %changelog +* Mon Jun 08 2015 Ray Strode 0.6.35-9 +- Start after nsswitch and ypbind + Resolves: #1217439 + +* Tue Jun 2 2015 Ondrej Holy 0.6.35-8 +- Add asynchronous api for user uncaching + Resolves: #1147999 + * Wed Jan 29 2014 Ray Strode 0.6.35-7 - Fix memory leak Resolves: #1003033