Remove upstreamed patches

This commit is contained in:
Bastien Nocera 2017-07-10 14:39:53 +02:00
parent e70bbb43ed
commit dfc2c17363
5 changed files with 0 additions and 1106 deletions

View File

@ -1,91 +0,0 @@
From 15e00232ae29f29a5e9636ccbe0a5794b6c5b4a8 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 30 May 2017 12:46:19 -0400
Subject: [PATCH] fail-whale: handle X server dying before startup
This commit deals with gtk_init_with_args failing,
without setting an error (which it does if it can't
connect to the X server).
https://bugzilla.gnome.org/show_bug.cgi?id=775463
---
gnome-session/gsm-fail-whale-dialog.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/gnome-session/gsm-fail-whale-dialog.c b/gnome-session/gsm-fail-whale-dialog.c
index f53ce417..c5889efc 100644
--- a/gnome-session/gsm-fail-whale-dialog.c
+++ b/gnome-session/gsm-fail-whale-dialog.c
@@ -344,55 +344,62 @@ setup_window (GsmFailWhaleDialog *fail_dialog)
G_CALLBACK (on_logout_clicked), fail_dialog);
}
}
static void
gsm_fail_whale_dialog_init (GsmFailWhaleDialog *fail_dialog)
{
fail_dialog->priv = GSM_FAIL_WHALE_DIALOG_GET_PRIVATE (fail_dialog);
}
static gboolean debug_mode = FALSE;
static gboolean allow_logout = FALSE;
static gboolean extensions = FALSE;
int main (int argc, char *argv[])
{
GOptionEntry entries[] = {
{ "debug", 0, 0, G_OPTION_ARG_NONE, &debug_mode, N_("Enable debugging code"), NULL },
{ "allow-logout", 0, 0, G_OPTION_ARG_NONE, &allow_logout, N_("Allow logout"), NULL },
{ "extensions", 0, 0, G_OPTION_ARG_NONE, &extensions, N_("Show extension warning"), NULL },
{ NULL, 0, 0, 0, NULL, NULL, NULL }
};
GsmFailWhaleDialog *fail_dialog;
GError *error = NULL;
bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
- gtk_init_with_args (&argc, &argv, " - fail whale",
- entries, GETTEXT_PACKAGE,
- &error);
- if (error != NULL) {
- g_warning ("%s", error->message);
- exit (1);
- }
+ if (!gtk_init_with_args (&argc, &argv, " - fail whale",
+ entries, GETTEXT_PACKAGE,
+ &error)) {
+ if (error != NULL) {
+ g_warning ("%s", error->message);
+ exit (1);
+ }
+
+ /* display server probably went away. Could be for legitimate reasons, could be for
+ * unexpected reasons. If it went away unexpectantly, that's logged elsewhere, so
+ * let's not add noise by logging here.
+ */
+ return 0;
+ }
fail_dialog = g_object_new (GSM_TYPE_FAIL_WHALE_DIALOG, NULL);
fail_dialog->priv->debug_mode = debug_mode;
fail_dialog->priv->allow_logout = allow_logout;
fail_dialog->priv->extensions = extensions;
setup_window (fail_dialog);
g_signal_connect (fail_dialog, "destroy",
G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_show (GTK_WIDGET (fail_dialog));
gtk_main ();
return 0;
}
--
2.13.0

View File

@ -1,175 +0,0 @@
From 1e3b5a2f4c6cb65dfa94b65a84d1f6c2c9dd61fe Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 20 Jun 2017 15:32:11 -0400
Subject: [PATCH 1/3] manager: add bus daemon dbus api xml file
https://bugzilla.gnome.org/show_bug.cgi?id=764029
---
gnome-session/Makefile.am | 16 ++++++-
gnome-session/org.freedesktop.DBus.xml | 76 ++++++++++++++++++++++++++++++++++
2 files changed, 90 insertions(+), 2 deletions(-)
create mode 100644 gnome-session/org.freedesktop.DBus.xml
diff --git a/gnome-session/Makefile.am b/gnome-session/Makefile.am
index e2f81cc8..cf8fb8b0 100644
--- a/gnome-session/Makefile.am
+++ b/gnome-session/Makefile.am
@@ -165,59 +165,71 @@ org.gnome.SessionManager.ClientPrivate.h: org.gnome.SessionManager.ClientPrivate
org.gnome.SessionManager.ClientPrivate.c: org.gnome.SessionManager.ClientPrivate.h
@: # generated as a side-effect
org.gnome.SessionManager.App.h: org.gnome.SessionManager.App.xml Makefile.am
$(AM_V_GEN) gdbus-codegen --interface-prefix org.gnome.SessionManager.App. \
--generate-c-code org.gnome.SessionManager.App \
--c-namespace Gsm \
--annotate "org.gnome.SessionManager.App" "org.gtk.GDBus.C.Name" ExportedApp \
$(srcdir)/org.gnome.SessionManager.App.xml
org.gnome.SessionManager.App.c: org.gnome.SessionManager.App.h
@: # generated as a side-effect
org.gnome.SessionManager.Inhibitor.h: org.gnome.SessionManager.Inhibitor.xml Makefile.am
$(AM_V_GEN) gdbus-codegen --interface-prefix org.gnome.SessionManager.Inhibitor. \
--generate-c-code org.gnome.SessionManager.Inhibitor \
--c-namespace Gsm \
--annotate "org.gnome.SessionManager.Inhibitor" "org.gtk.GDBus.C.Name" ExportedInhibitor \
$(srcdir)/org.gnome.SessionManager.Inhibitor.xml
org.gnome.SessionManager.Inhibitor.c: org.gnome.SessionManager.Inhibitor.h
@: # generated as a side-effect
org.gnome.SessionManager.Presence.h: org.gnome.SessionManager.Presence.xml Makefile.am
$(AM_V_GEN) gdbus-codegen --interface-prefix org.gnome.SessionManager.Presence. \
--generate-c-code org.gnome.SessionManager.Presence \
--c-namespace Gsm \
--annotate "org.gnome.SessionManager.Presence" "org.gtk.GDBus.C.Name" ExportedPresence \
$(srcdir)/org.gnome.SessionManager.Presence.xml
org.gnome.SessionManager.Presence.c: org.gnome.SessionManager.Presence.h
@: # generated as a side-effect
+org.freedesktop.DBus.h org.freedesktop.DBus.c: $(srcdir)/org.freedesktop.DBus.xml Makefile.am
+ $(AM_V_GEN) gdbus-codegen --interface-prefix org.freedesktop.DBus. \
+ --generate-c-code org.freedesktop.DBus \
+ --annotate "org.freedesktop.DBus" "org.gtk.GDBus.C.Name" Bus \
+ --c-namespace Gsm \
+ $(srcdir)/org.freedesktop.DBus.xml \
+ $(NULL)
+
+
BUILT_SOURCES = \
org.gnome.SessionManager.App.h \
org.gnome.SessionManager.App.c \
org.gnome.SessionManager.Client.h \
org.gnome.SessionManager.Client.c \
org.gnome.SessionManager.ClientPrivate.h \
org.gnome.SessionManager.ClientPrivate.c \
org.gnome.SessionManager.Inhibitor.h \
org.gnome.SessionManager.Inhibitor.c \
org.gnome.SessionManager.h \
org.gnome.SessionManager.c \
org.gnome.SessionManager.Presence.h \
- org.gnome.SessionManager.Presence.c
+ org.gnome.SessionManager.Presence.c \
+ org.freedesktop.DBus.h \
+ org.freedesktop.DBus.c
EXTRA_DIST += \
README \
org.gnome.SessionManager.xml \
org.gnome.SessionManager.App.xml \
org.gnome.SessionManager.Client.xml \
org.gnome.SessionManager.ClientPrivate.xml \
org.gnome.SessionManager.Inhibitor.xml \
- org.gnome.SessionManager.Presence.xml
+ org.gnome.SessionManager.Presence.xml \
+ org.freedesktop.DBus.xml
CLEANFILES = \
gnome-session \
gnome-session.tmp \
$(BUILT_SOURCES)
-include $(top_srcdir)/git.mk
diff --git a/gnome-session/org.freedesktop.DBus.xml b/gnome-session/org.freedesktop.DBus.xml
new file mode 100644
index 00000000..515dd346
--- /dev/null
+++ b/gnome-session/org.freedesktop.DBus.xml
@@ -0,0 +1,76 @@
+<node>
+ <interface name="org.freedesktop.DBus">
+ <method name="Hello">
+ <arg direction="out" type="s" name="assigned_name"/>
+ </method>
+ <method name="RequestName">
+ <arg direction="in" type="s" name="name"/>
+ <arg direction="in" type="u" name="flags"/>
+ <arg direction="out" type="u" name="value"/>
+ </method>
+ <method name="ReleaseName">
+ <arg direction="in" type="s" name="name"/>
+ <arg direction="out" type="u" name="value"/>
+ </method>
+ <method name="StartServiceByName">
+ <arg direction="in" type="s" name="name"/>
+ <arg direction="in" type="u" name="flags"/>
+ <arg direction="out" type="u" name="value"/>
+ </method>
+ <method name="NameHasOwner">
+ <arg direction="in" type="s" name="name"/>
+ <arg direction="out" type="b" name="has_owner"/>
+ </method>
+ <method name="ListNames">
+ <arg direction="out" type="as" name="names"/>
+ </method>
+ <method name="ListActivatableNames">
+ <arg direction="out" type="as" name="activatable_names"/>
+ </method>
+ <method name="AddMatch">
+ <arg direction="in" type="s" name="rule"/>
+ </method>
+ <method name="RemoveMatch">
+ <arg direction="in" type="s" name="rule"/>
+ </method>
+ <method name="GetNameOwner">
+ <arg direction="in" type="s" name="name"/>
+ <arg direction="out" type="s" name="unique_name"/>
+ </method>
+ <method name="ListQueuedOwners">
+ <arg direction="in" type="s" name="name"/>
+ <arg direction="out" type="as" name="queued_owners"/>
+ </method>
+ <method name="GetConnectionUnixUser">
+ <arg direction="in" type="s" name="name"/>
+ <arg direction="out" type="u" name="uid"/>
+ </method>
+ <method name="GetConnectionUnixProcessID">
+ <arg direction="in" type="s" name="name"/>
+ <arg direction="out" type="u" name="pid"/>
+ </method>
+ <method name="GetConnectionSELinuxSecurityContext">
+ <arg direction="in" type="s" name="name"/>
+ <arg direction="out" type="ay" name="security_context"/>
+ </method>
+ <method name="UpdateActivationEnvironment">
+ <arg direction="in" type="a{ss}" name="environment"/>
+ </method>
+ <method name="ReloadConfig">
+ </method>
+ <method name="GetId">
+ <arg direction="out" type="s" name="unique_id"/>
+ </method>
+ <signal name="NameOwnerChanged">
+ <arg type="s" name="name"/>
+ <arg type="s" name="old_owner"/>
+ <arg type="s" name="new_owner"/>
+ </signal>
+ <signal name="NameLost">
+ <arg type="s" name="name"/>
+ </signal>
+ <signal name="NameAcquired">
+ <arg type="s" name="name"/>
+ </signal>
+ </interface>
+</node>
--
2.13.0

View File

@ -1,458 +0,0 @@
From f708bbbf2df41ea9683f7667c745d0297e584968 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 20 Jun 2017 16:51:00 -0400
Subject: [PATCH 2/3] system: add api for detecting if this is the last session
for a user
https://bugzilla.gnome.org/show_bug.cgi?id=764029
---
gnome-session/gsm-consolekit.c | 7 +++++
gnome-session/gsm-system.c | 7 +++++
gnome-session/gsm-system.h | 3 ++
gnome-session/gsm-systemd.c | 63 ++++++++++++++++++++++++++++++++++++++++++
4 files changed, 80 insertions(+)
diff --git a/gnome-session/gsm-consolekit.c b/gnome-session/gsm-consolekit.c
index 4de5c1eb..3d3891e2 100644
--- a/gnome-session/gsm-consolekit.c
+++ b/gnome-session/gsm-consolekit.c
@@ -1012,59 +1012,66 @@ gsm_consolekit_add_inhibitor (GsmSystem *system,
{
}
static void
gsm_consolekit_remove_inhibitor (GsmSystem *system,
const gchar *id)
{
}
static void
gsm_consolekit_prepare_shutdown (GsmSystem *system,
gboolean restart)
{
GsmConsolekit *consolekit = GSM_CONSOLEKIT (system);
consolekit->priv->restarting = restart;
g_signal_emit_by_name (system, "shutdown-prepared", TRUE);
}
static void
gsm_consolekit_complete_shutdown (GsmSystem *system)
{
GsmConsolekit *consolekit = GSM_CONSOLEKIT (system);
if (consolekit->priv->restarting)
gsm_consolekit_attempt_restart (system);
else
gsm_consolekit_attempt_stop (system);
}
+static gboolean
+gsm_consolekit_is_last_session_for_user (GsmSystem *system)
+{
+ return FALSE;
+}
+
static void
gsm_consolekit_system_init (GsmSystemInterface *iface)
{
iface->can_switch_user = gsm_consolekit_can_switch_user;
iface->can_stop = gsm_consolekit_can_stop;
iface->can_restart = gsm_consolekit_can_restart;
iface->can_suspend = gsm_consolekit_can_suspend;
iface->can_hibernate = gsm_consolekit_can_hibernate;
iface->attempt_stop = gsm_consolekit_attempt_stop;
iface->attempt_restart = gsm_consolekit_attempt_restart;
iface->suspend = gsm_consolekit_suspend;
iface->hibernate = gsm_consolekit_hibernate;
iface->set_session_idle = gsm_consolekit_set_session_idle;
iface->is_login_session = gsm_consolekit_is_login_session;
iface->add_inhibitor = gsm_consolekit_add_inhibitor;
iface->remove_inhibitor = gsm_consolekit_remove_inhibitor;
iface->prepare_shutdown = gsm_consolekit_prepare_shutdown;
iface->complete_shutdown = gsm_consolekit_complete_shutdown;
+ iface->is_last_session_for_user = gsm_consolekit_is_last_session_for_user;
}
GsmConsolekit *
gsm_consolekit_new (void)
{
GsmConsolekit *manager;
manager = g_object_new (GSM_TYPE_CONSOLEKIT, NULL);
return manager;
}
diff --git a/gnome-session/gsm-system.c b/gnome-session/gsm-system.c
index c24a9550..a78409d6 100644
--- a/gnome-session/gsm-system.c
+++ b/gnome-session/gsm-system.c
@@ -70,60 +70,61 @@ gsm_system_default_init (GsmSystemInterface *iface)
TRUE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
g_object_interface_install_property (iface, pspec);
}
typedef GObject GsmSystemNull;
typedef GObjectClass GsmSystemNullClass;
static void do_nothing (void) { }
static gboolean return_true (void) { return TRUE; }
static gboolean return_false (void) { return TRUE; }
static void
gsm_system_null_init_iface (GsmSystemInterface *iface)
{
iface->can_switch_user = (void *) return_false;
iface->can_stop = (void *) return_false;
iface->can_restart = (void *) return_false;
iface->can_suspend = (void *) return_false;
iface->can_hibernate = (void *) return_false;
iface->attempt_stop = (void *) do_nothing;
iface->attempt_restart = (void *) do_nothing;
iface->suspend = (void *) do_nothing;
iface->hibernate = (void *) do_nothing;
iface->set_session_idle = (void *) do_nothing;
iface->is_login_session = (void *) return_true;
iface->add_inhibitor = (void *) do_nothing;
iface->remove_inhibitor = (void *) do_nothing;
iface->prepare_shutdown = (void *) do_nothing;
iface->complete_shutdown = (void *) do_nothing;
+ iface->is_last_session_for_user = (void *) return_false;
}
static void
gsm_system_null_init (GsmSystemNull *gsn)
{
}
static void
gsm_system_null_get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec)
{
g_value_set_boolean (value, TRUE);
}
static void
gsm_system_null_class_init (GsmSystemNullClass *class)
{
class->get_property = gsm_system_null_get_property;
class->set_property = (void *) do_nothing;
g_object_class_override_property (class, 1, "active");
}
static GType gsm_system_null_get_type (void);
G_DEFINE_TYPE_WITH_CODE (GsmSystemNull, gsm_system_null, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (GSM_TYPE_SYSTEM, gsm_system_null_init_iface))
GQuark
gsm_system_error_quark (void)
{
@@ -191,60 +192,66 @@ gsm_system_hibernate (GsmSystem *system)
}
void
gsm_system_set_session_idle (GsmSystem *system,
gboolean is_idle)
{
GSM_SYSTEM_GET_IFACE (system)->set_session_idle (system, is_idle);
}
void
gsm_system_add_inhibitor (GsmSystem *system,
const gchar *id,
GsmInhibitorFlag flag)
{
GSM_SYSTEM_GET_IFACE (system)->add_inhibitor (system, id, flag);
}
void
gsm_system_remove_inhibitor (GsmSystem *system,
const gchar *id)
{
GSM_SYSTEM_GET_IFACE (system)->remove_inhibitor (system, id);
}
gboolean
gsm_system_is_login_session (GsmSystem *system)
{
return GSM_SYSTEM_GET_IFACE (system)->is_login_session (system);
}
+gboolean
+gsm_system_is_last_session_for_user (GsmSystem *system)
+{
+ return GSM_SYSTEM_GET_IFACE (system)->is_last_session_for_user (system);
+}
+
/**
* gsm_system_is_active:
*
* Returns: %TRUE if the current session is in the foreground
* Since: 3.8
*/
gboolean
gsm_system_is_active (GsmSystem *system)
{
gboolean is_active;
g_object_get ((GObject*)system, "active", &is_active, NULL);
return is_active;
}
void
gsm_system_prepare_shutdown (GsmSystem *system,
gboolean restart)
{
GSM_SYSTEM_GET_IFACE (system)->prepare_shutdown (system, restart);
}
void
gsm_system_complete_shutdown (GsmSystem *system)
{
GSM_SYSTEM_GET_IFACE (system)->complete_shutdown (system);
}
GsmSystem *
gsm_get_system (void)
{
diff --git a/gnome-session/gsm-system.h b/gnome-session/gsm-system.h
index cc1c06a0..3a34b508 100644
--- a/gnome-session/gsm-system.h
+++ b/gnome-session/gsm-system.h
@@ -43,83 +43,86 @@ typedef enum _GsmSystemError GsmSystemError;
struct _GsmSystemInterface
{
GTypeInterface base_interface;
void (* request_completed) (GsmSystem *system,
GError *error);
void (* shutdown_prepared) (GsmSystem *system,
gboolean success);
gboolean (* can_switch_user) (GsmSystem *system);
gboolean (* can_stop) (GsmSystem *system);
gboolean (* can_restart) (GsmSystem *system);
gboolean (* can_suspend) (GsmSystem *system);
gboolean (* can_hibernate) (GsmSystem *system);
void (* attempt_stop) (GsmSystem *system);
void (* attempt_restart) (GsmSystem *system);
void (* suspend) (GsmSystem *system);
void (* hibernate) (GsmSystem *system);
void (* set_session_idle) (GsmSystem *system,
gboolean is_idle);
gboolean (* is_login_session) (GsmSystem *system);
void (* add_inhibitor) (GsmSystem *system,
const gchar *id,
GsmInhibitorFlag flags);
void (* remove_inhibitor) (GsmSystem *system,
const gchar *id);
void (* prepare_shutdown) (GsmSystem *system,
gboolean restart);
void (* complete_shutdown)(GsmSystem *system);
+ gboolean (* is_last_session_for_user) (GsmSystem *system);
};
enum _GsmSystemError {
GSM_SYSTEM_ERROR_RESTARTING = 0,
GSM_SYSTEM_ERROR_STOPPING
};
GType gsm_system_get_type (void);
GQuark gsm_system_error_quark (void);
GsmSystem *gsm_get_system (void);
gboolean gsm_system_can_switch_user (GsmSystem *system);
gboolean gsm_system_can_stop (GsmSystem *system);
gboolean gsm_system_can_restart (GsmSystem *system);
gboolean gsm_system_can_suspend (GsmSystem *system);
gboolean gsm_system_can_hibernate (GsmSystem *system);
void gsm_system_attempt_stop (GsmSystem *system);
void gsm_system_attempt_restart (GsmSystem *system);
void gsm_system_suspend (GsmSystem *system);
void gsm_system_hibernate (GsmSystem *system);
void gsm_system_set_session_idle (GsmSystem *system,
gboolean is_idle);
gboolean gsm_system_is_login_session (GsmSystem *system);
+gboolean gsm_system_is_last_session_for_user (GsmSystem *system);
+
gboolean gsm_system_is_active (GsmSystem *system);
void gsm_system_add_inhibitor (GsmSystem *system,
const gchar *id,
GsmInhibitorFlag flags);
void gsm_system_remove_inhibitor (GsmSystem *system,
const gchar *id);
void gsm_system_prepare_shutdown (GsmSystem *system,
gboolean restart);
void gsm_system_complete_shutdown (GsmSystem *system);
G_END_DECLS
#endif /* __GSM_SYSTEM_H__ */
diff --git a/gnome-session/gsm-systemd.c b/gnome-session/gsm-systemd.c
index ee43bfab..f42767ad 100644
--- a/gnome-session/gsm-systemd.c
+++ b/gnome-session/gsm-systemd.c
@@ -862,78 +862,141 @@ gsm_systemd_prepare_shutdown (GsmSystem *system,
g_variant_get (res, "(h)", &idx);
systemd->priv->delay_inhibit_fd = g_unix_fd_list_get (fd_list, idx, NULL);
g_debug ("GsmSystemd: got delay inhibitor, fd = %d", systemd->priv->delay_inhibit_fd);
g_variant_unref (res);
g_object_unref (fd_list);
systemd->priv->prepare_for_shutdown_expected = TRUE;
g_dbus_proxy_call (systemd->priv->sd_proxy,
restart ? "Reboot" : "PowerOff",
g_variant_new ("(b)", TRUE),
0,
G_MAXINT,
NULL,
reboot_or_poweroff_done,
systemd);
}
static void
gsm_systemd_complete_shutdown (GsmSystem *system)
{
GsmSystemd *systemd = GSM_SYSTEMD (system);
/* remove delay inhibitor, if any */
drop_delay_inhibitor (systemd);
}
+static gboolean
+gsm_systemd_is_last_session_for_user (GsmSystem *system)
+{
+ char **sessions = NULL;
+ char *session = NULL;
+ gboolean is_last_session;
+ int ret, i;
+
+ ret = sd_pid_get_session (getpid (), &session);
+
+ if (ret != 0) {
+ return FALSE;
+ }
+
+ ret = sd_uid_get_sessions (getuid (), FALSE, &sessions);
+
+ if (ret <= 0) {
+ free (session);
+ return FALSE;
+ }
+
+ is_last_session = TRUE;
+ for (i = 0; sessions[i]; i++) {
+ char *state = NULL;
+ char *type = NULL;
+
+ if (g_strcmp0 (sessions[i], session) == 0)
+ continue;
+
+ ret = sd_session_get_state (sessions[i], &state);
+
+ if (ret != 0)
+ continue;
+
+ if (g_strcmp0 (state, "closing") == 0) {
+ free (state);
+ continue;
+ }
+ free (state);
+
+ ret = sd_session_get_type (sessions[i], &type);
+
+ if (ret != 0)
+ continue;
+
+ if (g_strcmp0 (type, "x11") != 0 &&
+ g_strcmp0 (type, "wayland") != 0) {
+ free (type);
+ continue;
+ }
+
+ is_last_session = FALSE;
+ }
+
+ for (i = 0; sessions[i]; i++)
+ free (sessions[i]);
+ free (sessions);
+ free (session);
+
+ return is_last_session;
+}
+
static void
gsm_systemd_system_init (GsmSystemInterface *iface)
{
iface->can_switch_user = gsm_systemd_can_switch_user;
iface->can_stop = gsm_systemd_can_stop;
iface->can_restart = gsm_systemd_can_restart;
iface->can_suspend = gsm_systemd_can_suspend;
iface->can_hibernate = gsm_systemd_can_hibernate;
iface->attempt_stop = gsm_systemd_attempt_stop;
iface->attempt_restart = gsm_systemd_attempt_restart;
iface->suspend = gsm_systemd_suspend;
iface->hibernate = gsm_systemd_hibernate;
iface->set_session_idle = gsm_systemd_set_session_idle;
iface->is_login_session = gsm_systemd_is_login_session;
iface->add_inhibitor = gsm_systemd_add_inhibitor;
iface->remove_inhibitor = gsm_systemd_remove_inhibitor;
iface->prepare_shutdown = gsm_systemd_prepare_shutdown;
iface->complete_shutdown = gsm_systemd_complete_shutdown;
+ iface->is_last_session_for_user = gsm_systemd_is_last_session_for_user;
}
GsmSystemd *
gsm_systemd_new (void)
{
GsmSystemd *manager;
/* logind is not running ? */
if (access("/run/systemd/seats/", F_OK) < 0)
return NULL;
manager = g_object_new (GSM_TYPE_SYSTEMD, NULL);
return manager;
}
static void
sd_proxy_signal_cb (GDBusProxy *proxy,
const gchar *sender_name,
const gchar *signal_name,
GVariant *parameters,
gpointer user_data)
{
GsmSystemd *systemd = user_data;
gboolean is_about_to_shutdown;
g_debug ("GsmSystemd: received logind signal: %s", signal_name);
if (g_strcmp0 (signal_name, "PrepareForShutdown") != 0) {
g_debug ("GsmSystemd: ignoring %s signal", signal_name);
--
2.13.0

View File

@ -1,374 +0,0 @@
From e7a650b88b92c3381eccef7bf4765fa814389aaa Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 20 Jun 2017 16:28:10 -0400
Subject: [PATCH 3/3] manager: kill off bus clients at log out
https://bugzilla.gnome.org/show_bug.cgi?id=764029
---
gnome-session/gsm-manager.c | 104 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 104 insertions(+)
diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
index 012f3d3f..3aa6863b 100644
--- a/gnome-session/gsm-manager.c
+++ b/gnome-session/gsm-manager.c
@@ -12,60 +12,61 @@
* This program is distributed in the hope that it will be useful,
* 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 <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
#include <locale.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include <glib-object.h>
#include <gio/gio.h>
#include "gsm-manager.h"
#include "org.gnome.SessionManager.h"
+#include "org.freedesktop.DBus.h"
#ifdef HAVE_SYSTEMD
#include <systemd/sd-journal.h>
#endif
#include "gsm-store.h"
#include "gsm-inhibitor.h"
#include "gsm-presence.h"
#include "gsm-shell.h"
#include "gsm-xsmp-server.h"
#include "gsm-xsmp-client.h"
#include "gsm-dbus-client.h"
#include "gsm-autostart-app.h"
#include "gsm-util.h"
#include "gsm-icon-names.h"
#include "gsm-system.h"
#include "gsm-session-save.h"
#include "gsm-shell-extensions.h"
#include "gsm-fail-whale.h"
#define GSM_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSM_TYPE_MANAGER, GsmManagerPrivate))
/* UUIDs for log messages */
#define GSM_MANAGER_STARTUP_SUCCEEDED_MSGID "0ce153587afa4095832d233c17a88001"
#define GSM_MANAGER_UNRECOVERABLE_FAILURE_MSGID "10dd2dc188b54a5e98970f56499d1f73"
#define GSM_MANAGER_DBUS_PATH "/org/gnome/SessionManager"
@@ -129,60 +130,61 @@ struct GsmManagerPrivate
/* Current status */
GsmManagerPhase phase;
guint phase_timeout_id;
GSList *required_apps;
GSList *pending_apps;
GsmManagerLogoutMode logout_mode;
GSList *query_clients;
guint query_timeout_id;
/* This is used for GSM_MANAGER_PHASE_END_SESSION only at the moment,
* since it uses a sublist of all running client that replied in a
* specific way */
GSList *next_query_clients;
/* This is the action that will be done just before we exit */
GsmManagerLogoutType logout_type;
/* List of clients which were disconnected due to disabled condition
* and shouldn't be automatically restarted */
GSList *condition_clients;
GSList *pending_end_session_tasks;
GCancellable *end_session_cancellable;
GSettings *settings;
GSettings *session_settings;
GSettings *screensaver_settings;
GSettings *lockdown_settings;
GsmSystem *system;
GDBusConnection *connection;
+ GsmBus *bus_proxy;
GsmExportedManager *skeleton;
gboolean dbus_disconnected : 1;
GsmShell *shell;
guint shell_end_session_dialog_canceled_id;
guint shell_end_session_dialog_open_failed_id;
guint shell_end_session_dialog_confirmed_logout_id;
guint shell_end_session_dialog_confirmed_shutdown_id;
guint shell_end_session_dialog_confirmed_reboot_id;
};
enum {
PROP_0,
PROP_CLIENT_STORE,
PROP_SESSION_NAME,
PROP_FALLBACK,
PROP_FAILSAFE
};
enum {
PHASE_CHANGED,
LAST_SIGNAL
};
static guint signals [LAST_SIGNAL] = { 0 };
static void gsm_manager_class_init (GsmManagerClass *klass);
static void gsm_manager_init (GsmManager *manager);
static gboolean auto_save_is_enabled (GsmManager *manager);
@@ -908,69 +910,157 @@ do_phase_end_session_part_2 (GsmManager *manager)
&data);
g_slist_free (manager->priv->next_query_clients);
manager->priv->next_query_clients = NULL;
} else {
end_phase (manager);
}
}
static gboolean
_client_stop (const char *id,
GsmClient *client,
gpointer user_data)
{
gboolean ret;
GError *error;
error = NULL;
ret = gsm_client_stop (client, &error);
if (! ret) {
g_warning ("Unable to stop client: %s", error->message);
g_error_free (error);
/* FIXME: what should we do if we can't communicate with client? */
} else {
g_debug ("GsmManager: stopped client: %s", gsm_client_peek_id (client));
}
return FALSE;
}
+static GPid *
+get_pids_for_bus_clients (GsmManager *manager,
+ const char * const *bus_clients)
+{
+ GHashTable *process_id_hash;
+ GHashTableIter iter;
+ gpointer key, value;
+ GPid *process_ids;
+ int i, j;
+
+ process_id_hash = g_hash_table_new (NULL, NULL);
+
+ for (i = 0; bus_clients[i] != NULL; i++) {
+ gboolean ret;
+ GError *error;
+ guint pid;
+
+ error = NULL;
+ ret = gsm_bus_call_get_connection_unix_process_id_sync (manager->priv->bus_proxy,
+ bus_clients[i],
+ &pid,
+ NULL,
+ &error);
+
+ if (! ret) {
+ g_debug ("GsmManager: couldn't get process id of client '%s': %s",
+ bus_clients[i], error->message);
+ g_error_free (error);
+ continue;
+ }
+
+ g_hash_table_add (process_id_hash, GUINT_TO_POINTER (pid));
+ }
+
+ j = 0;
+ process_ids = g_new0 (GPid, g_hash_table_size (process_id_hash) + 1);
+ g_hash_table_iter_init (&iter, process_id_hash);
+ while (g_hash_table_iter_next (&iter, &key, &value)) {
+ process_ids[j++] = (GPid) GPOINTER_TO_UINT (key);
+ }
+
+ g_hash_table_unref (process_id_hash);
+
+ return process_ids;
+}
+
+static void
+maybe_kill_bus_clients (GsmManager *manager)
+{
+ GsmSystem *system;
+ gboolean ret;
+ GError *error;
+ GPid *process_ids;
+ char **bus_clients;
+ int i;
+
+ if (manager->priv->dbus_disconnected)
+ return;
+
+ system = gsm_get_system ();
+
+ if (!gsm_system_is_last_session_for_user (system))
+ return;
+
+ error = NULL;
+ ret = gsm_bus_call_list_names_sync (manager->priv->bus_proxy,
+ &bus_clients,
+ NULL,
+ &error);
+
+ if (! ret) {
+ g_warning ("Unable to list bus clients: %s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ process_ids = get_pids_for_bus_clients (manager, (const char * const *) bus_clients);
+ g_strfreev (bus_clients);
+
+ for (i = 0; process_ids[i] != 0; i++) {
+ kill (process_ids[i], SIGTERM);
+ }
+
+ g_free (process_ids);
+}
+
static void
do_phase_exit (GsmManager *manager)
{
if (gsm_store_size (manager->priv->clients) > 0) {
gsm_store_foreach (manager->priv->clients,
(GsmStoreFunc)_client_stop,
NULL);
}
+ maybe_kill_bus_clients (manager);
+
end_phase (manager);
}
static gboolean
_client_query_end_session (const char *id,
GsmClient *client,
ClientEndSessionData *data)
{
gboolean ret;
GError *error;
error = NULL;
ret = gsm_client_query_end_session (client, data->flags, &error);
if (! ret) {
g_warning ("Unable to query client: %s", error->message);
g_error_free (error);
/* FIXME: what should we do if we can't communicate with client? */
} else {
g_debug ("GsmManager: adding client to query clients: %s", gsm_client_peek_id (client));
data->manager->priv->query_clients = g_slist_prepend (data->manager->priv->query_clients,
client);
}
return FALSE;
}
static gboolean
inhibitor_has_flag (gpointer key,
GsmInhibitor *inhibitor,
gpointer data)
@@ -3047,60 +3137,74 @@ static void
on_session_connection_closed (GDBusConnection *connection,
gboolean remote_peer_vanished,
GError *error,
gpointer user_data)
{
GsmManager *manager;
manager = GSM_MANAGER (user_data);
g_debug ("GsmManager: dbus disconnected; disconnecting dbus clients...");
manager->priv->dbus_disconnected = TRUE;
remove_clients_for_connection (manager, NULL);
}
static gboolean
register_manager (GsmManager *manager)
{
GDBusConnection *connection;
GsmExportedManager *skeleton;
GError *error = NULL;
connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
if (error != NULL) {
g_critical ("error getting session bus: %s", error->message);
g_error_free (error);
exit (1);
}
+ manager->priv->bus_proxy = gsm_bus_proxy_new_sync (connection,
+ G_DBUS_PROXY_FLAGS_NONE,
+ "org.freedesktop.DBus",
+ "/org/freedesktop/DBus",
+ NULL,
+ &error);
+
+ if (error != NULL) {
+ g_critical ("error getting proxy to bus daemon: %s", error->message);
+ g_error_free (error);
+
+ exit (1);
+ }
+
skeleton = gsm_exported_manager_skeleton_new ();
g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (skeleton),
connection,
GSM_MANAGER_DBUS_PATH, &error);
if (error != NULL) {
g_critical ("error exporting manager on session bus: %s", error->message);
g_error_free (error);
exit (1);
}
g_signal_connect (skeleton, "handle-can-shutdown",
G_CALLBACK (gsm_manager_can_shutdown), manager);
g_signal_connect (skeleton, "handle-get-clients",
G_CALLBACK (gsm_manager_get_clients), manager);
g_signal_connect (skeleton, "handle-get-inhibitors",
G_CALLBACK (gsm_manager_get_inhibitors), manager);
g_signal_connect (skeleton, "handle-get-locale",
G_CALLBACK (gsm_manager_get_locale), manager);
g_signal_connect (skeleton, "handle-inhibit",
G_CALLBACK (gsm_manager_inhibit), manager);
g_signal_connect (skeleton, "handle-initialization-error",
G_CALLBACK (gsm_manager_initialization_error), manager);
g_signal_connect (skeleton, "handle-is-autostart-condition-handled",
G_CALLBACK (gsm_manager_is_autostart_condition_handled), manager);
g_signal_connect (skeleton, "handle-is-inhibited",
G_CALLBACK (gsm_manager_is_inhibited), manager);
g_signal_connect (skeleton, "handle-is-session-running",
G_CALLBACK (gsm_manager_is_session_running), manager);
--
2.13.0

View File

@ -22,14 +22,6 @@ Patch3: gnome-session-3.6.2-swrast.patch
# https://bugzilla.gnome.org/show_bug.cgi?id=772421
Patch4: 0001-check-accelerated-gles-Use-eglGetPlatformDisplay-EXT.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1340203
Patch5: 0001-manager-add-bus-daemon-dbus-api-xml-file.patch
Patch6: 0002-system-add-api-for-detecting-if-this-is-the-last-ses.patch
Patch7: 0003-manager-kill-off-bus-clients-at-log-out.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1384508
Patch8: 0001-fail-whale-handle-X-server-dying-before-startup.patch
# Patches in 3.25.3+
Patch9: 0001-Fix-use-of-uninitialised-variable-in-get_session_key.patch
Patch10: 0002-Fix-use-after-free-in-initialize_gio.patch