From: Jérémie Galarneau Date: Wed, 10 Feb 2021 18:59:48 +0000 (-0500) Subject: Fix: sessiond: uninitialized credentials set for unbound trigger X-Git-Tag: v2.13.0-rc1~341 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=bc8daafb693d284dbebb8311b125d38a3b8d7ef7;ds=sidebyside Fix: sessiond: uninitialized credentials set for unbound trigger The bound-object credentials should be left unset when the trigger doesn't have to bind to an object. Signed-off-by: Jérémie Galarneau Change-Id: I38f75b7c62ed796ff72d4b0692bcb51b361aa81b --- diff --git a/src/bin/lttng-sessiond/notification-thread-events.c b/src/bin/lttng-sessiond/notification-thread-events.c index a878c0dbe..16a7925d6 100644 --- a/src/bin/lttng-sessiond/notification-thread-events.c +++ b/src/bin/lttng-sessiond/notification-thread-events.c @@ -2611,10 +2611,14 @@ int handle_notification_thread_command_register_trigger( &evaluation, &object_uid, &object_gid); break; + LTTNG_OPTIONAL_SET(&object_creds.uid, object_uid); + LTTNG_OPTIONAL_SET(&object_creds.gid, object_gid); case LTTNG_OBJECT_TYPE_CHANNEL: ret = evaluate_channel_condition_for_client(condition, state, &evaluation, &object_uid, &object_gid); + LTTNG_OPTIONAL_SET(&object_creds.uid, object_uid); + LTTNG_OPTIONAL_SET(&object_creds.gid, object_gid); break; case LTTNG_OBJECT_TYPE_NONE: ret = 0; @@ -2630,9 +2634,6 @@ int handle_notification_thread_command_register_trigger( goto error_put_client_list; } - LTTNG_OPTIONAL_SET(&object_creds.uid, object_uid); - LTTNG_OPTIONAL_SET(&object_creds.gid, object_gid); - DBG("Newly registered trigger's condition evaluated to %s", evaluation ? "true" : "false"); if (!evaluation) {