diff options
author | Simon McVittie <smcv@collabora.com> | 2019-07-01 12:39:50 +0100 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2019-07-11 18:11:21 +0000 |
commit | 75b5b7c76357f7f0fa6465dc49359cee62e9cd87 (patch) | |
tree | 638a5a9c0caffc687df583d4d7c8eca3cf864045 | |
parent | f1b8a4275fba160e9a2b759e2e3284d093d9cca1 (diff) | |
download | flatpak-75b5b7c76357f7f0fa6465dc49359cee62e9cd87.tar.gz |
Don't register polkit agent if we cannot connect to system bus
This works around an old polkit client library bug which would cause
a segfault in this situation. The bug was fixed long ago in upstream
polkit, but is still present in Debian 10 'buster', Ubuntu 19.04 'disco'
and all older releases, due to Debian/Ubuntu using a branch of polkit
to avoid the mozjs dependency. It should finally get fixed in Debian 11
and Ubuntu 19.10.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug-Debian: https://bugs.debian.org/923046
Closes: #2997
Approved by: matthiasclasen
-rw-r--r-- | app/flatpak-main.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/flatpak-main.c b/app/flatpak-main.c index e0d5937b..451583b3 100644 --- a/app/flatpak-main.c +++ b/app/flatpak-main.c @@ -554,6 +554,15 @@ install_polkit_agent (void) #ifdef USE_SYSTEM_HELPER PolkitAgentListener *listener = NULL; g_autoptr(GError) local_error = NULL; + g_autoptr(GDBusConnection) bus = NULL; + + bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); + + if (bus == NULL) + { + g_debug ("Unable to connect to system bus: %s", local_error->message); + return NULL; + } /* Install a polkit agent as fallback, in case we're running on a console */ listener = flatpak_polkit_agent_text_listener_new (NULL, &local_error); |