sessiond: enforce user-exclusive session access in session_access_ok
[lttng-tools.git] / src / bin / lttng-sessiond / client.c
index 4cfa60067f2ae31a72b2f97b9cce55437d2cdc20..8a2ef85b7345c33d89cd2914134bd075a71b4e9e 100644 (file)
@@ -92,7 +92,11 @@ static int setup_lttng_msg(struct command_ctx *cmd_ctx,
                .data_size = payload_len,
        };
 
-       lttng_dynamic_buffer_set_size(&cmd_ctx->reply_payload.buffer, 0);
+       ret = lttng_dynamic_buffer_set_size(&cmd_ctx->reply_payload.buffer, 0);
+       if (ret) {
+               goto end;
+       }
+
        lttng_dynamic_pointer_array_clear(&cmd_ctx->reply_payload._fd_handles);
 
        cmd_ctx->lttng_msg_size = total_msg_size;
@@ -575,15 +579,14 @@ static unsigned int lttng_sessions_count(uid_t uid, gid_t gid)
        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++;
                }
@@ -1102,13 +1105,12 @@ skip_domain:
        }
 
        /*
-        * 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;
This page took 0.023689 seconds and 4 git commands to generate.