Move code out of main.c and fix some issues
[lttng-tools.git] / src / bin / lttng-sessiond / session.c
index e445363ea03d214d90a4f4ded762ad9593d818b1..3764c125397f4a8905d022d89953dde19cefc484 100644 (file)
@@ -149,6 +149,10 @@ int session_destroy(struct ltt_session *session)
        DBG("Destroying session %s", session->name);
        del_session_list(session);
        pthread_mutex_destroy(&session->lock);
+
+       rcu_read_lock();
+       consumer_destroy_output(session->consumer);
+       rcu_read_unlock();
        free(session);
 
        return LTTCOMM_OK;
@@ -242,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.022895 seconds and 4 git commands to generate.