summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-12-12 00:07:49 +0100
committerLennart Poettering <lennart@poettering.net>2013-12-12 00:07:49 +0100
commit9e5548644f76e893c246d54ae613856b67b8dc1d (patch)
treea176be2a121a95bd4f30293252c82537e7c27bb6 /src/libsystemd-bus
parentba276c8153e510a6741dc8a9492f5bed2b375825 (diff)
bus: connect directly via kdbus in sd_bus_open_system_container()
kdbus fortunately exposes the container's busses in the host fs, hence we can access it directly instead of doing the namespacing dance.
Diffstat (limited to 'src/libsystemd-bus')
-rw-r--r--src/libsystemd-bus/sd-bus.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
index f991a09279..edd917e303 100644
--- a/src/libsystemd-bus/sd-bus.c
+++ b/src/libsystemd-bus/sd-bus.c
@@ -1142,12 +1142,17 @@ _public_ int sd_bus_open_system_container(const char *machine, sd_bus **ret) {
assert_return(machine, -EINVAL);
assert_return(ret, -EINVAL);
+ assert_return(filename_is_safe(machine), -EINVAL);
e = bus_address_escape(machine);
if (!e)
return -ENOMEM;
+#ifdef ENABLE_KDBUS
+ p = strjoin("kernel:path=/dev/kdbus/ns/machine-", e, "/0-system/bus;x-container:machine=", e, NULL);
+#else
p = strjoin("x-container:machine=", e, NULL);
+#endif
if (!p)
return -ENOMEM;