- struct lttng_tracker_id id;
-
- memset(&id, 0, sizeof(id));
- id.type = cmd_ctx->lsm->u.id_tracker.id_type;
- switch (id.type) {
- case LTTNG_ID_ALL:
- break;
- case LTTNG_ID_VALUE:
- id.value = cmd_ctx->lsm->u.id_tracker.u.value;
- break;
- case LTTNG_ID_STRING:
- {
- const size_t var_len = cmd_ctx->lsm->u.id_tracker.u.var_len;
+ struct lttng_dynamic_buffer payload;
+ struct lttng_buffer_view payload_view;
+ const bool add_value =
+ cmd_ctx->lsm->cmd_type ==
+ LTTNG_PROCESS_ATTR_TRACKER_ADD_INCLUDE_VALUE;
+ const size_t name_len =
+ cmd_ctx->lsm->u.process_attr_tracker_add_remove_include_value
+ .name_len;
+ const enum lttng_domain_type domain_type =
+ (enum lttng_domain_type)
+ cmd_ctx->lsm->domain.type;
+ const enum lttng_process_attr process_attr =
+ (enum lttng_process_attr) cmd_ctx->lsm->u
+ .process_attr_tracker_add_remove_include_value
+ .process_attr;
+ const enum lttng_process_attr_value_type value_type =
+ (enum lttng_process_attr_value_type) cmd_ctx
+ ->lsm->u
+ .process_attr_tracker_add_remove_include_value
+ .value_type;
+ struct process_attr_value *value;
+ enum lttng_error_code ret_code;
+
+ /* Receive remaining variable length payload if applicable. */
+ if (name_len > LOGIN_NAME_MAX) {
+ /*
+ * POSIX mandates user and group names that are at least
+ * 8 characters long. Note that although shadow-utils
+ * (useradd, groupaadd, etc.) use 32 chars as their
+ * limit (from bits/utmp.h, UT_NAMESIZE),
+ * LOGIN_NAME_MAX is defined to 256.
+ */
+ ERR("Rejecting process attribute tracker value %s as the provided exceeds the maximal allowed length: argument length = %zu, maximal length = %d",
+ add_value ? "addition" : "removal",
+ name_len, LOGIN_NAME_MAX);
+ ret = LTTNG_ERR_INVALID;
+ goto error;
+ }