X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Frunas.c;h=09fdaf40aaa172356dc7957c5ea072e99a7d0e04;hp=3c4c2ae0bb9d360141c3ed5dbb60fbc6a420e8ab;hb=7c1f6da21f4d46d9c834820a2b26f0634c7365a9;hpb=c73f064af78ce03f1f6d89b66a0e05b3d3b477aa diff --git a/src/common/runas.c b/src/common/runas.c index 3c4c2ae0b..09fdaf40a 100644 --- a/src/common/runas.c +++ b/src/common/runas.c @@ -8,7 +8,6 @@ */ #define _LGPL_SOURCE -#include #include #include #include @@ -23,9 +22,11 @@ #include #include +#include #include #include #include +#include #include #include #include @@ -37,7 +38,6 @@ #include #include -#include #include "runas.h" @@ -1799,15 +1799,16 @@ error: LTTNG_HIDDEN int run_as_generate_filter_bytecode(const char *filter_expression, - uid_t uid, - gid_t gid, - struct lttng_filter_bytecode **bytecode) + const struct lttng_credentials *creds, + struct lttng_bytecode **bytecode) { int ret; struct run_as_data data = {}; struct run_as_ret run_as_ret = {}; - const struct lttng_filter_bytecode *view_bytecode = NULL; - struct lttng_filter_bytecode *local_bytecode = NULL; + const struct lttng_bytecode *view_bytecode = NULL; + struct lttng_bytecode *local_bytecode = NULL; + const uid_t uid = lttng_credentials_get_uid(creds); + const gid_t gid = lttng_credentials_get_gid(creds); DBG3("generate_filter_bytecode() from expression=\"%s\" for uid %d and gid %d", filter_expression, (int) uid, (int) gid); @@ -1825,7 +1826,7 @@ int run_as_generate_filter_bytecode(const char *filter_expression, goto error; } - view_bytecode = (const struct lttng_filter_bytecode *) run_as_ret.u.generate_filter_bytecode.bytecode; + view_bytecode = (const struct lttng_bytecode *) run_as_ret.u.generate_filter_bytecode.bytecode; local_bytecode = zmalloc(sizeof(*local_bytecode) + view_bytecode->len); if (!local_bytecode) {