diff options
Diffstat (limited to 'src/firejail/fs_mkdir.c')
-rw-r--r-- | src/firejail/fs_mkdir.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/firejail/fs_mkdir.c b/src/firejail/fs_mkdir.c index a0bda7443..35d043dde 100644 --- a/src/firejail/fs_mkdir.c +++ b/src/firejail/fs_mkdir.c | |||
@@ -57,12 +57,15 @@ static void mkdir_recursive(char *path) { | |||
57 | 57 | ||
58 | void fs_mkdir(const char *name) { | 58 | void fs_mkdir(const char *name) { |
59 | EUID_ASSERT(); | 59 | EUID_ASSERT(); |
60 | printf("****************************\n"); | ||
61 | |||
60 | 62 | ||
61 | // check directory name | 63 | // check directory name |
62 | invalid_filename(name); | 64 | invalid_filename(name); |
63 | char *expanded = expand_home(name, cfg.homedir); | 65 | char *expanded = expand_home(name, cfg.homedir); |
64 | if (strncmp(expanded, cfg.homedir, strlen(cfg.homedir)) != 0) { | 66 | if (strncmp(expanded, cfg.homedir, strlen(cfg.homedir)) != 0 && |
65 | fprintf(stderr, "Error: only directories in user home are supported by mkdir\n"); | 67 | strncmp(expanded, "/tmp", 4) != 0) { |
68 | fprintf(stderr, "Error: only directories in user home or /tmp are supported by mkdir\n"); | ||
66 | exit(1); | 69 | exit(1); |
67 | } | 70 | } |
68 | 71 | ||
@@ -100,8 +103,9 @@ void fs_mkfile(const char *name) { | |||
100 | // check file name | 103 | // check file name |
101 | invalid_filename(name); | 104 | invalid_filename(name); |
102 | char *expanded = expand_home(name, cfg.homedir); | 105 | char *expanded = expand_home(name, cfg.homedir); |
103 | if (strncmp(expanded, cfg.homedir, strlen(cfg.homedir)) != 0) { | 106 | if (strncmp(expanded, cfg.homedir, strlen(cfg.homedir)) != 0 && |
104 | fprintf(stderr, "Error: only files in user home are supported by mkfile\n"); | 107 | strncmp(expanded, "/tmp", 4) != 0) { |
108 | fprintf(stderr, "Error: only files in user home or /tmp are supported by mkfile\n"); | ||
105 | exit(1); | 109 | exit(1); |
106 | } | 110 | } |
107 | 111 | ||