Change euid/egid and uid/gid to use the lttng_credentials structure
under the "effective_credentials" and "real_credentials" names.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
case LTTNG_BUFFER_PER_UID:
{
struct buffer_reg_uid *reg_uid = buffer_reg_uid_find(
case LTTNG_BUFFER_PER_UID:
{
struct buffer_reg_uid *reg_uid = buffer_reg_uid_find(
- ua_sess->tracing_id, ua_sess->bits_per_long, ua_sess->uid);
+ ua_sess->tracing_id, ua_sess->bits_per_long,
+ ua_sess->real_credentials.uid);
if (!reg_uid) {
goto error;
}
if (!reg_uid) {
goto error;
}
ua_sess->tracing_id = usess->id;
ua_sess->id = get_next_session_id();
ua_sess->tracing_id = usess->id;
ua_sess->id = get_next_session_id();
- ua_sess->uid = app->uid;
- ua_sess->gid = app->gid;
- ua_sess->euid = usess->uid;
- ua_sess->egid = usess->gid;
+ ua_sess->real_credentials.uid = app->uid;
+ ua_sess->real_credentials.gid = app->gid;
+ ua_sess->effective_credentials.uid = usess->uid;
+ ua_sess->effective_credentials.gid = usess->gid;
ua_sess->buffer_type = usess->buffer_type;
ua_sess->bits_per_long = app->bits_per_long;
ua_sess->buffer_type = usess->buffer_type;
ua_sess->bits_per_long = app->bits_per_long;
break;
case LTTNG_BUFFER_PER_UID:
ret = snprintf(ua_sess->path, sizeof(ua_sess->path),
break;
case LTTNG_BUFFER_PER_UID:
ret = snprintf(ua_sess->path, sizeof(ua_sess->path),
- DEFAULT_UST_TRACE_UID_PATH, ua_sess->uid, app->bits_per_long);
+ DEFAULT_UST_TRACE_UID_PATH,
+ ua_sess->real_credentials.uid,
+ app->bits_per_long);
break;
default:
assert(0);
break;
default:
assert(0);
app->bits_per_long, app->uint8_t_alignment,
app->uint16_t_alignment, app->uint32_t_alignment,
app->uint64_t_alignment, app->long_alignment,
app->bits_per_long, app->uint8_t_alignment,
app->uint16_t_alignment, app->uint32_t_alignment,
app->uint64_t_alignment, app->long_alignment,
- app->byte_order, app->version.major,
- app->version.minor, reg_pid->root_shm_path,
- reg_pid->shm_path,
- ua_sess->euid, ua_sess->egid);
+ app->byte_order, app->version.major, app->version.minor,
+ reg_pid->root_shm_path, reg_pid->shm_path,
+ ua_sess->effective_credentials.uid,
+ ua_sess->effective_credentials.gid);
if (ret < 0) {
/*
* reg_pid->registry->reg.ust is NULL upon error, so we need to
if (ret < 0) {
/*
* reg_pid->registry->reg.ust is NULL upon error, so we need to
notification_ret = notification_thread_command_add_channel(
notification_thread_handle, session->name,
notification_ret = notification_thread_command_add_channel(
notification_thread_handle, session->name,
- ua_sess->euid, ua_sess->egid,
- ua_chan->name,
- ua_chan->key,
- LTTNG_DOMAIN_UST,
+ ua_sess->effective_credentials.uid,
+ ua_sess->effective_credentials.gid, ua_chan->name,
+ ua_chan->key, LTTNG_DOMAIN_UST,
ua_chan->attr.subbuf_size * ua_chan->attr.num_subbuf);
if (notification_ret != LTTNG_OK) {
ret = - (int) notification_ret;
ua_chan->attr.subbuf_size * ua_chan->attr.num_subbuf);
if (notification_ret != LTTNG_OK) {
ret = - (int) notification_ret;
cmd_ret = notification_thread_command_add_channel(
notification_thread_handle, session->name,
cmd_ret = notification_thread_command_add_channel(
notification_thread_handle, session->name,
- ua_sess->euid, ua_sess->egid,
- ua_chan->name,
- ua_chan->key,
- LTTNG_DOMAIN_UST,
+ ua_sess->effective_credentials.uid,
+ ua_sess->effective_credentials.gid, ua_chan->name,
+ ua_chan->key, LTTNG_DOMAIN_UST,
ua_chan->attr.subbuf_size * ua_chan->attr.num_subbuf);
if (cmd_ret != LTTNG_OK) {
ret = - (int) cmd_ret;
ua_chan->attr.subbuf_size * ua_chan->attr.num_subbuf);
if (cmd_ret != LTTNG_OK) {
ret = - (int) cmd_ret;
cds_lfht_for_each_entry(ua_sess->channels->ht, &chan_iter.iter,
ua_chan, node.node) {
status = consumer_snapshot_channel(socket,
cds_lfht_for_each_entry(ua_sess->channels->ht, &chan_iter.iter,
ua_chan, node.node) {
status = consumer_snapshot_channel(socket,
- ua_chan->key, output,
- 0, ua_sess->euid, ua_sess->egid,
+ ua_chan->key, output, 0,
+ ua_sess->effective_credentials
+ .uid,
+ ua_sess->effective_credentials
+ .gid,
pathname, wait,
nb_packets_per_stream);
switch (status) {
pathname, wait,
nb_packets_per_stream);
switch (status) {
continue;
}
status = consumer_snapshot_channel(socket,
continue;
}
status = consumer_snapshot_channel(socket,
- registry->metadata_key, output,
- 1, ua_sess->euid, ua_sess->egid,
+ registry->metadata_key, output, 1,
+ ua_sess->effective_credentials.uid,
+ ua_sess->effective_credentials.gid,
pathname, wait, 0);
switch (status) {
case LTTNG_OK:
pathname, wait, 0);
switch (status) {
case LTTNG_OK:
/* Rotate the data channels. */
cds_lfht_for_each_entry(ua_sess->channels->ht, &chan_iter.iter,
ua_chan, node.node) {
/* Rotate the data channels. */
cds_lfht_for_each_entry(ua_sess->channels->ht, &chan_iter.iter,
ua_chan, node.node) {
- ret = consumer_rotate_channel(socket, ua_chan->key,
- ua_sess->euid, ua_sess->egid,
+ ret = consumer_rotate_channel(socket,
+ ua_chan->key,
+ ua_sess->effective_credentials
+ .uid,
+ ua_sess->effective_credentials
+ .gid,
ua_sess->consumer,
/* is_metadata_channel */ false);
if (ret < 0) {
ua_sess->consumer,
/* is_metadata_channel */ false);
if (ret < 0) {
/* Rotate the metadata channel. */
(void) push_metadata(registry, usess->consumer);
/* Rotate the metadata channel. */
(void) push_metadata(registry, usess->consumer);
- ret = consumer_rotate_channel(socket, registry->metadata_key,
- ua_sess->euid, ua_sess->egid,
+ ret = consumer_rotate_channel(socket,
+ registry->metadata_key,
+ ua_sess->effective_credentials.uid,
+ ua_sess->effective_credentials.gid,
ua_sess->consumer,
/* is_metadata_channel */ true);
if (ret < 0) {
ua_sess->consumer,
/* is_metadata_channel */ true);
if (ret < 0) {
/* Starts with 'ust'; no leading slash. */
char path[PATH_MAX];
/* UID/GID of the application owning the session */
/* Starts with 'ust'; no leading slash. */
char path[PATH_MAX];
/* UID/GID of the application owning the session */
- uid_t uid;
- gid_t gid;
+ struct lttng_credentials real_credentials;
/* Effective UID and GID. Same as the tracing session. */
/* Effective UID and GID. Same as the tracing session. */
- uid_t euid;
- gid_t egid;
+ struct lttng_credentials effective_credentials;
struct cds_list_head teardown_node;
/*
* Once at least *one* session is created onto the application, the
struct cds_list_head teardown_node;
/*
* Once at least *one* session is created onto the application, the
ua_chan->tracefile_count,
ua_sess->id,
ua_sess->output_traces,
ua_chan->tracefile_count,
ua_sess->id,
ua_sess->output_traces,
+ ua_sess->real_credentials.uid,
ua_chan->attr.blocking_timeout,
root_shm_path, shm_path,
ua_chan->attr.blocking_timeout,
root_shm_path, shm_path,
+ trace_chunk,
+ &ua_sess->effective_credentials);