diff options
author | Nick Mathewson <nickm@torproject.org> | 2020-07-21 09:29:03 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2020-07-21 09:29:03 -0400 |
commit | 5cd85feaa7f05b2dc6229b4a72216ee8ffdc3b66 (patch) | |
tree | 8c191591eb3f165afdd2c4877fdc075c6dd004a9 /src/app | |
parent | 95d4bff7849a1801085c1f28b3f7a54b3b814dd6 (diff) | |
parent | d28bfb2cd5665c38bd14d6a72848209dcd66faf9 (diff) | |
download | tor-5cd85feaa7f05b2dc6229b4a72216ee8ffdc3b66.tar.gz tor-5cd85feaa7f05b2dc6229b4a72216ee8ffdc3b66.zip |
Merge remote-tracking branch 'tor-gitlab/mr/68' into maint-0.4.4
Diffstat (limited to 'src/app')
-rw-r--r-- | src/app/main/main.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/app/main/main.c b/src/app/main/main.c index dc39611f98..66776fc40b 100644 --- a/src/app/main/main.c +++ b/src/app/main/main.c @@ -822,6 +822,9 @@ sandbox_init_filter(void) #define OPEN(name) \ sandbox_cfg_allow_open_filename(&cfg, tor_strdup(name)) +#define OPENDIR(dir) \ + sandbox_cfg_allow_opendir_dirname(&cfg, tor_strdup(dir)) + #define OPEN_DATADIR(name) \ sandbox_cfg_allow_open_filename(&cfg, get_datadir_fname(name)) @@ -839,7 +842,7 @@ sandbox_init_filter(void) } while (0) #define OPEN_KEY_DIRECTORY() \ - sandbox_cfg_allow_open_filename(&cfg, tor_strdup(options->KeyDirectory)) + OPENDIR(options->KeyDirectory) #define OPEN_CACHEDIR(name) \ sandbox_cfg_allow_open_filename(&cfg, get_cachedir_fname(name)) #define OPEN_CACHEDIR_SUFFIX(name, suffix) do { \ @@ -853,7 +856,7 @@ sandbox_init_filter(void) OPEN_KEYDIR(name suffix); \ } while (0) - OPEN(options->DataDirectory); + OPENDIR(options->DataDirectory); OPEN_KEY_DIRECTORY(); OPEN_CACHEDIR_SUFFIX("cached-certs", ".tmp"); @@ -900,7 +903,11 @@ sandbox_init_filter(void) } SMARTLIST_FOREACH(options->FilesOpenedByIncludes, char *, f, { - OPEN(f); + if (file_status(f) == FN_DIR) { + OPENDIR(f); + } else { + OPEN(f); + } }); #define RENAME_SUFFIX(name, suffix) \ @@ -1013,7 +1020,7 @@ sandbox_init_filter(void) * directory that holds it. */ char *dirname = tor_strdup(port->unix_addr); if (get_parent_directory(dirname) == 0) { - OPEN(dirname); + OPENDIR(dirname); } tor_free(dirname); sandbox_cfg_allow_chmod_filename(&cfg, tor_strdup(port->unix_addr)); |