diff options
Diffstat (limited to 'src/firejail/macros.c')
-rw-r--r-- | src/firejail/macros.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/firejail/macros.c b/src/firejail/macros.c index 59b5db3d8..7e08ab340 100644 --- a/src/firejail/macros.c +++ b/src/firejail/macros.c | |||
@@ -229,6 +229,13 @@ char *expand_macros(const char *path) { | |||
229 | EUID_ROOT(); | 229 | EUID_ROOT(); |
230 | return new_name; | 230 | return new_name; |
231 | } | 231 | } |
232 | else if (strncmp(path, "${RUNUSER}", 10) == 0) { | ||
233 | if (asprintf(&new_name, "/run/user/%u%s", getuid(), path + 10) == -1) | ||
234 | errExit("asprintf"); | ||
235 | if(called_as_root) | ||
236 | EUID_ROOT(); | ||
237 | return new_name; | ||
238 | } | ||
232 | else { | 239 | else { |
233 | char *directory = resolve_macro(path); | 240 | char *directory = resolve_macro(path); |
234 | if (directory) { | 241 | if (directory) { |
@@ -260,6 +267,8 @@ void invalid_filename(const char *fname, int globbing) { | |||
260 | ptr = fname + 7; | 267 | ptr = fname + 7; |
261 | else if (strncmp(ptr, "${PATH}", 7) == 0) | 268 | else if (strncmp(ptr, "${PATH}", 7) == 0) |
262 | ptr = fname + 7; | 269 | ptr = fname + 7; |
270 | else if (strncmp(ptr, "${RUNUSER}", 10) == 0) | ||
271 | ptr = fname + 10; | ||
263 | else { | 272 | else { |
264 | int id = macro_id(fname); | 273 | int id = macro_id(fname); |
265 | if (id != -1) | 274 | if (id != -1) |