X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fsession.c;h=6eda624efad6f784c79cc96f66c5a22c5ceff36b;hp=95395c282a2ab79d89b23450a3cc531bea7e28ad;hb=ce0b1d61919f37517a6212f7af2afe0fa1b1dcb0;hpb=86eff0042bf0b9e6277b281c4f3a680d997790d2 diff --git a/src/bin/lttng-sessiond/session.c b/src/bin/lttng-sessiond/session.c index 95395c282..6eda624ef 100644 --- a/src/bin/lttng-sessiond/session.c +++ b/src/bin/lttng-sessiond/session.c @@ -574,8 +574,8 @@ struct lttng_trace_chunk *session_create_new_trace_chunk( const char *base_path; struct lttng_directory_handle *session_output_directory = NULL; const struct lttng_credentials session_credentials = { - .uid = session->uid, - .gid = session->gid, + .uid = LTTNG_OPTIONAL_INIT_VALUE(session->uid), + .gid = LTTNG_OPTIONAL_INIT_VALUE(session->gid), }; uint64_t next_chunk_id; const struct consumer_output *output; @@ -989,6 +989,7 @@ void session_release(struct urcu_ref *ref) * Broadcast after free-ing to ensure the memory is * reclaimed before the main thread exits. */ + ASSERT_LOCKED(ltt_session_list.lock); pthread_cond_broadcast(<t_session_list.removal_cond); } } @@ -1296,18 +1297,13 @@ error: } /* - * Check if the UID or GID match the session. Root user has access to all + * Check if the UID matches the session. Root user has access to all * sessions. */ -int session_access_ok(struct ltt_session *session, uid_t uid, gid_t gid) +bool session_access_ok(struct ltt_session *session, uid_t uid) { assert(session); - - if (uid != session->uid && gid != session->gid && uid != 0) { - return 0; - } else { - return 1; - } + return (uid == session->uid) || uid == 0; } /*