Move code out of main.c and fix some issues
[lttng-tools.git] / src / bin / lttng-sessiond / session.c
index 75fcf4bfded58320ab6723e9ae0e574740107b24..3764c125397f4a8905d022d89953dde19cefc484 100644 (file)
@@ -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;
+       }
+}
This page took 0.023903 seconds and 5 git commands to generate.