chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bus: support temporarily const errors that don't need to be freed but require deep...
[elogind.git]
/
src
/
libsystemd-bus
/
sd-bus.c
diff --git
a/src/libsystemd-bus/sd-bus.c
b/src/libsystemd-bus/sd-bus.c
index 0d5deb6c6deb1f88855a9e00c014c1e4f2d9c373..e224be7056c9a8281b0c24307deeaa07235c01cc 100644
(file)
--- a/
src/libsystemd-bus/sd-bus.c
+++ b/
src/libsystemd-bus/sd-bus.c
@@
-181,6
+181,7
@@
_public_ int sd_bus_new(sd_bus **ret) {
r->n_ref = REFCNT_INIT;
r->input_fd = r->output_fd = -1;
r->message_version = 1;
r->n_ref = REFCNT_INIT;
r->input_fd = r->output_fd = -1;
r->message_version = 1;
+ r->creds_mask |= SD_BUS_CREDS_WELL_KNOWN_NAMES|SD_BUS_CREDS_UNIQUE_NAME;
r->hello_flags |= KDBUS_HELLO_ACCEPT_FD;
r->attach_flags |= KDBUS_ATTACH_NAMES;
r->original_pid = getpid();
r->hello_flags |= KDBUS_HELLO_ACCEPT_FD;
r->attach_flags |= KDBUS_ATTACH_NAMES;
r->original_pid = getpid();
@@
-290,7
+291,10
@@
_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);
assert_return(bus->state == BUS_UNSET, -EPERM);
assert_return(!bus_pid_changed(bus), -ECHILD);
- return kdbus_translate_attach_flags(mask, &bus->creds_mask);
+ /* The well knowns we need unconditionally, so that matches can work */
+ bus->creds_mask = mask | SD_BUS_CREDS_WELL_KNOWN_NAMES|SD_BUS_CREDS_UNIQUE_NAME;
+
+ return kdbus_translate_attach_flags(bus->creds_mask, &bus->creds_mask);
}
_public_ int sd_bus_set_server(sd_bus *bus, int b, sd_id128_t server_id) {
}
_public_ int sd_bus_set_server(sd_bus *bus, int b, sd_id128_t server_id) {
@@
-1153,9
+1157,8
@@
_public_ void sd_bus_close(sd_bus *bus) {
/* We'll leave the fd open in case this is a kernel bus, since
* there might still be memblocks around that reference this
/* We'll leave the fd open in case this is a kernel bus, since
* there might still be memblocks around that reference this
- * bus, and they might need to invoke the
- * KDBUS_CMD_MSG_RELEASE ioctl on the fd when they are
- * freed. */
+ * bus, and they might need to invoke the * KDBUS_CMD_FREE
+ * ioctl on the fd when they are freed. */
}
static void bus_enter_closing(sd_bus *bus) {
}
static void bus_enter_closing(sd_bus *bus) {
@@
-2803,7
+2806,7
@@
_public_ int sd_bus_get_peer_creds(sd_bus *bus, uint64_t mask, sd_bus_creds **re
c->uid = bus->ucred.uid;
c->gid = bus->ucred.gid;
c->uid = bus->ucred.uid;
c->gid = bus->ucred.gid;
- c->mask |= (
(SD_BUS_CREDS_UID | SD_BUS_CREDS_PID | SD_BUS_CREDS_GID) & mask) & bus->creds_
mask;
+ c->mask |= (
SD_BUS_CREDS_UID | SD_BUS_CREDS_PID | SD_BUS_CREDS_GID) &
mask;
}
if (!isempty(bus->label) && (mask & SD_BUS_CREDS_SELINUX_CONTEXT)) {
}
if (!isempty(bus->label) && (mask & SD_BUS_CREDS_SELINUX_CONTEXT)) {
@@
-2813,7
+2816,7
@@
_public_ int sd_bus_get_peer_creds(sd_bus *bus, uint64_t mask, sd_bus_creds **re
return -ENOMEM;
}
return -ENOMEM;
}
- c->mask |= SD_BUS_CREDS_SELINUX_CONTEXT
| bus->creds_mask
;
+ c->mask |= SD_BUS_CREDS_SELINUX_CONTEXT;
}
r = bus_creds_add_more(c, mask, pid, 0);
}
r = bus_creds_add_more(c, mask, pid, 0);