summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-12-26 03:08:15 +0100
committerLennart Poettering <lennart@poettering.net>2013-12-26 03:08:15 +0100
commitf2769777c8e8ad32b0b19cd540d2f742bda4457f (patch)
treece52d80144163a3f8271b4d38e4a187fe06d8bd9 /src/libsystemd-bus
parent442e2def7938435481eed34cd7331e34ebc8d9e0 (diff)
bus: make system bus kdbus node world-accessible
Diffstat (limited to 'src/libsystemd-bus')
-rw-r--r--src/libsystemd-bus/bus-kernel.c4
-rw-r--r--src/libsystemd-bus/bus-kernel.h4
-rw-r--r--src/libsystemd-bus/test-bus-kernel-benchmark.c2
-rw-r--r--src/libsystemd-bus/test-bus-kernel-bloom.c2
-rw-r--r--src/libsystemd-bus/test-bus-kernel.c2
-rw-r--r--src/libsystemd-bus/test-bus-zero-copy.c2
6 files changed, 9 insertions, 7 deletions
diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c
index fadb683094..d752d1fbe3 100644
--- a/src/libsystemd-bus/bus-kernel.c
+++ b/src/libsystemd-bus/bus-kernel.c
@@ -1131,7 +1131,7 @@ int kdbus_translate_attach_flags(uint64_t mask, uint64_t *kdbus_mask) {
return 0;
}
-int bus_kernel_create_bus(const char *name, char **s) {
+int bus_kernel_create_bus(const char *name, bool world, char **s) {
struct kdbus_cmd_make *make;
struct kdbus_item *n;
int fd;
@@ -1163,7 +1163,7 @@ int bus_kernel_create_bus(const char *name, char **s) {
n->type = KDBUS_ITEM_MAKE_NAME;
make->size += ALIGN8(n->size);
- make->flags = KDBUS_MAKE_POLICY_OPEN;
+ make->flags = KDBUS_MAKE_POLICY_OPEN | (world ? KDBUS_MAKE_ACCESS_WORLD : 0);
if (ioctl(fd, KDBUS_CMD_BUS_MAKE, make) < 0) {
close_nointr_nofail(fd);
diff --git a/src/libsystemd-bus/bus-kernel.h b/src/libsystemd-bus/bus-kernel.h
index 67690f8dee..2aba0bbe0a 100644
--- a/src/libsystemd-bus/bus-kernel.h
+++ b/src/libsystemd-bus/bus-kernel.h
@@ -21,6 +21,8 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <stdbool.h>
+
#include "sd-bus.h"
#define KDBUS_ITEM_NEXT(item) \
@@ -61,7 +63,7 @@ int bus_kernel_take_fd(sd_bus *b);
int bus_kernel_write_message(sd_bus *bus, sd_bus_message *m);
int bus_kernel_read_message(sd_bus *bus);
-int bus_kernel_create_bus(const char *name, char **s);
+int bus_kernel_create_bus(const char *name, bool world, char **s);
int bus_kernel_create_namespace(const char *name, char **s);
int bus_kernel_create_starter(const char *bus, const char *name);
int bus_kernel_create_monitor(const char *bus);
diff --git a/src/libsystemd-bus/test-bus-kernel-benchmark.c b/src/libsystemd-bus/test-bus-kernel-benchmark.c
index 010a161328..70f4fcd852 100644
--- a/src/libsystemd-bus/test-bus-kernel-benchmark.c
+++ b/src/libsystemd-bus/test-bus-kernel-benchmark.c
@@ -239,7 +239,7 @@ int main(int argc, char *argv[]) {
assert_se(arg_loop_usec > 0);
- bus_ref = bus_kernel_create_bus("deine-mutter", &bus_name);
+ bus_ref = bus_kernel_create_bus("deine-mutter", false, &bus_name);
if (bus_ref == -ENOENT)
exit(EXIT_TEST_SKIP);
diff --git a/src/libsystemd-bus/test-bus-kernel-bloom.c b/src/libsystemd-bus/test-bus-kernel-bloom.c
index 62983eacc8..772831bdd9 100644
--- a/src/libsystemd-bus/test-bus-kernel-bloom.c
+++ b/src/libsystemd-bus/test-bus-kernel-bloom.c
@@ -42,7 +42,7 @@ static void test_one(
sd_bus *a, *b;
int r;
- bus_ref = bus_kernel_create_bus("deine-mutter", &bus_name);
+ bus_ref = bus_kernel_create_bus("deine-mutter", false, &bus_name);
if (bus_ref == -ENOENT)
exit(EXIT_TEST_SKIP);
diff --git a/src/libsystemd-bus/test-bus-kernel.c b/src/libsystemd-bus/test-bus-kernel.c
index 8380b2c311..c78c6d42a4 100644
--- a/src/libsystemd-bus/test-bus-kernel.c
+++ b/src/libsystemd-bus/test-bus-kernel.c
@@ -42,7 +42,7 @@ int main(int argc, char *argv[]) {
log_set_max_level(LOG_DEBUG);
- bus_ref = bus_kernel_create_bus("deine-mutter", &bus_name);
+ bus_ref = bus_kernel_create_bus("deine-mutter", false, &bus_name);
if (bus_ref == -ENOENT)
return EXIT_TEST_SKIP;
diff --git a/src/libsystemd-bus/test-bus-zero-copy.c b/src/libsystemd-bus/test-bus-zero-copy.c
index 054c4c7952..dff3692246 100644
--- a/src/libsystemd-bus/test-bus-zero-copy.c
+++ b/src/libsystemd-bus/test-bus-zero-copy.c
@@ -51,7 +51,7 @@ int main(int argc, char *argv[]) {
log_set_max_level(LOG_DEBUG);
- bus_ref = bus_kernel_create_bus("deine-mutter", &bus_name);
+ bus_ref = bus_kernel_create_bus("deine-mutter", false, &bus_name);
if (bus_ref == -ENOENT)
return EXIT_TEST_SKIP;