switch (consumer_data->type) {
case LTTNG_CONSUMER_KERNEL:
/*
- * Find out which consumerd to execute. We will
- * first try the 64-bit path, then the
- * sessiond's installation directory, and
- * fallback on the 32-bit one,
+ * Find out which consumerd to execute. We will first try the
+ * 64-bit path, then the sessiond's installation directory, and
+ * fallback on the 32-bit one,
*/
DBG3("Looking for a kernel consumer at these locations:");
DBG3(" 1) %s", consumerd64_bin);
int ret;
char *type = "debugfs";
- ret = mkdir_recursive_run_as(path, S_IRWXU | S_IRWXG, geteuid(), getegid());
+ ret = run_as_mkdir_recursive(path, S_IRWXU | S_IRWXG, geteuid(), getegid());
if (ret < 0) {
PERROR("Cannot create debugfs path");
goto error;
goto error;
}
- ret = mkdir_recursive_run_as(lus->pathname, S_IRWXU | S_IRWXG,
+ ret = run_as_mkdir_recursive(lus->pathname, S_IRWXU | S_IRWXG,
session->uid, session->gid);
if (ret < 0) {
if (ret != -EEXIST) {
session->kernel_session->consumer_fd = kconsumer_data.cmd_sock;
}
- ret = mkdir_recursive_run_as(session->kernel_session->trace_path,
+ ret = run_as_mkdir_recursive(session->kernel_session->trace_path,
S_IRWXU | S_IRWXG, session->uid, session->gid);
if (ret < 0) {
if (ret != -EEXIST) {
}
/*
- * Check if the UID or GID match the session. Root user has access to
- * all sessions.
+ * Check if the UID or GID match the session. Root user has access to all
+ * sessions.
*/
-static int session_access_ok(struct ltt_session *session,
- uid_t uid, gid_t gid)
+static int session_access_ok(struct ltt_session *session, uid_t uid, gid_t gid)
{
- if (uid != session->uid && gid != session->gid
- && uid != 0) {
+ if (uid != session->uid && gid != session->gid && uid != 0) {
return 0;
} else {
return 1;
* The session list lock MUST be acquired before calling this function. Use
* session_lock_list() and session_unlock_list().
*/
-static void list_lttng_sessions(struct lttng_session *sessions,
- uid_t uid, gid_t gid)
+static void list_lttng_sessions(struct lttng_session *sessions, uid_t uid,
+ gid_t gid)
{
unsigned int i = 0;
struct ltt_session *session;
*/
switch (cmd_ctx->lsm->domain.type) {
case LTTNG_DOMAIN_KERNEL:
+ if (!is_root) {
+ ret = LTTCOMM_KERN_NA;
+ goto error;
+ }
+
/* Kernel tracer check */
if (kernel_tracer_fd == 0) {
/* Basically, load kernel tracer modules */