From: Mathieu Desnoyers Date: Thu, 23 Feb 2012 16:02:00 +0000 (-0500) Subject: fix: command handling: do not check domain for commands not requiring domain X-Git-Tag: v2.0.0-rc2~28 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=f84aa40aa710b6a6d65cf2612f70d52e2aa0e5dd;p=lttng-tools.git fix: command handling: do not check domain for commands not requiring domain Signed-off-by: Mathieu Desnoyers Signed-off-by: David Goulet --- diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 283868970..1e15d86c4 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -3126,10 +3126,24 @@ static int process_client_msg(struct command_ctx *cmd_ctx) { int ret = LTTCOMM_OK; int need_tracing_session = 1; + int need_domain; DBG("Processing client command %d", cmd_ctx->lsm->cmd_type); - if (opt_no_kernel && cmd_ctx->lsm->domain.type == LTTNG_DOMAIN_KERNEL) { + switch (cmd_ctx->lsm->cmd_type) { + case LTTNG_CREATE_SESSION: + case LTTNG_DESTROY_SESSION: + case LTTNG_LIST_SESSIONS: + case LTTNG_LIST_DOMAINS: + case LTTNG_START_TRACE: + case LTTNG_STOP_TRACE: + need_domain = 0; + default: + need_domain = 1; + } + + if (opt_no_kernel && need_domain + && cmd_ctx->lsm->domain.type == LTTNG_DOMAIN_KERNEL) { ret = LTTCOMM_KERN_NA; goto error; } @@ -3157,8 +3171,8 @@ static int process_client_msg(struct command_ctx *cmd_ctx) /* Commands that DO NOT need a session. */ switch (cmd_ctx->lsm->cmd_type) { - case LTTNG_CALIBRATE: case LTTNG_CREATE_SESSION: + case LTTNG_CALIBRATE: case LTTNG_LIST_SESSIONS: case LTTNG_LIST_TRACEPOINTS: need_tracing_session = 0; @@ -3183,6 +3197,9 @@ static int process_client_msg(struct command_ctx *cmd_ctx) break; } + if (!need_domain) { + goto skip_domain; + } /* * Check domain type for specific "pre-action". */ @@ -3276,6 +3293,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx) default: break; } +skip_domain: /* * Check that the UID or GID match that of the tracing session.