mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-23 17:34:00 +03:00
bus: make system bus kdbus node world-accessible
This commit is contained in:
parent
442e2def79
commit
f2769777c8
@ -542,7 +542,7 @@ static int manager_setup_kdbus(Manager *m) {
|
||||
if (m->running_as == SYSTEMD_USER && getenv("DBUS_SESSION_BUS_ADDRESS"))
|
||||
return 0;
|
||||
|
||||
m->kdbus_fd = bus_kernel_create_bus(m->running_as == SYSTEMD_SYSTEM ? "system" : "user", &p);
|
||||
m->kdbus_fd = bus_kernel_create_bus(m->running_as == SYSTEMD_SYSTEM ? "system" : "user", m->running_as == SYSTEMD_SYSTEM, &p);
|
||||
if (m->kdbus_fd < 0) {
|
||||
log_debug("Failed to set up kdbus: %s", strerror(-m->kdbus_fd));
|
||||
return m->kdbus_fd;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user