]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
fix sandbox for bandwidth authority
authorPeter Palfrader <weasel@debian.org>
Fri, 7 Jun 2024 17:29:52 +0000 (19:29 +0200)
committerDavid Goulet <dgoulet@torproject.org>
Mon, 3 Mar 2025 18:18:24 +0000 (13:18 -0500)
changes/bug40933 [new file with mode: 0644]
src/app/main/main.c
src/lib/fs/files.c

diff --git a/changes/bug40933 b/changes/bug40933
new file mode 100644 (file)
index 0000000..c4f9eb0
--- /dev/null
@@ -0,0 +1,3 @@
+  o Minor bugfixes (sandbox, bwauth):
+    - Fix sandbox to work for bandwidth authority. Fixes bug 40933; bugfix on
+      0.2.2.1-alpha
index a50a0aad6f7e48e627b1aae4dfdb7094ff36a7bd..6d05bd1f5e2489473e19f793ee964e9aeef82949 100644 (file)
@@ -926,6 +926,11 @@ sandbox_init_filter(void)
     OPEN_DATADIR("approved-routers");
     OPEN_DATADIR_SUFFIX("my-consensus-microdesc", ".tmp");
     OPEN_DATADIR_SUFFIX("my-consensus-ns", ".tmp");
+    if (options->V3BandwidthsFile) {
+      log_notice(LD_GENERAL, "Adding V3BandwidthsFile %s to sandboxing set.",
+                 options->V3BandwidthsFile);
+      OPEN(options->V3BandwidthsFile);
+    }
   }
 
   if (options->ServerDNSResolvConfFile)
index 55f20dd49efa125fc8fd062ad4669f43314ede0a..e6ccbf05cee86a7039269bee1fc238fc07e70215 100644 (file)
@@ -85,7 +85,8 @@ tor_open_cloexec(const char *path, int flags, unsigned mode)
 FILE *
 tor_fopen_cloexec(const char *path, const char *mode)
 {
-  FILE *result = fopen(path, mode);
+  const char *p = sandbox_intern_string(path);
+  FILE *result = fopen(p, mode);
 #ifdef FD_CLOEXEC
   if (result != NULL) {
     if (fcntl(fileno(result), F_SETFD, FD_CLOEXEC) == -1) {