summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormsizanoen1 <msizanoen@qtmlabs.xyz>2022-10-21 21:52:19 +0700
committermsizanoen1 <msizanoen@qtmlabs.xyz>2022-10-21 22:08:11 +0700
commitc0a1a3b384a27b4b18628174a5c4d9f3fb0a8c82 (patch)
treedac0dd77eb62a7d3089b9f678540ae21befd8445
parent86430a27d26b9b72b02ff0b81eeaa5df0525646c (diff)
downloadglib-c0a1a3b384a27b4b18628174a5c4d9f3fb0a8c82.tar.gz
gio/gdbusserver: use non-abstract socket for unix:tmpdir=
This implements https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/350 for GDBus's server implementation. Abstract sockets belong to the network namespace instead of the mount namespace. As a result, mount namespace-based sandboxes (e.g. Flatpak) cannot restrict access to abstract sockets (and therefore GDBus's unix:tmpdir= server addresses), at least for applications with network access permission, which may result in sandbox escapes unless the application running the GDBus server explicitly check that the connecting process is not in a sandbox. As of the time of writing, no known applications using GDBusServer does this. Fix this by always using non-abstract sockets for unix:tmpdir=, which is allowed by the DBus specification.
-rw-r--r--gio/gdbusserver.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/gio/gdbusserver.c b/gio/gdbusserver.c
index f144d129a..db0c9ab50 100644
--- a/gio/gdbusserver.c
+++ b/gio/gdbusserver.c
@@ -725,14 +725,7 @@ try_unix (GDBusServer *server,
for (n = 0; n < 8; n++)
g_string_append_c (s, random_ascii ());
- /* prefer abstract namespace if available for tmpdir: addresses
- * abstract namespace is disallowed for dir: addresses */
- if (tmpdir != NULL && g_unix_socket_address_abstract_names_supported ())
- address = g_unix_socket_address_new_with_type (s->str,
- -1,
- G_UNIX_SOCKET_ADDRESS_ABSTRACT);
- else
- address = g_unix_socket_address_new (s->str);
+ address = g_unix_socket_address_new (s->str);
g_string_free (s, TRUE);
local_error = NULL;