kdbus fortunately exposes the container's busses in the host fs, hence
we can access it directly instead of doing the namespacing dance.
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;
_cleanup_close_pipe_ int kmsg_socket_pair[2] = { -1, -1 };
_cleanup_fdset_free_ FDSet *fds = NULL;
_cleanup_free_ char *kdbus_namespace = NULL;
+ const char *ns;
log_parse_environment();
log_open();
goto finish;
}
- kdbus_fd = bus_kernel_create_namespace(arg_machine, &kdbus_namespace);
+ ns = strappenda("machine-", arg_machine);
+ kdbus_fd = bus_kernel_create_namespace(ns, &kdbus_namespace);
if (r < 0)
log_debug("Failed to create kdbus namespace: %s", strerror(-r));
else