trigger: internal: add credentials information
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.c
index 1922fd594c6dc519838a359dc9704eab7318ab01..dc1249ff1c845bef46a560e4221fd207a49d9b37 100644 (file)
@@ -4264,6 +4264,10 @@ int cmd_register_trigger(struct command_ctx *cmd_ctx, int sock,
        ssize_t sock_recv_len;
        struct lttng_trigger *trigger = NULL;
        struct lttng_payload trigger_payload;
+       struct lttng_credentials cmd_creds = {
+               .uid = cmd_ctx->creds.uid,
+               .gid = cmd_ctx->creds.gid,
+       };
 
        lttng_payload_init(&trigger_payload);
        trigger_len = (size_t) cmd_ctx->lsm.u.trigger.length;
@@ -4310,6 +4314,10 @@ int cmd_register_trigger(struct command_ctx *cmd_ctx, int sock,
                }
        }
 
+       /* Set the trigger credential */
+       lttng_trigger_set_credentials(trigger, &cmd_creds);
+
+       /* Inform the notification thread */
        ret = notification_thread_command_register_trigger(notification_thread,
                        trigger);
        /* Ownership of trigger was transferred. */
@@ -4328,6 +4336,10 @@ int cmd_unregister_trigger(struct command_ctx *cmd_ctx, int sock,
        ssize_t sock_recv_len;
        struct lttng_trigger *trigger = NULL;
        struct lttng_payload trigger_payload;
+       struct lttng_credentials cmd_creds = {
+               .uid = cmd_ctx->creds.uid,
+               .gid = cmd_ctx->creds.gid,
+       };
 
        lttng_payload_init(&trigger_payload);
        trigger_len = (size_t) cmd_ctx->lsm.u.trigger.length;
@@ -4373,6 +4385,8 @@ int cmd_unregister_trigger(struct command_ctx *cmd_ctx, int sock,
                }
        }
 
+       lttng_trigger_set_credentials(trigger, &cmd_creds);
+
        ret = notification_thread_command_unregister_trigger(notification_thread,
                        trigger);
 end:
This page took 0.031316 seconds and 4 git commands to generate.