X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fsession.c;h=3764c125397f4a8905d022d89953dde19cefc484;hp=75fcf4bfded58320ab6723e9ae0e574740107b24;hb=2f77fc4b3720dc8f75847130498c2d4aad7c03ec;hpb=68264071f9d1b789de1350cbec479b52a9b54acf diff --git a/src/bin/lttng-sessiond/session.c b/src/bin/lttng-sessiond/session.c index 75fcf4bfd..3764c1253 100644 --- a/src/bin/lttng-sessiond/session.c +++ b/src/bin/lttng-sessiond/session.c @@ -246,3 +246,18 @@ error_asprintf: error_malloc: return ret; } + +/* + * Check if the UID or GID match the session. Root user has access to all + * sessions. + */ +int session_access_ok(struct ltt_session *session, uid_t uid, gid_t gid) +{ + assert(session); + + if (uid != session->uid && gid != session->gid && uid != 0) { + return 0; + } else { + return 1; + } +}