Browse Source

gnome-settings-daemon package update

Signed-off-by: guibuilder_pel7x64builder0 <guibuilder@powerel.org>
master
guibuilder_pel7x64builder0 7 years ago
parent
commit
f3de8dd5fe
  1. 58
      SOURCES/0001-Revert-Revert-plugins-Work-around-startup-deadlock.patch
  2. 12248
      SOURCES/0001-account-first-cut-at-account-plugin.patch
  3. 128
      SOURCES/0001-common-Ensure-screen-integrated-devices-get-remapped.patch
  4. 4865
      SOURCES/0001-housekeeping-Add-a-GPU-memory-usage-notification.patch
  5. 339
      SOURCES/0001-smartcard-Wait-until-smartcards-are-inspected-before.patch
  6. 56
      SOURCES/0002-Revert-sharing-Fix-function-arguments.patch
  7. 319
      SOURCES/0002-account-reshow-the-notification-when-screen-unlocks.patch
  8. 384
      SOURCES/0002-smartcard-handle-a-smartcard-getting-removed-very-sh.patch
  9. 170
      SOURCES/0003-Revert-sharing-Use-systemd-to-track-running-services.patch
  10. 475
      SOURCES/0003-account-display-nag-screen-periodically.patch
  11. 1384
      SPECS/gnome-settings-daemon.spec

58
SOURCES/0001-Revert-Revert-plugins-Work-around-startup-deadlock.patch

@ -0,0 +1,58 @@ @@ -0,0 +1,58 @@
From a89835db96703a861c14cc36211511ecfcb7d3d6 Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Wed, 11 Oct 2017 18:08:52 +0200
Subject: [PATCH 1/3] Revert "Revert "plugins: Work-around startup deadlock""

This reverts commit e0f230ce6124fac47bc0810d30ff78ec327152ca.
---
configure.ac | 2 +-
plugins/common/daemon-skeleton-gtk.h | 4 ++++
plugins/common/daemon-skeleton.h | 4 ++++
3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index c74ba250..3073017d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -42,7 +42,7 @@ dnl ---------------------------------------------------------------------------
dnl - Dependencies
dnl ---------------------------------------------------------------------------
-GLIB_REQUIRED_VERSION=2.53.0
+GLIB_REQUIRED_VERSION=2.44.0
GIO_REQUIRED_VERSION=${GLIB_REQUIRED_VERSION}
GTK_REQUIRED_VERSION=3.15.3
GCONF_REQUIRED_VERSION=2.6.1
diff --git a/plugins/common/daemon-skeleton-gtk.h b/plugins/common/daemon-skeleton-gtk.h
index 27aade6c..46d0ed1a 100644
--- a/plugins/common/daemon-skeleton-gtk.h
+++ b/plugins/common/daemon-skeleton-gtk.h
@@ -199,6 +199,10 @@ main (int argc, char **argv)
set_empty_gtk_theme (TRUE);
+ /* Work around https://bugzilla.gnome.org/show_bug.cgi?id=674885 */
+ g_type_ensure (G_TYPE_DBUS_CONNECTION);
+ g_type_ensure (G_TYPE_DBUS_PROXY);
+
gdk_set_allowed_backends ("x11");
error = NULL;
diff --git a/plugins/common/daemon-skeleton.h b/plugins/common/daemon-skeleton.h
index e4641fcc..cdd7bc2a 100644
--- a/plugins/common/daemon-skeleton.h
+++ b/plugins/common/daemon-skeleton.h
@@ -174,6 +174,10 @@ main (int argc, char **argv)
textdomain (GETTEXT_PACKAGE);
setlocale (LC_ALL, "");
+ /* Work around https://bugzilla.gnome.org/show_bug.cgi?id=674885 */
+ g_type_ensure (G_TYPE_DBUS_CONNECTION);
+ g_type_ensure (G_TYPE_DBUS_PROXY);
+
context = g_option_context_new (NULL);
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
if (!g_option_context_parse (context, &argc, &argv, &error)) {
--
2.13.5

12248
SOURCES/0001-account-first-cut-at-account-plugin.patch

File diff suppressed because it is too large Load Diff

128
SOURCES/0001-common-Ensure-screen-integrated-devices-get-remapped.patch

@ -0,0 +1,128 @@ @@ -0,0 +1,128 @@
From 1c1a4201a6456892ba50f9a8ffec2e5cf0c90ec3 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Fri, 5 Jan 2018 18:38:30 +0100
Subject: [PATCH 1/3] common: Ensure screen integrated devices get remapped on
hotplug

GsdDeviceMapper used to refrain from remapping devices that already had
a configured output. This however results on wrong mapping when the input
device is plugged before the output, since the heuristics will attempt
really hard to find an output for the device before the real one is
available, and not remapped again when the output is plugged.

Fix this by forcing remapping on all screen-integrated devices on every
hotplug event, so the input device will get remapped to the right screen
(hopefully!) when it is plugged. This is not applied to devices mapped
to the builtin output, or those with no attached output at all, as in both
of these cases the configured output should be left static.

https://bugzilla.gnome.org/show_bug.cgi?id=748589
---
plugins/common/gsd-device-mapper.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/plugins/common/gsd-device-mapper.c b/plugins/common/gsd-device-mapper.c
index c9a113c4..fae4150f 100644
--- a/plugins/common/gsd-device-mapper.c
+++ b/plugins/common/gsd-device-mapper.c
@@ -603,10 +603,15 @@ mapper_recalculate_candidates (GsdDeviceMapper *mapper)
input_info_update_settings_output (input);
- /* Device has an output from settings */
- if (input->output)
+ /* Avoid opaque device with an output from settings and
+ * system-integrated devices that won't get remapped anyway
+ */
+ if (input->output &&
+ (input->capabilities & GSD_INPUT_IS_SCREEN_INTEGRATED) == 0)
continue;
+ /* reset the current output */
+ input_info_set_output (input, NULL, FALSE, FALSE);
input_info_guess_candidates (input, outputs);
mapping_helper_add (helper, input, outputs);
}
--
2.14.3


From 9b08637bc3c907886b03accad6f9f4b1a2a575dc Mon Sep 17 00:00:00 2001
From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Date: Thu, 2 Nov 2017 10:24:43 +0100
Subject: [PATCH 2/3] Fix screen mapping for Cintiqs and others

Size-based input/output matching doesn't raise the "found" flag, which
would result on input_info_guess_candidates() still trying to assign the
builtin output to the input device if that is the only match found.

