Fix: sessiond: abort called on undefined client command
[lttng-tools.git] / src / bin / lttng-sessiond / client.c
index 9873a8f0c9971e23c1c304b92b3d20013d3dd442..c798234ae90cc0a48eb68fbb9c236122c514caf2 100644 (file)
@@ -1006,6 +1006,13 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock,
        bool need_domain;
        bool need_consumerd;
 
+       if (!lttcomm_sessiond_command_is_valid((enum lttcomm_sessiond_command) cmd_ctx->lsm.cmd_type)) {
+               ERR("Unknown client command received: command id = %" PRIu32,
+                               cmd_ctx->lsm.cmd_type);
+               ret = LTTNG_ERR_UND;
+               goto error;
+       }
+
        DBG("Processing client command '%s\' (%d)",
                lttcomm_sessiond_command_str(cmd_ctx->lsm.cmd_type),
                cmd_ctx->lsm.cmd_type);
@@ -2395,7 +2402,6 @@ init_setup_error:
 static int create_client_sock(void)
 {
        int ret, client_sock;
-       const mode_t old_umask = umask(0);
 
        /* Create client tool unix socket */
        client_sock = lttcomm_create_unix_sock(
@@ -2429,7 +2435,6 @@ static int create_client_sock(void)
        DBG("Created client socket (fd = %i)", client_sock);
        ret = client_sock;
 end:
-       umask(old_umask);
        return ret;
 }
 
This page took 0.027204 seconds and 4 git commands to generate.