summaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-05-23 11:46:44 -0400
committerNick Mathewson <nickm@torproject.org>2014-05-23 11:46:44 -0400
commit824bebd40954d2f766a7b37e6b4d206f9b682ed9 (patch)
tree6e586fd78c7dfc189380dac407844d9d84171a2a /src/or/main.c
parent5de91d118ddc3b33bdbed33dbe7fee93f8790c46 (diff)
downloadtor-824bebd40954d2f766a7b37e6b4d206f9b682ed9.tar.gz
tor-824bebd40954d2f766a7b37e6b4d206f9b682ed9.zip
sandbox: Correct fix for hs part of 12064
Bugfix on cfd0ee514c279bc6c7b; bug not in any released version of tor
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/or/main.c b/src/or/main.c
index 4ac7781cdc..8b79c42734 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -2833,7 +2833,6 @@ sandbox_init_filter(void)
{
smartlist_t *files = smartlist_new();
tor_log_get_logfile_names(files);
- rend_services_add_filenames_to_list(files);
SMARTLIST_FOREACH(files, char *, file_name, {
/* steals reference */
sandbox_cfg_allow_open_filename(&cfg, file_name);
@@ -2842,6 +2841,26 @@ sandbox_init_filter(void)
}
{
+ smartlist_t *files = smartlist_new();
+ smartlist_t *dirs = smartlist_new();
+ rend_services_add_filenames_to_lists(files, dirs);
+ SMARTLIST_FOREACH(files, char *, file_name, {
+ char *tmp_name = NULL;
+ tor_asprintf(&tmp_name, "%s.tmp", file_name);
+ sandbox_cfg_allow_rename(&cfg,
+ tor_strdup(tmp_name), tor_strdup(file_name));
+ /* steals references */
+ sandbox_cfg_allow_open_filename_array(&cfg, file_name, tmp_name, NULL);
+ });
+ SMARTLIST_FOREACH(dirs, char *, dir, {
+ /* steals reference */
+ sandbox_cfg_allow_stat_filename(&cfg, dir);
+ });
+ smartlist_free(files);
+ smartlist_free(dirs);
+ }
+
+ {
char *fname;
if ((fname = get_controller_cookie_file_name())) {
sandbox_cfg_allow_open_filename(&cfg, fname);