conn_info = (struct kdbus_conn_info *) ((uint8_t *) bus->kdbus_buffer + cmd->offset);
+ /* Non-activated names are considered not available */
+ if (conn_info->flags & KDBUS_HELLO_ACTIVATOR)
+ return name[0] == ':' ? -ENXIO : -ENOENT;
+
c = bus_creds_new();
if (!c)
return -ENOMEM;
assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
assert_return(!bus_pid_changed(bus), -ECHILD);
assert_return(service_name_is_valid(name), -EINVAL);
+ assert_return(bus->bus_client, -ENODATA);
if (bus->is_kernel)
return bus_get_owner_kdbus(bus, name, mask, creds);
return -errno;
}
- /* If the neither name is explicitly set to
- * the empty string, then this can match
- * against changed names */
- if (!(old_owner && old_owner[0] == 0) &&
- !(new_owner && new_owner[0] == 0)) {
- item->type = KDBUS_ITEM_NAME_CHANGE;
-
- r = ioctl(bus->input_fd, KDBUS_CMD_MATCH_ADD, m);
- if (r < 0)
- return -errno;
- }
+ /* The CHANGE match we need in either case, because
+ * what is reported as a name change by the kernel
+ * might just be an owner change between starter and
+ * normal clients. For userspace such a change should
+ * be considered a removal/addition, hence let's
+ * subscribe to this unconditionally. */
+ item->type = KDBUS_ITEM_NAME_CHANGE;
+ r = ioctl(bus->input_fd, KDBUS_CMD_MATCH_ADD, m);
+ if (r < 0)
+ return -errno;
}
if (is_name_id != 0) {