struct ltt_session *session;
const struct ltt_session_list *session_list = session_get_list();
- DBG("Counting number of available session for UID %d GID %d",
- uid, gid);
+ DBG("Counting number of available session for UID %d", uid);
cds_list_for_each_entry(session, &session_list->head, list) {
if (!session_get(session)) {
continue;
}
session_lock(session);
/* Only count the sessions the user can control. */
- if (session_access_ok(session, uid, gid) &&
+ if (session_access_ok(session, uid) &&
!session->destroyed) {
i++;
}
}
/*
- * Check that the UID or GID match that of the tracing session.
+ * Check that the UID matches that of the tracing session.
* The root user can interact with all sessions.
*/
if (need_tracing_session) {
if (!session_access_ok(cmd_ctx->session,
- LTTNG_SOCK_GET_UID_CRED(&cmd_ctx->creds),
- LTTNG_SOCK_GET_GID_CRED(&cmd_ctx->creds)) ||
+ LTTNG_SOCK_GET_UID_CRED(&cmd_ctx->creds)) ||
cmd_ctx->session->destroyed) {
ret = LTTNG_ERR_EPERM;
goto error;
/*
* Only list the sessions the user can control.
*/
- if (!session_access_ok(session, uid, gid) ||
+ if (!session_access_ok(session, uid) ||
session->destroyed) {
session_put(session);
continue;
memset(config_file_path, 0, sizeof(config_file_path));
if (!session_access_ok(session,
- LTTNG_SOCK_GET_UID_CRED(creds),
- LTTNG_SOCK_GET_GID_CRED(creds)) || session->destroyed) {
+ LTTNG_SOCK_GET_UID_CRED(creds)) || session->destroyed) {
ret = LTTNG_ERR_EPERM;
goto end;
}
}
/*
- * 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;
}
/*
struct ltt_session_list *session_get_list(void);
void session_list_wait_empty(void);
-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);
int session_reset_rotation_state(struct ltt_session *session,
enum lttng_rotation_state result);