[tor-commits] [tor/master] Also check if the sandbox is configured as well as if it's active; sandbox_init() runs rather late in the startup process

nickm at torproject.org nickm at torproject.org
Thu Jun 30 15:18:32 UTC 2016


commit 13a16e001164581b687dae2d3377f77eedb701ff
Author: Andrea Shepard <andrea at torproject.org>
Date:   Thu Jun 30 09:37:23 2016 +0000

    Also check if the sandbox is configured as well as if it's active; sandbox_init() runs rather late in the startup process
---
 src/or/routerparse.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index def6373..875bb60 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -1073,7 +1073,11 @@ dump_desc(const char *desc, const char *type)
                DESC_DUMP_BASE_FILENAME ".%s", digest_sha256_hex);
   debugfile = get_datadir_fname2(DESC_DUMP_DATADIR_SUBDIR, debugfile_base);
 
-  if (!sandbox_is_active()) {
+  /*
+   * Check if the sandbox is active or will become active; see comment
+   * below at the log message for why.
+   */
+  if (!(sandbox_is_active() || get_options()->Sandbox)) {
     if (len <= get_options()->MaxUnparseableDescSizeToLog) {
       if (!dump_desc_fifo_bump_hash(digest_sha256)) {
         /* Create the directory if needed */
@@ -1128,7 +1132,7 @@ dump_desc(const char *desc, const char *type)
     log_info(LD_DIR,
              "Unable to parse descriptor of type %s with hash %s and "
              "length %lu. Descriptor not dumped because the sandbox is "
-             "active",
+             "configured",
              type, digest_sha256_hex, (unsigned long)len);
   }
 
@@ -6001,7 +6005,12 @@ rend_parse_client_keys(strmap_t *parsed_clients, const char *ckstr)
 void
 routerparse_init(void)
 {
-  if (!(sandbox_is_active())) {
+  /*
+   * Check both if the sandbox is active and whether it's configured; no
+   * point in loading all that if we won't be able to use it after the
+   * sandbox becomes active.
+   */
+  if (!(sandbox_is_active() || get_options()->Sandbox)) {
     dump_desc_init();
   }
 }





More information about the tor-commits mailing list