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();
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) {
/* 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) {
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)) {
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);