summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/sd-bus.c
diff options
context:
space:
mode:
authorDaniel Mack <zonque@gmail.com>2013-11-29 17:21:39 +0100
committerDaniel Mack <zonque@gmail.com>2013-11-29 22:01:34 +0100
commit87b522ae1936c4da9446ee2e05f7b4560ad549cd (patch)
tree7685695aeda7edc92b41791cf61b6c6611f11dde /src/libsystemd-bus/sd-bus.c
parentc931748d20ba75e062b6198721970c6871bf23da (diff)
libsystemd-bus: add sd_bus_translate_attach_flags()
Factor out code from sd_bus_negotiate_attach_creds() to a generic translate function, so it can be used from other places.
Diffstat (limited to 'src/libsystemd-bus/sd-bus.c')
-rw-r--r--src/libsystemd-bus/sd-bus.c28
1 files changed, 1 insertions, 27 deletions
diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
index bfa6ba4dd6..a894af0851 100644
--- a/src/libsystemd-bus/sd-bus.c
+++ b/src/libsystemd-bus/sd-bus.c
@@ -290,33 +290,7 @@ _public_ int sd_bus_negotiate_attach_creds(sd_bus *bus, uint64_t mask) {
assert_return(bus->state == BUS_UNSET, -EPERM);
assert_return(!bus_pid_changed(bus), -ECHILD);
- SET_FLAG(bus->attach_flags, KDBUS_ATTACH_CREDS,
- !!(mask & (SD_BUS_CREDS_UID|SD_BUS_CREDS_GID|SD_BUS_CREDS_PID|SD_BUS_CREDS_PID_STARTTIME|SD_BUS_CREDS_TID)));
-
- SET_FLAG(bus->attach_flags, KDBUS_ATTACH_COMM,
- !!(mask & (SD_BUS_CREDS_COMM|SD_BUS_CREDS_TID_COMM)));
-
- SET_FLAG(bus->attach_flags, KDBUS_ATTACH_EXE,
- !!(mask & SD_BUS_CREDS_EXE));
-
- SET_FLAG(bus->attach_flags, KDBUS_ATTACH_CMDLINE,
- !!(mask & SD_BUS_CREDS_CMDLINE));
-
- SET_FLAG(bus->attach_flags, KDBUS_ATTACH_CGROUP,
- !!(mask & (SD_BUS_CREDS_CGROUP|SD_BUS_CREDS_UNIT|SD_BUS_CREDS_USER_UNIT|SD_BUS_CREDS_SLICE|SD_BUS_CREDS_SESSION|SD_BUS_CREDS_OWNER_UID)));
-
- SET_FLAG(bus->attach_flags, KDBUS_ATTACH_CAPS,
- !!(mask & (SD_BUS_CREDS_EFFECTIVE_CAPS|SD_BUS_CREDS_PERMITTED_CAPS|SD_BUS_CREDS_INHERITABLE_CAPS|SD_BUS_CREDS_BOUNDING_CAPS)));
-
- SET_FLAG(bus->attach_flags, KDBUS_ATTACH_SECLABEL,
- !!(mask & SD_BUS_CREDS_SELINUX_CONTEXT));
-
- SET_FLAG(bus->attach_flags, KDBUS_ATTACH_AUDIT,
- !!(mask & (SD_BUS_CREDS_AUDIT_SESSION_ID|SD_BUS_CREDS_AUDIT_LOGIN_UID)));
-
- bus->creds_mask = mask;
-
- return 0;
+ return kdbus_translate_attach_flags(mask, &bus->creds_mask);
}
_public_ int sd_bus_set_server(sd_bus *bus, int b, sd_id128_t server_id) {