[gnome-packagekit] Properly call polkit and dbus for reboot
- From: Frédéric Crozat <fcrozat src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-packagekit] Properly call polkit and dbus for reboot
- Date: Tue, 19 Aug 2014 16:42:35 +0000 (UTC)
commit 62645dad953b33676908f78ef959c3a53ff9b636
Author: Frederic Crozat <fcrozat suse com>
Date: Tue Aug 19 18:37:09 2014 +0200
Properly call polkit and dbus for reboot
Polkit subject was incorrect and could cause polkitd to crash (fdo#53905).
Reboot call on logind through dbus should be sync, otherwise it is not
done at all. Those issues were initially found and fixed by Evangelos Foutras
in xfce4-session systemd proxy code
(https://bugzilla.xfce.org/show_bug.cgi?id=8729)
Fixes https://bugzilla.novell.com/show_bug.cgi?id=881221
src/systemd-proxy.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/src/systemd-proxy.c b/src/systemd-proxy.c
index 50fec25..adad6fe 100644
--- a/src/systemd-proxy.c
+++ b/src/systemd-proxy.c
@@ -44,7 +44,7 @@ systemd_proxy_new (void)
proxy = g_new0 (SystemdProxy, 1);
proxy->authority = polkit_authority_get_sync (NULL, NULL);
- proxy->subject = polkit_unix_session_new_for_process_sync (getpid(), NULL, NULL);
+ proxy->subject = polkit_unix_process_new_for_owner(getpid(), 0, -1);
return proxy;
}
@@ -71,7 +71,7 @@ systemd_proxy_can_restart (SystemdProxy *proxy,
proxy->subject,
SYSTEMD_REBOOT_ACTION,
NULL,
- POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE,
+
POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
NULL,
&local_error);
if (res == NULL) {
@@ -94,13 +94,13 @@ systemd_proxy_restart (SystemdProxy *proxy,
GDBusConnection *bus;
bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL);
- g_dbus_connection_call (bus,
- SYSTEMD_DBUS_NAME,
- SYSTEMD_DBUS_PATH,
- SYSTEMD_DBUS_INTERFACE,
- "Reboot",
- g_variant_new ("(b)", TRUE),
- NULL, 0, G_MAXINT, NULL, NULL, NULL);
+ g_dbus_connection_call_sync (bus,
+ SYSTEMD_DBUS_NAME,
+ SYSTEMD_DBUS_PATH,
+ SYSTEMD_DBUS_INTERFACE,
+ "Reboot",
+ g_variant_new ("(b)", TRUE),
+ NULL, 0, G_MAXINT, NULL, NULL);
g_object_unref (bus);
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]