aboutsummaryrefslogtreecommitdiffstats
path: root/src/firejail/fs_mkdir.c
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2017-03-07 15:43:55 -0500
committerLibravatar netblue30 <netblue30@yahoo.com>2017-03-07 15:43:55 -0500
commit6cddc32564529573ddc3057fd8aefce1e0ae23a2 (patch)
treeee6fdc270e111fbacad0caa65dbd8dd0b0a20f24 /src/firejail/fs_mkdir.c
parentFollowing links in private-bin command ported from #1100 created problems for... (diff)
downloadfirejail-6cddc32564529573ddc3057fd8aefce1e0ae23a2.tar.gz
firejail-6cddc32564529573ddc3057fd8aefce1e0ae23a2.tar.zst
firejail-6cddc32564529573ddc3057fd8aefce1e0ae23a2.zip
allow /tmp in mkdir and mkfile profile commands
Diffstat (limited to 'src/firejail/fs_mkdir.c')
-rw-r--r--src/firejail/fs_mkdir.c12
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
58void fs_mkdir(const char *name) { 58void fs_mkdir(const char *name) {
59 EUID_ASSERT(); 59 EUID_ASSERT();
60printf("****************************\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