aboutsummaryrefslogtreecommitdiff
path: root/src/or/geoip.c
diff options
context:
space:
mode:
authorJérémy Bobbio <lunar@debian.org>2011-06-14 12:18:32 -0400
committerNick Mathewson <nickm@torproject.org>2011-06-14 12:18:32 -0400
commit54d7d31cba84232b50fef4287951b2c4bfa746c2 (patch)
tree3edfea998d447846a8e5cf14b850d38eb0da7450 /src/or/geoip.c
parentf30327449009a7f00b0f5c2bd09a7eff615df3dd (diff)
downloadtor-54d7d31cba84232b50fef4287951b2c4bfa746c2.tar
tor-54d7d31cba84232b50fef4287951b2c4bfa746c2.tar.gz
Make ControlSocketsGroupWritable work with User.
Original message from bug3393: check_private_dir() to ensure that ControlSocketsGroupWritable is safe to use. Unfortunately, check_private_dir() only checks against the currently running user… which can be root until privileges are dropped to the user and group configured by the User config option. The attached patch fixes the issue by adding a new effective_user argument to check_private_dir() and updating the callers. It might not be the best way to fix the issue, but it did in my tests. (Code by lunar; changelog by nickm)
Diffstat (limited to 'src/or/geoip.c')
-rw-r--r--src/or/geoip.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/or/geoip.c b/src/or/geoip.c
index 5bb2410a7..c621ea818 100644
--- a/src/or/geoip.c
+++ b/src/or/geoip.c
@@ -970,7 +970,7 @@ geoip_dirreq_stats_write(time_t now)
geoip_remove_old_clients(start_of_dirreq_stats_interval);
statsdir = get_datadir_fname("stats");
- if (check_private_dir(statsdir, CPD_CREATE) < 0)
+ if (check_private_dir(statsdir, CPD_CREATE, get_options()->User) < 0)
goto done;
filename = get_datadir_fname2("stats", "dirreq-stats");
data_v2 = geoip_get_client_history(GEOIP_CLIENT_NETWORKSTATUS_V2);
@@ -1209,7 +1209,7 @@ geoip_bridge_stats_write(time_t now)
/* Write it to disk. */
statsdir = get_datadir_fname("stats");
- if (check_private_dir(statsdir, CPD_CREATE) < 0)
+ if (check_private_dir(statsdir, CPD_CREATE, get_options()->User) < 0)
goto done;
filename = get_datadir_fname2("stats", "bridge-stats");
@@ -1304,7 +1304,7 @@ geoip_entry_stats_write(time_t now)
geoip_remove_old_clients(start_of_entry_stats_interval);
statsdir = get_datadir_fname("stats");
- if (check_private_dir(statsdir, CPD_CREATE) < 0)
+ if (check_private_dir(statsdir, CPD_CREATE, get_options()->User) < 0)
goto done;
filename = get_datadir_fname2("stats", "entry-stats");
data = geoip_get_client_history(GEOIP_CLIENT_CONNECT);