Create userspace buffers using ua_sess effective credentials
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 17 Jul 2019 19:12:49 +0000 (15:12 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 25 Jul 2019 19:51:47 +0000 (15:51 -0400)
While a session's trace chunk shares its credentials, a trace
chunk's credentials are unset when the output is not local. Hence,
the session's effective credentials must be used.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/consumer.c
src/bin/lttng-sessiond/consumer.h

index 83c30be86edfee4c2d1443b6ef77ae1f44808887..1bbee02f28c25ba64625cce77071ee8b8cfa0f2b 100644 (file)
@@ -883,7 +883,8 @@ void consumer_init_ask_channel_comm_msg(struct lttcomm_consumer_msg *msg,
                int64_t blocking_timeout,
                const char *root_shm_path,
                const char *shm_path,
-               struct lttng_trace_chunk *trace_chunk)
+               struct lttng_trace_chunk *trace_chunk,
+               const struct lttng_credentials *buffer_credentials)
 {
        assert(msg);
 
@@ -899,20 +900,13 @@ void consumer_init_ask_channel_comm_msg(struct lttcomm_consumer_msg *msg,
         if (trace_chunk) {
                uint64_t chunk_id;
                enum lttng_trace_chunk_status chunk_status;
-               struct lttng_credentials chunk_credentials;
 
                chunk_status = lttng_trace_chunk_get_id(trace_chunk, &chunk_id);
                assert(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
                LTTNG_OPTIONAL_SET(&msg->u.ask_channel.chunk_id, chunk_id);
-
-               chunk_status = lttng_trace_chunk_get_credentials(trace_chunk,
-                               &chunk_credentials);
-               assert(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
-               msg->u.ask_channel.buffer_credentials.uid =
-                               chunk_credentials.uid;
-               msg->u.ask_channel.buffer_credentials.gid =
-                               chunk_credentials.gid;
         }
+       msg->u.ask_channel.buffer_credentials.uid = buffer_credentials->uid;
+       msg->u.ask_channel.buffer_credentials.gid = buffer_credentials->gid;
 
        msg->cmd_type = LTTNG_CONSUMER_ASK_CHANNEL_CREATION;
        msg->u.ask_channel.subbuf_size = subbuf_size;
index cf6fe48c9e291bfc1caa62146461f5430098f428..13ebcd0350a75d1b404244a40226e8ab0d4562ab 100644 (file)
@@ -256,7 +256,8 @@ void consumer_init_ask_channel_comm_msg(struct lttcomm_consumer_msg *msg,
                int64_t blocking_timeout,
                const char *root_shm_path,
                const char *shm_path,
-               struct lttng_trace_chunk *trace_chunk);
+               struct lttng_trace_chunk *trace_chunk,
+               const struct lttng_credentials *buffer_credentials);
 void consumer_init_add_stream_comm_msg(struct lttcomm_consumer_msg *msg,
                uint64_t channel_key,
                uint64_t stream_key,
This page took 0.028913 seconds and 5 git commands to generate.