For screen integrated devices (i.e. not on the builtin output) this is
and undesirable possibility, setting the "found" flag to TRUE results on
the correct output being assigned.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=748589
---
plugins/common/gsd-device-mapper.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/plugins/common/gsd-device-mapper.c b/plugins/common/gsd-device-mapper.c
index fae4150f..d4f7bc35 100644
--- a/plugins/common/gsd-device-mapper.c
+++ b/plugins/common/gsd-device-mapper.c
@@ -257,6 +257,7 @@ input_info_guess_candidates (GsdInputInfo *input,
if (input->capabilities & GSD_INPUT_IS_SCREEN_INTEGRATED) {
outputs[GSD_PRIO_MATCH_SIZE] = input_info_find_size_match (input, input->mapper->rr_screen);
+ found |= outputs[GSD_PRIO_MATCH_SIZE] != NULL;
}
split = g_strsplit (name, " ", -1);
--
2.14.3


From 64004232ff007847c5bf04c9ec2ca8cdb8fd8d5d Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Wed, 19 Jul 2017 19:32:41 +0200
Subject: [PATCH 3/3] common: Check for wayland before building
GsdUdevDeviceManager

Udev is rather common, so this check doesn't suffice if anyone wants
to build with no wayland support whatsoever.

https://bugzilla.gnome.org/show_bug.cgi?id=780544
---
configure.ac | 1 +
plugins/common/Makefile.am | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index bee9abe6..d04f8b66 100644
--- a/configure.ac
+++ b/configure.ac
@@ -140,6 +140,7 @@ if test x$enable_wayland != xno; then
fi
fi
fi
+AM_CONDITIONAL(HAVE_WAYLAND, test x$have_wayland = xyes)
dnl ================================================================
dnl Plugins
diff --git a/plugins/common/Makefile.am b/plugins/common/Makefile.am
index 706be129..36cf17cc 100644
--- a/plugins/common/Makefile.am
+++ b/plugins/common/Makefile.am
@@ -40,7 +40,7 @@ libcommon_la_SOURCES = \
gsd-shell-helper.c \
gsd-shell-helper.h
-if HAVE_GUDEV
+if HAVE_WAYLAND
libcommon_la_SOURCES += \
gsd-device-manager-udev.c \
gsd-device-manager-udev.h
--
2.14.3

4865
SOURCES/0001-housekeeping-Add-a-GPU-memory-usage-notification.patch

File diff suppressed because it is too large Load Diff

339
SOURCES/0001-smartcard-Wait-until-smartcards-are-inspected-before.patch

@ -0,0 +1,339 @@ @@ -0,0 +1,339 @@
From 0c5ef2671ad9e439ced820d0a5f6a26ed67cb6e8 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Fri, 9 Feb 2018 16:39:12 -0500
Subject: [PATCH 1/2] smartcard: Wait until smartcards are inspected before
locking screen

There's a race condition in the code where we check if the screen should
be locked (because the smartcard is removed) before we necessarly check
the smartcard's insertion status.

This commit fixes the race by iterating through all smartcards at
startup and checking their status explicitly.
---
plugins/smartcard/gsd-smartcard-manager.c | 61 +++++++++++++++++++++++++------
1 file changed, 49 insertions(+), 12 deletions(-)

diff --git a/plugins/smartcard/gsd-smartcard-manager.c b/plugins/smartcard/gsd-smartcard-manager.c
index a6245425..94ffdd90 100644
--- a/plugins/smartcard/gsd-smartcard-manager.c
+++ b/plugins/smartcard/gsd-smartcard-manager.c
@@ -37,64 +37,73 @@
#include <secmod.h>
#include <secerr.h>
#define GSD_SMARTCARD_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_SMARTCARD_MANAGER, GsdSmartcardManagerPrivate))
#define GSD_SESSION_MANAGER_LOGOUT_MODE_FORCE 2
struct GsdSmartcardManagerPrivate
{
guint start_idle_id;
GsdSmartcardService *service;
GList *smartcards_watch_tasks;
GCancellable *cancellable;
GsdSessionManager *session_manager;
GsdScreenSaver *screen_saver;
GSettings *settings;
NSSInitContext *nss_context;
};
#define CONF_SCHEMA "org.gnome.settings-daemon.peripherals.smartcard"
#define KEY_REMOVE_ACTION "removal-action"
static void gsd_smartcard_manager_class_init (GsdSmartcardManagerClass *klass);
static void gsd_smartcard_manager_init (GsdSmartcardManager *self);
static void gsd_smartcard_manager_finalize (GObject *object);
static void lock_screen (GsdSmartcardManager *self);
static void log_out (GsdSmartcardManager *self);
+static void on_smartcards_from_driver_watched (GsdSmartcardManager *self,
+ GAsyncResult *result,
+ GTask *task);
G_DEFINE_TYPE (GsdSmartcardManager, gsd_smartcard_manager, G_TYPE_OBJECT)
G_DEFINE_QUARK (gsd-smartcard-manager-error, gsd_smartcard_manager_error)
G_LOCK_DEFINE_STATIC (gsd_smartcards_watch_tasks);
+typedef struct {
+ SECMODModule *driver;
+ guint idle_id;
+ GError *error;
+} DriverRegistrationOperation;
+
static gpointer manager_object = NULL;
static void
gsd_smartcard_manager_class_init (GsdSmartcardManagerClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gsd_smartcard_manager_finalize;
gsd_smartcard_utils_register_error_domain (GSD_SMARTCARD_MANAGER_ERROR,
GSD_TYPE_SMARTCARD_MANAGER_ERROR);
g_type_class_add_private (klass, sizeof (GsdSmartcardManagerPrivate));
}
static void
gsd_smartcard_manager_init (GsdSmartcardManager *self)
{
self->priv = GSD_SMARTCARD_MANAGER_GET_PRIVATE (self);
}
static void
load_nss (GsdSmartcardManager *self)
{
GsdSmartcardManagerPrivate *priv = self->priv;
NSSInitContext *context = NULL;
/* The first field in the NSSInitParameters structure
* is the size of the structure. NSS requires this, so
* that it can change the size of the structure in future
* versions of NSS in a detectable way
@@ -291,135 +300,168 @@ watch_smartcards_from_driver (GTask *task,
break;
}
if (!watch_succeeded) {
g_task_return_error (task, error);
break;
}
}
}
static void
destroy_watch_smartcards_operation (WatchSmartcardsOperation *operation)
{
SECMOD_DestroyModule (operation->driver);
g_hash_table_unref (operation->smartcards);
g_free (operation);
}
static void
on_smartcards_watch_task_destroyed (GsdSmartcardManager *self,
GTask *freed_task)
{
GsdSmartcardManagerPrivate *priv = self->priv;
G_LOCK (gsd_smartcards_watch_tasks);
priv->smartcards_watch_tasks = g_list_remove (priv->smartcards_watch_tasks,
freed_task);
G_UNLOCK (gsd_smartcards_watch_tasks);
}
+static void
+sync_initial_tokens_from_driver (GsdSmartcardManager *self,
+ SECMODModule *driver,
+ GHashTable *smartcards,
+ GCancellable *cancellable)
+{
+ GsdSmartcardManagerPrivate *priv = self->priv;
+ int i;
+
+ for (i = 0; i < driver->slotCount; i++) {
+ PK11SlotInfo *card;
+
+ card = driver->slots[i];
+
+ if (PK11_IsPresent (card)) {
+ CK_SLOT_ID slot_id;
+ slot_id = PK11_GetSlotID (card);
+
+ g_debug ("Detected smartcard in slot %d at start up", (int) slot_id);
+
+ g_hash_table_replace (smartcards,
+ GINT_TO_POINTER ((int) slot_id),
+ PK11_ReferenceSlot (card));
+ gsd_smartcard_service_sync_token (priv->service, card, cancellable);
+ }
+ }
+}
+
static void
watch_smartcards_from_driver_async (GsdSmartcardManager *self,
SECMODModule *driver,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GsdSmartcardManagerPrivate *priv = self->priv;
GTask *task;
WatchSmartcardsOperation *operation;
operation = g_new0 (WatchSmartcardsOperation, 1);
operation->driver = SECMOD_ReferenceModule (driver);
operation->smartcards = g_hash_table_new_full (g_direct_hash,
g_direct_equal,
NULL,
(GDestroyNotify) PK11_FreeSlot);
task = g_task_new (self, cancellable, callback, user_data);
g_task_set_task_data (task,
operation,
(GDestroyNotify) destroy_watch_smartcards_operation);
G_LOCK (gsd_smartcards_watch_tasks);
priv->smartcards_watch_tasks = g_list_prepend (priv->smartcards_watch_tasks,
task);
g_object_weak_ref (G_OBJECT (task),
(GWeakNotify) on_smartcards_watch_task_destroyed,
self);
G_UNLOCK (gsd_smartcards_watch_tasks);
+ sync_initial_tokens_from_driver (self, driver, operation->smartcards, cancellable);
+
g_task_run_in_thread (task, (GTaskThreadFunc) watch_smartcards_from_driver);
}
static gboolean
register_driver_finish (GsdSmartcardManager *self,
GAsyncResult *result,
GError **error)
{
return g_task_propagate_boolean (G_TASK (result), error);
}
static void
on_driver_registered (GsdSmartcardManager *self,
GAsyncResult *result,
GTask *task)
{
GError *error = NULL;
+ DriverRegistrationOperation *operation;
+ GsdSmartcardManagerPrivate *priv = self->priv;
+
+ operation = g_task_get_task_data (G_TASK (result));
if (!register_driver_finish (self, result, &error)) {
g_task_return_error (task, error);
g_object_unref (task);
return;
}
- g_task_return_boolean (task, TRUE);
+ watch_smartcards_from_driver_async (self,
+ operation->driver,
+ priv->cancellable,
+ (GAsyncReadyCallback) on_smartcards_from_driver_watched,
+ task);
+ g_task_return_boolean (task, TRUE);
g_object_unref (task);
}
static void
on_smartcards_from_driver_watched (GsdSmartcardManager *self,
GAsyncResult *result,
GTask *task)
{
g_debug ("Done watching smartcards from driver");
}
-typedef struct {
- SECMODModule *driver;
- guint idle_id;
- GError *error;
-} DriverRegistrationOperation;
-
static void
destroy_driver_registration_operation (DriverRegistrationOperation *operation)
{
SECMOD_DestroyModule (operation->driver);
g_free (operation);
}
static gboolean
on_task_thread_to_complete_driver_registration (GTask *task)
{
DriverRegistrationOperation *operation;
operation = g_task_get_task_data (task);
if (operation->error != NULL)
g_task_return_error (task, operation->error);
else
g_task_return_boolean (task, TRUE);
return G_SOURCE_REMOVE;
}
static gboolean
on_main_thread_to_register_driver (GTask *task)
{
GsdSmartcardManager *self;
GsdSmartcardManagerPrivate *priv;
DriverRegistrationOperation *operation;
GSource *source;
self = g_task_get_source_object (task);
@@ -450,65 +492,60 @@ register_driver (GsdSmartcardManager *self,
task = g_task_new (self, cancellable, callback, user_data);
operation = g_new0 (DriverRegistrationOperation, 1);
operation->driver = SECMOD_ReferenceModule (driver);
g_task_set_task_data (task,
operation,
(GDestroyNotify) destroy_driver_registration_operation);
operation->idle_id = g_idle_add ((GSourceFunc) on_main_thread_to_register_driver, task);
g_source_set_name_by_id (operation->idle_id, "[gnome-settings-daemon] on_main_thread_to_register_driver");
}
static void
activate_driver (GsdSmartcardManager *self,
SECMODModule *driver,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GTask *task;
g_debug ("Activating driver '%s'", driver->commonName);
task = g_task_new (self, cancellable, callback, user_data);
register_driver (self,
driver,
cancellable,
(GAsyncReadyCallback) on_driver_registered,
task);
- watch_smartcards_from_driver_async (self,
- driver,
- cancellable,
- (GAsyncReadyCallback) on_smartcards_from_driver_watched,
- task);
}
typedef struct
{
int pending_drivers_count;
int activated_drivers_count;
} ActivateAllDriversOperation;
static gboolean
activate_driver_async_finish (GsdSmartcardManager *self,
GAsyncResult *result,
GError **error)
{
return g_task_propagate_boolean (G_TASK (result), error);
}
static void
try_to_complete_all_drivers_activation (GTask *task)
{
ActivateAllDriversOperation *operation;
operation = g_task_get_task_data (task);
if (operation->pending_drivers_count > 0)
return;
if (operation->activated_drivers_count > 0)
g_task_return_boolean (task, TRUE);
else
g_task_return_new_error (task, GSD_SMARTCARD_MANAGER_ERROR,
--
2.14.3

56
SOURCES/0002-Revert-sharing-Fix-function-arguments.patch

@ -0,0 +1,56 @@ @@ -0,0 +1,56 @@
From 12a9c6d06abcd8276612a982b98dbb757b0cd5d3 Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Wed, 11 Oct 2017 18:10:40 +0200
Subject: [PATCH 2/3] Revert "sharing: Fix function arguments"

This reverts commit 5b6b26eba58f5c3b8b5441f07f0af7a84af5cc52.
---
plugins/sharing/gsd-sharing-manager.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/plugins/sharing/gsd-sharing-manager.c b/plugins/sharing/gsd-sharing-manager.c
index a90df9a6..26663442 100644
--- a/plugins/sharing/gsd-sharing-manager.c
+++ b/plugins/sharing/gsd-sharing-manager.c
@@ -128,6 +128,7 @@ handle_unit_cb (GObject *source_object,
static void
gsd_sharing_manager_handle_service (GsdSharingManager *manager,
const char *method,
+ GAsyncReadyCallback callback,
ServiceInfo *service)
{
char *service_file;
@@ -143,8 +144,8 @@ gsd_sharing_manager_handle_service (GsdSharingManager *manager,
G_DBUS_CALL_FLAGS_NONE,
-1,
manager->priv->cancellable,
- handle_unit_cb,
- (gpointer) method);
+ callback,
+ manager);
g_free (service_file);
}
@@ -157,7 +158,8 @@ gsd_sharing_manager_start_service (GsdSharingManager *manager,
/* We use StartUnit, not StartUnitReplace, since the latter would
* cancel any pending start we already have going from an
* earlier _start_service() call */
- gsd_sharing_manager_handle_service (manager, "StartUnit", service);
+ gsd_sharing_manager_handle_service (manager, "StartUnit",
+ handle_unit_cb, "start");
}
static void
@@ -166,7 +168,8 @@ gsd_sharing_manager_stop_service (GsdSharingManager *manager,
{
g_debug ("About to stop %s", service->name);
- gsd_sharing_manager_handle_service (manager, "StopUnit", service);
+ gsd_sharing_manager_handle_service (manager, "StopUnit",
+ handle_unit_cb, "stop");
}
#ifdef HAVE_NETWORK_MANAGER
--
2.13.5

319
SOURCES/0002-account-reshow-the-notification-when-screen-unlocks.patch

@ -0,0 +1,319 @@ @@ -0,0 +1,319 @@
From a7d9b55b339aa7b6833aa377a396157fa5a23cb1 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 6 Nov 2017 15:49:58 -0500
Subject: [PATCH 2/3] account: reshow the notification when screen unlocks

---
data/Makefile.am | 1 +
plugins/account/gsd-account-manager.c | 48 +++++++++++++++++++++++++++++++----
2 files changed, 44 insertions(+), 5 deletions(-)

diff --git a/data/Makefile.am b/data/Makefile.am
index 06fd2b38..c34b7a9c 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,41 +1,42 @@
NULL =
apidir = $(includedir)/gnome-settings-daemon-$(GSD_API_VERSION)/gnome-settings-daemon
api_DATA = gsd-enums.h
gsettings_ENUM_NAMESPACE = org.gnome.settings-daemon
gsettings_ENUM_FILES = $(top_srcdir)/data/$(api_DATA)
gsettings_SCHEMAS = \
org.gnome.settings-daemon.peripherals.gschema.xml \
org.gnome.settings-daemon.plugins.gschema.xml \
+ org.gnome.settings-daemon.plugins.account.gschema.xml \
org.gnome.settings-daemon.plugins.power.gschema.xml \
org.gnome.settings-daemon.plugins.color.gschema.xml \
org.gnome.settings-daemon.plugins.media-keys.gschema.xml \
org.gnome.settings-daemon.plugins.sharing.gschema.xml \
org.gnome.settings-daemon.plugins.xsettings.gschema.xml \
org.gnome.settings-daemon.plugins.housekeeping.gschema.xml \
org.gnome.settings-daemon.peripherals.wacom.gschema.xml
@INTLTOOL_XML_NOMERGE_RULE@
@GSETTINGS_RULES@
convertdir = $(datadir)/GConf/gsettings
convert_DATA = gnome-settings-daemon.convert
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = gnome-settings-daemon.pc
@INTLTOOL_XML_NOMERGE_RULE@
EXTRA_DIST = \
$(convert_DATA) \
$(gsettings_SCHEMAS:.xml=.xml.in.in) \
$(gsettings_ENUM_FILES) \
gnome-settings-daemon.pc.in \
$(api_DATA) \
$(NULL)
DISTCLEANFILES = \
$(gsettings_SCHEMAS) \
diff --git a/plugins/account/gsd-account-manager.c b/plugins/account/gsd-account-manager.c
index 642d5bcc..948679b1 100644
--- a/plugins/account/gsd-account-manager.c
+++ b/plugins/account/gsd-account-manager.c
@@ -11,72 +11,75 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
*/
#include "config.h"
#include <sys/types.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <locale.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include <cups/cups.h>
#include <cups/ppd.h>
#include <libnotify/notify.h>
#include "gnome-settings-profile.h"
+#include "gnome-settings-bus.h"
#include "gsd-account-manager.h"
#include "org.freedesktop.Accounts.h"
#include "org.freedesktop.Accounts.User.h"
#define GSD_ACCOUNT_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_ACCOUNT_MANAGER, GsdAccountManagerPrivate))
struct GsdAccountManagerPrivate
{
GsdAccounts *accounts_proxy;
GsdAccountsUser *accounts_user_proxy;
GCancellable *cancellable;
+ GsdScreenSaver *screensaver_proxy;
+
gint64 expiration_time;
gint64 last_change_time;
gint64 min_days_between_changes;
gint64 max_days_between_changes;
gint64 days_to_warn;
gint64 days_after_expiration_until_lock;
NotifyNotification *notification;
};
static void gsd_account_manager_class_init (GsdAccountManagerClass *klass);
static void gsd_account_manager_init (GsdAccountManager *account_manager);
static void gsd_account_manager_finalize (GObject *object);
G_DEFINE_TYPE (GsdAccountManager, gsd_account_manager, G_TYPE_OBJECT)
static gpointer manager_object = NULL;
static void
on_notification_closed (NotifyNotification *notification,
gpointer user_data)
{
GsdAccountManager *manager = user_data;
g_clear_object (&manager->priv->notification);
}
static void
hide_notification (GsdAccountManager *manager)
{
@@ -221,77 +224,111 @@ on_got_password_expiration_policy (GsdAccountsUser *accounts_user_proxy,
gint64 days_after_expiration_until_lock;
gnome_settings_profile_start (NULL);
succeeded = gsd_accounts_user_call_get_password_expiration_policy_finish (accounts_user_proxy,
&expiration_time,
&last_change_time,
&min_days_between_changes,
&max_days_between_changes,
&days_to_warn,
&days_after_expiration_until_lock,
res,
&error);
if (!succeeded) {
g_warning ("Failed to get password expiration policy for user: %s", error->message);
goto out;
}
set_policy_number (&manager->priv->expiration_time, expiration_time);
set_policy_number (&manager->priv->last_change_time, last_change_time);
set_policy_number (&manager->priv->min_days_between_changes, min_days_between_changes);
set_policy_number (&manager->priv->max_days_between_changes, max_days_between_changes);
set_policy_number (&manager->priv->days_to_warn, days_to_warn);
set_policy_number (&manager->priv->days_after_expiration_until_lock, days_after_expiration_until_lock);
update_password_notification (manager);
out:
gnome_settings_profile_end (NULL);
}
+static void
+fetch_password_expiration_policy (GsdAccountManager *manager)
+{
+ gsd_accounts_user_call_get_password_expiration_policy (manager->priv->accounts_user_proxy,
+ manager->priv->cancellable,
+ (GAsyncReadyCallback)
+ on_got_password_expiration_policy,
+ manager);
+}
+
+static void
+on_screensaver_signal (GDBusProxy *proxy,
+ const gchar *sender_name,
+ const gchar *signal_name,
+ GVariant *parameters,
+ gpointer user_data)
+{
+ GsdAccountManager *manager = user_data;
+
+ if (g_strcmp0 (signal_name, "ActiveChanged") == 0) {
+ gboolean active;
+
+ g_variant_get (parameters, "(b)", &active);
+
+ if (!active) {
+ fetch_password_expiration_policy (manager);
+ }
+ }
+}
+
static void
on_got_accounts_user_proxy (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
GsdAccountManager *manager = user_data;
g_autoptr(GError) error = NULL;
gnome_settings_profile_start (NULL);
manager->priv->accounts_user_proxy = gsd_accounts_user_proxy_new_finish (res, &error);
if (manager->priv->accounts_user_proxy != NULL) {
- gsd_accounts_user_call_get_password_expiration_policy (manager->priv->accounts_user_proxy,
- manager->priv->cancellable,
- (GAsyncReadyCallback)
- on_got_password_expiration_policy,
- manager);
+ fetch_password_expiration_policy (manager);
+
+ manager->priv->screensaver_proxy = gnome_settings_bus_get_screen_saver_proxy ();
+
+ g_signal_connect (manager->priv->screensaver_proxy,
+ "g-signal",
+ G_CALLBACK (on_screensaver_signal),
+ manager);
+
} else {
g_warning ("Failed to get user proxy to accounts service: %s", error->message);
goto out;
}
out:
gnome_settings_profile_end (NULL);
}
static void
on_got_user_object_path (GsdAccounts *accounts_proxy,
GAsyncResult *res,
gpointer user_data)
{
GsdAccountManager *manager = user_data;
g_autoptr(GError) error = NULL;
gboolean succeeded;
gchar *object_path;
GDBusConnection *connection;
gnome_settings_profile_start (NULL);
succeeded = gsd_accounts_call_find_user_by_id_finish (accounts_proxy,
&object_path,
res,
&error);
if (!succeeded) {
g_warning ("Unable to find current user in accounts service: %s",
error->message);
@@ -343,60 +380,61 @@ gsd_account_manager_start (GsdAccountManager *manager,
g_debug ("Starting accounts manager");
gnome_settings_profile_start (NULL);
manager->priv->cancellable = g_cancellable_new ();
gsd_accounts_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE,
"org.freedesktop.Accounts",
"/org/freedesktop/Accounts",
manager->priv->cancellable,
(GAsyncReadyCallback)
on_got_accounts_proxy,
manager);
gnome_settings_profile_end (NULL);
return TRUE;
}
void
gsd_account_manager_stop (GsdAccountManager *manager)
{
g_debug ("Stopping accounts manager");
if (manager->priv->cancellable != NULL) {
g_cancellable_cancel (manager->priv->cancellable);
g_clear_object (&manager->priv->cancellable);
}
g_clear_object (&manager->priv->accounts_proxy);
g_clear_object (&manager->priv->accounts_user_proxy);
g_clear_object (&manager->priv->notification);
+ g_clear_object (&manager->priv->screensaver_proxy);
}
static void
gsd_account_manager_class_init (GsdAccountManagerClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gsd_account_manager_finalize;
notify_init ("gnome-settings-daemon");
g_type_class_add_private (klass, sizeof (GsdAccountManagerPrivate));
}
static void
gsd_account_manager_init (GsdAccountManager *manager)
{
manager->priv = GSD_ACCOUNT_MANAGER_GET_PRIVATE (manager);
}
static void
gsd_account_manager_finalize (GObject *object)
{
GsdAccountManager *manager;
g_return_if_fail (object != NULL);
g_return_if_fail (GSD_IS_ACCOUNT_MANAGER (object));
manager = GSD_ACCOUNT_MANAGER (object);
--
2.14.2

384
SOURCES/0002-smartcard-handle-a-smartcard-getting-removed-very-sh.patch

@ -0,0 +1,384 @@ @@ -0,0 +1,384 @@
From 492b0d048e126b690754cb3cac29eabfa608a9d9 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Fri, 9 Feb 2018 16:40:53 -0500
Subject: [PATCH 2/2] smartcard: handle a smartcard getting removed very
shortly after login

Right now we depend on the smartcard used at login time to be inserted,
at least long enough to read some basic stats about it. This
assumption, of course doesn't necessarly need to hold true. A user
could remove the smartcard immediately after login and we would
misreport that the card wasn't used for login at all.

This commit addresses that edge case by creating a login_token
smartcard alias object that's around even if the login token isn't.
Once the login token does show up it gets synchronized with it, so
both object paths refer to the same underlying token.
---
plugins/smartcard/gsd-smartcard-service.c | 82 +++++++++++++++++++++++++++++++
1 file changed, 82 insertions(+)

diff --git a/plugins/smartcard/gsd-smartcard-service.c b/plugins/smartcard/gsd-smartcard-service.c
index 0710334b..6969ff34 100644
--- a/plugins/smartcard/gsd-smartcard-service.c
+++ b/plugins/smartcard/gsd-smartcard-service.c
@@ -11,60 +11,61 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
* Authors: Ray Strode
*/
#include "config.h"
#include "gsd-smartcard-service.h"
#include "org.gnome.SettingsDaemon.Smartcard.h"
#include "gsd-smartcard-manager.h"
#include "gsd-smartcard-enum-types.h"
#include "gsd-smartcard-utils.h"
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include <gio/gio.h>
struct _GsdSmartcardServicePrivate
{
GDBusConnection *bus_connection;
GDBusObjectManagerServer *object_manager_server;
GsdSmartcardManager *smartcard_manager;
GCancellable *cancellable;
GHashTable *tokens;
+ gboolean login_token_bound;
guint name_id;
};
#define GSD_DBUS_NAME "org.gnome.SettingsDaemon"
#define GSD_DBUS_PATH "/org/gnome/SettingsDaemon"
#define GSD_DBUS_BASE_INTERFACE "org.gnome.SettingsDaemon"
#define GSD_SMARTCARD_DBUS_NAME GSD_DBUS_NAME ".Smartcard"
#define GSD_SMARTCARD_DBUS_PATH GSD_DBUS_PATH "/Smartcard"
#define GSD_SMARTCARD_MANAGER_DBUS_PATH GSD_SMARTCARD_DBUS_PATH "/Manager"
#define GSD_SMARTCARD_MANAGER_DRIVERS_DBUS_PATH GSD_SMARTCARD_MANAGER_DBUS_PATH "/Drivers"
#define GSD_SMARTCARD_MANAGER_TOKENS_DBUS_PATH GSD_SMARTCARD_MANAGER_DBUS_PATH "/Tokens"
enum {
PROP_0,
PROP_MANAGER,
PROP_BUS_CONNECTION
};
static void gsd_smartcard_service_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *param_spec);
static void gsd_smartcard_service_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *param_spec);
static void async_initable_interface_init (GAsyncInitableIface *interface);
static void smartcard_service_manager_interface_init (GsdSmartcardServiceManagerIface *interface);
@@ -83,91 +84,139 @@ set_bus_connection (GsdSmartcardService *self,
GDBusConnection *connection)
{
GsdSmartcardServicePrivate *priv = self->priv;
if (priv->bus_connection != connection) {
g_clear_object (&priv->bus_connection);
priv->bus_connection = g_object_ref (connection);
g_object_notify (G_OBJECT (self), "bus-connection");
}
}
static void
register_object_manager (GsdSmartcardService *self)
{
GsdSmartcardServiceObjectSkeleton *object;
self->priv->object_manager_server = g_dbus_object_manager_server_new (GSD_SMARTCARD_DBUS_PATH);
object = gsd_smartcard_service_object_skeleton_new (GSD_SMARTCARD_MANAGER_DBUS_PATH);
gsd_smartcard_service_object_skeleton_set_manager (object,
GSD_SMARTCARD_SERVICE_MANAGER (self));
g_dbus_object_manager_server_export (self->priv->object_manager_server,
G_DBUS_OBJECT_SKELETON (object));
g_object_unref (object);
g_dbus_object_manager_server_set_connection (self->priv->object_manager_server,
self->priv->bus_connection);
}
+static const char *
+get_login_token_object_path (GsdSmartcardService *self)
+{
+ return GSD_SMARTCARD_MANAGER_TOKENS_DBUS_PATH "/login_token";
+}
+
+static void
+register_login_token_alias (GsdSmartcardService *self)
+{
+ GsdSmartcardServicePrivate *priv;
+ GDBusObjectSkeleton *object;
+ GDBusInterfaceSkeleton *interface;
+ const char *object_path;
+ const char *token_name;
+
+ token_name = g_getenv ("PKCS11_LOGIN_TOKEN_NAME");
+
+ if (token_name == NULL)
+ return;
+
+ priv = self->priv;
+
+ object_path = get_login_token_object_path (self);
+ object = G_DBUS_OBJECT_SKELETON (gsd_smartcard_service_object_skeleton_new (object_path));
+ interface = G_DBUS_INTERFACE_SKELETON (gsd_smartcard_service_token_skeleton_new ());
+
+ g_dbus_object_skeleton_add_interface (object, interface);
+ g_object_unref (interface);
+
+ g_object_set (G_OBJECT (interface),
+ "name", token_name,
+ "used-to-login", TRUE,
+ "is-inserted", FALSE,
+ NULL);
+
+ g_dbus_object_manager_server_export (self->priv->object_manager_server,
+ object);
+
+ G_LOCK (gsd_smartcard_tokens);
+ g_hash_table_insert (priv->tokens, g_strdup (object_path), interface);
+ G_UNLOCK (gsd_smartcard_tokens);
+}
+
static void
on_bus_gotten (GObject *source_object,
GAsyncResult *result,
GTask *task)
{
GsdSmartcardService *self;
GsdSmartcardServicePrivate *priv;
GDBusConnection *connection;
GError *error = NULL;
connection = g_bus_get_finish (result, &error);
if (connection == NULL) {
g_task_return_error (task, error);
goto out;
}
g_debug ("taking name %s on session bus", GSD_SMARTCARD_DBUS_NAME);
self = g_task_get_source_object (task);
priv = self->priv;
set_bus_connection (self, connection);
register_object_manager (self);
priv->name_id = g_bus_own_name_on_connection (connection,
GSD_SMARTCARD_DBUS_NAME,
G_BUS_NAME_OWNER_FLAGS_NONE,
NULL,
NULL,
NULL,
NULL);
+
+ /* In case the login token is removed at start up, register an
+ * an alias interface that's always around
+ */
+ register_login_token_alias (self);
g_task_return_boolean (task, TRUE);
out:
g_object_unref (task);
return;
}
static gboolean
gsd_smartcard_service_initable_init_finish (GAsyncInitable *initable,
GAsyncResult *result,
GError **error)
{
GTask *task;
task = G_TASK (result);
return g_task_propagate_boolean (task, error);
}
static void
gsd_smartcard_service_initable_init_async (GAsyncInitable *initable,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GsdSmartcardService *self = GSD_SMARTCARD_SERVICE (initable);
GTask *task;
task = g_task_new (G_OBJECT (self), cancellable, callback, user_data);
@@ -191,60 +240,75 @@ get_object_path_for_token (GsdSmartcardService *self,
char *escaped_library_path;
SECMODModule *driver;
CK_SLOT_ID slot_id;
driver = PK11_GetModule (card_slot);
slot_id = PK11_GetSlotID (card_slot);
escaped_library_path = gsd_smartcard_utils_escape_object_path (driver->dllName);
object_path = g_strdup_printf ("%s/token_from_%s_slot_%lu",
GSD_SMARTCARD_MANAGER_TOKENS_DBUS_PATH,
escaped_library_path,
(gulong) slot_id);
g_free (escaped_library_path);
return object_path;
}
static gboolean
gsd_smartcard_service_handle_get_login_token (GsdSmartcardServiceManager *manager,
GDBusMethodInvocation *invocation)
{
GsdSmartcardService *self = GSD_SMARTCARD_SERVICE (manager);
GsdSmartcardServicePrivate *priv = self->priv;
PK11SlotInfo *card_slot;
char *object_path;
card_slot = gsd_smartcard_manager_get_login_token (priv->smartcard_manager);
if (card_slot == NULL) {
+ const char *login_token_object_path;
+
+ /* If we know there's a login token but it was removed before the
+ * smartcard manager could examine it, just return the generic login
+ * token object path
+ */
+ login_token_object_path = get_login_token_object_path (self);
+
+ if (g_hash_table_contains (priv->tokens, login_token_object_path)) {
+ gsd_smartcard_service_manager_complete_get_login_token (manager,
+ invocation,
+ login_token_object_path);
+ return TRUE;
+ }
+
g_dbus_method_invocation_return_error (invocation,
GSD_SMARTCARD_MANAGER_ERROR,
GSD_SMARTCARD_MANAGER_ERROR_FINDING_SMARTCARD,
_("User was not logged in with smartcard."));
return TRUE;
}
object_path = get_object_path_for_token (self, card_slot);
gsd_smartcard_service_manager_complete_get_login_token (manager,
invocation,
object_path);
g_free (object_path);
return TRUE;
}
static gboolean
gsd_smartcard_service_handle_get_inserted_tokens (GsdSmartcardServiceManager *manager,
GDBusMethodInvocation *invocation)
{
GsdSmartcardService *self = GSD_SMARTCARD_SERVICE (manager);
GsdSmartcardServicePrivate *priv = self->priv;
GList *inserted_tokens, *node;
GPtrArray *object_paths;
inserted_tokens = gsd_smartcard_manager_get_inserted_tokens (priv->smartcard_manager,
NULL);
object_paths = g_ptr_array_new ();
@@ -498,60 +562,78 @@ synchronize_token_now (GsdSmartcardService *self,
is_login_card = TRUE;
else
is_login_card = FALSE;
g_debug ("===============================");
g_debug (" Token '%s'", token_name);
g_debug (" Inserted: %s", is_present? "yes" : "no");
g_debug (" Previously used to login: %s", is_login_card? "yes" : "no");
g_debug ("===============================\n");
if (!is_present && is_login_card) {
gboolean was_present;
g_object_get (G_OBJECT (interface),
"is-inserted", &was_present,
NULL);
if (was_present)
gsd_smartcard_manager_do_remove_action (priv->smartcard_manager);
}
g_object_set (G_OBJECT (interface),
"used-to-login", is_login_card,
"is-inserted", is_present,
NULL);
g_object_get (G_OBJECT (interface),
"used-to-login", &is_login_card,
"is-inserted", &is_present,
NULL);
+ if (is_login_card && !priv->login_token_bound) {
+ const char *login_token_path;
+ GDBusInterfaceSkeleton *login_token_interface;
+
+ login_token_path = get_login_token_object_path (self);
+ login_token_interface = g_hash_table_lookup (priv->tokens, login_token_path);
+
+ if (login_token_interface != NULL) {
+ g_object_bind_property (interface, "driver",
+ login_token_interface, "driver",
+ G_BINDING_SYNC_CREATE);
+ g_object_bind_property (interface, "is-inserted",
+ login_token_interface, "is-inserted",
+ G_BINDING_SYNC_CREATE);
+ priv->login_token_bound = TRUE;
+ }
+ }
+
out:
G_UNLOCK (gsd_smartcard_tokens);
}
typedef struct
{
PK11SlotInfo *card_slot;
char *object_path;
GSource *main_thread_source;
} RegisterNewTokenOperation;
static void
destroy_register_new_token_operation (RegisterNewTokenOperation *operation)
{
g_clear_pointer (&operation->main_thread_source,
(GDestroyNotify) g_source_destroy);
PK11_FreeSlot (operation->card_slot);
g_free (operation->object_path);
g_free (operation);
}
static gboolean
on_main_thread_to_register_new_token (GTask *task)
{
GsdSmartcardService *self;
GsdSmartcardServicePrivate *priv;
GDBusObjectSkeleton *object;
GDBusInterfaceSkeleton *interface;
RegisterNewTokenOperation *operation;
SECMODModule *driver;
--
2.14.3

170
SOURCES/0003-Revert-sharing-Use-systemd-to-track-running-services.patch

@ -0,0 +1,170 @@ @@ -0,0 +1,170 @@
From dc9f7c0adc0b65aec010586e8b9848db5f0964de Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Wed, 11 Oct 2017 18:10:54 +0200
Subject: [PATCH 3/3] Revert "sharing: Use systemd to track running services"

This reverts commit e0b7f4143bdd201c824499dd09159f5890a07c6a.
---
plugins/sharing/gsd-sharing-manager.c | 114 ++++++++++++++++------------------
1 file changed, 55 insertions(+), 59 deletions(-)

diff --git a/plugins/sharing/gsd-sharing-manager.c b/plugins/sharing/gsd-sharing-manager.c
index 26663442..b24c4814 100644
--- a/plugins/sharing/gsd-sharing-manager.c
+++ b/plugins/sharing/gsd-sharing-manager.c
@@ -38,6 +38,8 @@
typedef struct {
const char *name;
GSettings *settings;
+ gboolean started;
+ GSubprocess *process;
} ServiceInfo;
struct GsdSharingManagerPrivate
@@ -104,72 +106,48 @@ static const char * const services[] = {
};
static void
-handle_unit_cb (GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+gsd_sharing_manager_start_service (GsdSharingManager *manager,
+ ServiceInfo *service)
{
+ GDesktopAppInfo *app;
+ const char *exec;
+ char *desktop, **argvp;
GError *error = NULL;
- GVariant *ret;
- const char *operation = user_data;
- ret = g_dbus_connection_call_finish (G_DBUS_CONNECTION (source_object),
- res, &error);
- if (!ret) {
- if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
- g_warning ("Failed to %s service: %s", operation, error->message);
- g_error_free (error);
+ if (service->started)
return;
- }
+ g_debug ("About to start %s", service->name);
- g_variant_unref (ret);
+ desktop = g_strdup_printf ("%s.desktop", service->name);
+ app = g_desktop_app_info_new (desktop);
+ g_free (desktop);
-}
+ if (!app) {
+ g_warning ("Could not find desktop file for service '%s'", service->name);
+ return;
+ }
-static void
-gsd_sharing_manager_handle_service (GsdSharingManager *manager,
- const char *method,
- GAsyncReadyCallback callback,
- ServiceInfo *service)
-{
- char *service_file;
-
- service_file = g_strdup_printf ("%s.service", service->name);
- g_dbus_connection_call (manager->priv->connection,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- method,
- g_variant_new ("(ss)", service_file, "replace"),
- NULL,
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- manager->priv->cancellable,
- callback,
- manager);
- g_free (service_file);
-}
+ exec = g_app_info_get_commandline (G_APP_INFO (app));
-static void
-gsd_sharing_manager_start_service (GsdSharingManager *manager,
- ServiceInfo *service)
-{
- g_debug ("About to start %s", service->name);
+ if (!g_shell_parse_argv (exec, NULL, &argvp, &error)) {
+ g_warning ("Could not parse command-line '%s': %s", exec, error->message);
+ g_error_free (error);
+ g_object_unref (app);
+ return;
+ }
- /* We use StartUnit, not StartUnitReplace, since the latter would
- * cancel any pending start we already have going from an
- * earlier _start_service() call */
- gsd_sharing_manager_handle_service (manager, "StartUnit",
- handle_unit_cb, "start");
-}
+ service->process = g_subprocess_newv ((const gchar * const*) argvp, G_SUBPROCESS_FLAGS_NONE, &error);
-static void
-gsd_sharing_manager_stop_service (GsdSharingManager *manager,
- ServiceInfo *service)
-{
- g_debug ("About to stop %s", service->name);
+ if (!service->process) {
+ g_warning ("Could not start command-line '%s': %s", exec, error->message);
+ g_error_free (error);
+ service->started = FALSE;
+ } else {
+ service->started = TRUE;
+ }
- gsd_sharing_manager_handle_service (manager, "StopUnit",
- handle_unit_cb, "stop");
+ g_strfreev (argvp);
+ g_object_unref (app);
}
#ifdef HAVE_NETWORK_MANAGER
@@ -202,6 +180,22 @@ service_is_enabled_on_current_connection (GsdSharingManager *manager,
#endif /* HAVE_NETWORK_MANAGER */
static void
+gsd_sharing_manager_stop_service (GsdSharingManager *manager,
+ ServiceInfo *service)
+{
+ if (!service->started ||
+ service->process == NULL) {
+ return;
+ }
+
+ g_debug ("About to stop %s", service->name);
+
+ g_subprocess_send_signal (service->process, SIGTERM);
+ g_clear_object (&service->process);
+ service->started = FALSE;
+}
+
+static void
gsd_sharing_manager_sync_services (GsdSharingManager *manager)
{
GList *services, *l;
@@ -216,10 +210,12 @@ gsd_sharing_manager_sync_services (GsdSharingManager *manager)
service_is_enabled_on_current_connection (manager, service))
should_be_started = TRUE;
- if (should_be_started)
- gsd_sharing_manager_start_service (manager, service);
- else
- gsd_sharing_manager_stop_service (manager, service);
+ if (service->started != should_be_started) {
+ if (service->started)
+ gsd_sharing_manager_stop_service (manager, service);
+ else
+ gsd_sharing_manager_start_service (manager, service);
+ }
}
g_list_free (services);
}
--
2.13.5

475
SOURCES/0003-account-display-nag-screen-periodically.patch

@ -0,0 +1,475 @@ @@ -0,0 +1,475 @@
From 457ca3295017c34c6805c9dd18599b760705afc5 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 6 Nov 2017 16:39:55 -0500
Subject: [PATCH 3/3] account: display nag screen periodically

This is configurable via a gsettings key.
---
configure.ac | 1 +
...ttings-daemon.plugins.account.gschema.xml.in.in | 9 ++++
plugins/account/gsd-account-manager.c | 55 ++++++++++++++++++++++
3 files changed, 65 insertions(+)
create mode 100644 data/org.gnome.settings-daemon.plugins.account.gschema.xml.in.in

diff --git a/configure.ac b/configure.ac
index 5bd742e5..ed5374db 100644
--- a/configure.ac
+++ b/configure.ac
@@ -508,60 +508,61 @@ AC_SUBST(DEBUG_CFLAGS)
AC_CONFIG_FILES([
Makefile
gnome-settings-daemon/Makefile
plugins/Makefile
plugins/a11y-keyboard/Makefile
plugins/a11y-settings/Makefile
plugins/account/Makefile
plugins/clipboard/Makefile
plugins/color/Makefile
plugins/common/Makefile
plugins/datetime/Makefile
plugins/dummy/Makefile
plugins/power/Makefile
plugins/housekeeping/Makefile
plugins/keyboard/Makefile
plugins/media-keys/Makefile
plugins/media-keys/gvc/Makefile
plugins/mouse/Makefile
plugins/print-notifications/Makefile
plugins/rfkill/Makefile
plugins/screensaver-proxy/Makefile
plugins/sharing/Makefile
plugins/smartcard/Makefile
plugins/sound/Makefile
plugins/wacom/Makefile
plugins/xsettings/Makefile
data/Makefile
data/gnome-settings-daemon.pc
data/org.gnome.settings-daemon.plugins.gschema.xml.in
+data/org.gnome.settings-daemon.plugins.account.gschema.xml.in
data/org.gnome.settings-daemon.plugins.xsettings.gschema.xml.in
data/org.gnome.settings-daemon.plugins.power.gschema.xml.in
data/org.gnome.settings-daemon.plugins.color.gschema.xml.in
data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in
data/org.gnome.settings-daemon.peripherals.gschema.xml.in
data/org.gnome.settings-daemon.plugins.housekeeping.gschema.xml.in
data/org.gnome.settings-daemon.plugins.sharing.gschema.xml.in
data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in
po/Makefile.in
tests/Makefile
])
AC_OUTPUT
dnl ---------------------------------------------------------------------------
dnl - Show summary
dnl ---------------------------------------------------------------------------
echo "
gnome-settings-daemon $VERSION
=============================
prefix: ${prefix}
exec_prefix: ${exec_prefix}
libdir: ${libdir}
bindir: ${bindir}
sbindir: ${sbindir}
sysconfdir: ${sysconfdir}
sysconfsubdir: ${sysconfsubdir}
localstatedir: ${localstatedir}
plugindir: ${plugindir}
diff --git a/data/org.gnome.settings-daemon.plugins.account.gschema.xml.in.in b/data/org.gnome.settings-daemon.plugins.account.gschema.xml.in.in
new file mode 100644
index 00000000..0b3a9d97
--- /dev/null
+++ b/data/org.gnome.settings-daemon.plugins.account.gschema.xml.in.in
@@ -0,0 +1,9 @@
+<schemalist>
+ <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.settings-daemon.plugins.account" path="/org/gnome/settings-daemon/plugins/account/">
+ <key name="notify-period" type="i">
+ <default>1440</default>
+ <_summary>Time before repeated warning about account password expiration</_summary>
+ <_description>If a user's account is expiring, a notification will get displayed periodically after the specified number of minutes</_description>
+ </key>
+ </schema>
+</schemalist>
diff --git a/plugins/account/gsd-account-manager.c b/plugins/account/gsd-account-manager.c
index 948679b1..f6db04f8 100644
--- a/plugins/account/gsd-account-manager.c
+++ b/plugins/account/gsd-account-manager.c
@@ -20,126 +20,135 @@
#include "config.h"
#include <sys/types.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <locale.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include <cups/cups.h>
#include <cups/ppd.h>
#include <libnotify/notify.h>
#include "gnome-settings-profile.h"
#include "gnome-settings-bus.h"
#include "gsd-account-manager.h"
#include "org.freedesktop.Accounts.h"
#include "org.freedesktop.Accounts.User.h"
#define GSD_ACCOUNT_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_ACCOUNT_MANAGER, GsdAccountManagerPrivate))
struct GsdAccountManagerPrivate
{
+ GSettings *settings;
+
GsdAccounts *accounts_proxy;
GsdAccountsUser *accounts_user_proxy;
GCancellable *cancellable;
GsdScreenSaver *screensaver_proxy;
gint64 expiration_time;
gint64 last_change_time;
gint64 min_days_between_changes;
gint64 max_days_between_changes;
gint64 days_to_warn;
gint64 days_after_expiration_until_lock;
NotifyNotification *notification;
+
+ gint64 last_notify_time;
+ int notify_period;
+ guint notify_period_timeout_id;
};
static void gsd_account_manager_class_init (GsdAccountManagerClass *klass);
static void gsd_account_manager_init (GsdAccountManager *account_manager);
static void gsd_account_manager_finalize (GObject *object);
+static void fetch_password_expiration_policy (GsdAccountManager *manager);
G_DEFINE_TYPE (GsdAccountManager, gsd_account_manager, G_TYPE_OBJECT)
static gpointer manager_object = NULL;
static void
on_notification_closed (NotifyNotification *notification,
gpointer user_data)
{
GsdAccountManager *manager = user_data;
g_clear_object (&manager->priv->notification);
}
static void
hide_notification (GsdAccountManager *manager)
{
if (manager->priv->notification == NULL)
return;
notify_notification_close (manager->priv->notification, NULL);
g_clear_object (&manager->priv->notification);
}
static void
show_notification (GsdAccountManager *manager,
const char *primary_text,
const char *secondary_text)
{
g_assert (manager->priv->notification == NULL);
manager->priv->notification = notify_notification_new (primary_text,
secondary_text,
"avatar-default-symbolic");
notify_notification_set_app_name (manager->priv->notification, _("User Account"));
notify_notification_set_hint (manager->priv->notification,
"resident",
g_variant_new_boolean (TRUE));
notify_notification_set_timeout (manager->priv->notification,
NOTIFY_EXPIRES_NEVER);
g_signal_connect (manager->priv->notification,
"closed",
G_CALLBACK (on_notification_closed),
manager);
notify_notification_show (manager->priv->notification, NULL);
+
+ manager->priv->last_notify_time = g_get_monotonic_time ();
}
static void
update_password_notification (GsdAccountManager *manager)
{
gint64 days_since_epoch;
gint64 days_until_expiration = -1;
gint64 days_since_last_change = -1;
gint64 days_left = -1;
g_autofree char *primary_text = NULL;
g_autofree char *secondary_text = NULL;
gboolean password_already_expired = FALSE;
hide_notification (manager);
days_since_epoch = g_get_real_time () / G_USEC_PER_SEC / 60 / 60 / 24;
if (manager->priv->expiration_time > 0) {
days_until_expiration = manager->priv->expiration_time - days_since_epoch;
if (days_until_expiration <= 0) {
password_already_expired = TRUE;
goto out;
}
}
if (manager->priv->last_change_time == 0) {
password_already_expired = TRUE;
goto out;
}
@@ -181,99 +190,127 @@ out:
primary_text = g_strdup_printf (_("Password Expired"));
secondary_text = g_strdup_printf (_("Your password is expired. Please update it."));
} else if (days_left >= 0) {
primary_text = g_strdup_printf (_("Password Expiring Soon"));
if (days_left == 0)
secondary_text = g_strdup_printf (_("Your password is expiring today."));
else if (days_left == 1)
secondary_text = g_strdup_printf (_("Your password is expiring in a day."));
else
secondary_text = g_strdup_printf (_("Your password is expiring in %ld days."),
days_left);
}
if (primary_text != NULL && secondary_text != NULL)
show_notification (manager,
primary_text,
secondary_text);
}
static gboolean
set_policy_number (gint64 *destination,
gint64 source)
{
if (*destination == source)
return FALSE;
*destination = source;
return TRUE;
}
+static gboolean
+on_notify_period_elapsed (GsdAccountManager *manager)
+{
+ manager->priv->notify_period_timeout_id = 0;
+ fetch_password_expiration_policy (manager);
+ return G_SOURCE_REMOVE;
+}
+
+static void
+queue_periodic_timeout (GsdAccountManager *manager)
+{
+ if (manager->priv->notify_period_timeout_id != 0) {
+ g_source_remove (manager->priv->notify_period_timeout_id);
+ manager->priv->notify_period_timeout_id = 0;
+ }
+
+ if (manager->priv->notify_period > 0) {
+ gint64 already_elapsed_time;
+
+ already_elapsed_time = MAX (0, (g_get_monotonic_time () - manager->priv->last_notify_time) / G_USEC_PER_SEC);
+
+ manager->priv->notify_period_timeout_id = g_timeout_add_seconds (MAX (0, manager->priv->notify_period * 60 - already_elapsed_time),
+ (GSourceFunc) on_notify_period_elapsed,
+ manager);
+ }
+}
+
static void
on_got_password_expiration_policy (GsdAccountsUser *accounts_user_proxy,
GAsyncResult *res,
gpointer user_data)
{
GsdAccountManager *manager = user_data;
g_autoptr(GError) error = NULL;
gboolean succeeded;
gint64 expiration_time;
gint64 last_change_time;
gint64 min_days_between_changes;
gint64 max_days_between_changes;
gint64 days_to_warn;
gint64 days_after_expiration_until_lock;
gnome_settings_profile_start (NULL);
succeeded = gsd_accounts_user_call_get_password_expiration_policy_finish (accounts_user_proxy,
&expiration_time,
&last_change_time,
&min_days_between_changes,
&max_days_between_changes,
&days_to_warn,
&days_after_expiration_until_lock,
res,
&error);
if (!succeeded) {
g_warning ("Failed to get password expiration policy for user: %s", error->message);
goto out;
}
set_policy_number (&manager->priv->expiration_time, expiration_time);
set_policy_number (&manager->priv->last_change_time, last_change_time);
set_policy_number (&manager->priv->min_days_between_changes, min_days_between_changes);
set_policy_number (&manager->priv->max_days_between_changes, max_days_between_changes);
set_policy_number (&manager->priv->days_to_warn, days_to_warn);
set_policy_number (&manager->priv->days_after_expiration_until_lock, days_after_expiration_until_lock);
update_password_notification (manager);
+ queue_periodic_timeout (manager);
out:
gnome_settings_profile_end (NULL);
}
static void
fetch_password_expiration_policy (GsdAccountManager *manager)
{
gsd_accounts_user_call_get_password_expiration_policy (manager->priv->accounts_user_proxy,
manager->priv->cancellable,
(GAsyncReadyCallback)
on_got_password_expiration_policy,
manager);
}
static void
on_screensaver_signal (GDBusProxy *proxy,
const gchar *sender_name,
const gchar *signal_name,
GVariant *parameters,
gpointer user_data)
{
GsdAccountManager *manager = user_data;
if (g_strcmp0 (signal_name, "ActiveChanged") == 0) {
gboolean active;
g_variant_get (parameters, "(b)", &active);
if (!active) {
fetch_password_expiration_policy (manager);
@@ -346,91 +383,109 @@ on_got_user_object_path (GsdAccounts *accounts_proxy,
manager);
out:
gnome_settings_profile_end (NULL);
}
static void
on_got_accounts_proxy (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
GsdAccountManager *manager = user_data;
g_autoptr(GError) error = NULL;
gnome_settings_profile_start (NULL);
manager->priv->accounts_proxy = gsd_accounts_proxy_new_for_bus_finish (res, &error);
if (manager->priv->accounts_proxy != NULL) {
gsd_accounts_call_find_user_by_id (manager->priv->accounts_proxy,
getuid (),
manager->priv->cancellable,
(GAsyncReadyCallback)
on_got_user_object_path,
manager);
} else {
g_warning ("Failed to get proxy to accounts service: %s", error->message);
}
gnome_settings_profile_end (NULL);
}
+static void
+on_notify_period_changed (GsdAccountManager *manager)
+{
+ manager->priv->notify_period = g_settings_get_int (manager->priv->settings, "notify-period");
+
+ queue_periodic_timeout (manager);
+}
+
gboolean
gsd_account_manager_start (GsdAccountManager *manager,
GError **error)
{
g_debug ("Starting accounts manager");
gnome_settings_profile_start (NULL);
manager->priv->cancellable = g_cancellable_new ();
+ manager->priv->settings = g_settings_new ("org.gnome.settings-daemon.plugins.account");
+
+ manager->priv->notify_period = g_settings_get_int (manager->priv->settings, "notify-period");
+ g_signal_connect_object (G_OBJECT (manager->priv->settings),
+ "changed::notify-period",
+ G_CALLBACK (on_notify_period_changed),
+ manager,
+ G_CONNECT_SWAPPED);
+
gsd_accounts_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE,
"org.freedesktop.Accounts",
"/org/freedesktop/Accounts",
manager->priv->cancellable,
(GAsyncReadyCallback)
on_got_accounts_proxy,
manager);
gnome_settings_profile_end (NULL);
return TRUE;
}
void
gsd_account_manager_stop (GsdAccountManager *manager)
{
g_debug ("Stopping accounts manager");
if (manager->priv->cancellable != NULL) {
g_cancellable_cancel (manager->priv->cancellable);
g_clear_object (&manager->priv->cancellable);
}
+ g_clear_object (&manager->priv->settings);
g_clear_object (&manager->priv->accounts_proxy);
g_clear_object (&manager->priv->accounts_user_proxy);
g_clear_object (&manager->priv->notification);
g_clear_object (&manager->priv->screensaver_proxy);
}
static void
gsd_account_manager_class_init (GsdAccountManagerClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gsd_account_manager_finalize;
notify_init ("gnome-settings-daemon");
g_type_class_add_private (klass, sizeof (GsdAccountManagerPrivate));
}
static void
gsd_account_manager_init (GsdAccountManager *manager)
{
manager->priv = GSD_ACCOUNT_MANAGER_GET_PRIVATE (manager);
}
static void
gsd_account_manager_finalize (GObject *object)
{
GsdAccountManager *manager;
g_return_if_fail (object != NULL);
--
2.14.2

1384
SPECS/gnome-settings-daemon.spec

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save