Fix: sessiond: uninitialized credentials set for unbound trigger
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 10 Feb 2021 18:59:48 +0000 (13:59 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 10 Feb 2021 18:59:48 +0000 (13:59 -0500)
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 <jeremie.galarneau@efficios.com>
Change-Id: I38f75b7c62ed796ff72d4b0692bcb51b361aa81b

src/bin/lttng-sessiond/notification-thread-events.c

index a878c0dbef96b57c3555672b1324d2b9ae6bd9fe..16a7925d6000ec2cc14da4b2d04270ed1caf14b6 100644 (file)
@@ -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) {
This page took 0.034896 seconds and 4 git commands to generate.