aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-09-24 11:17:09 -0400
committerNick Mathewson <nickm@torproject.org>2018-09-24 11:17:09 -0400
commit9767cf8cc091d0c9dd062fbfce258188841ec331 (patch)
treed55af03664ced4360db4a54bd271aef65f3214c8 /src/app
parent6c739c3fb2911338d68a77ea0a90cacbd868e4d7 (diff)
parent4fd761a418558c05716b4a04a5306dc67ce53dfe (diff)
downloadtor-9767cf8cc091d0c9dd062fbfce258188841ec331.tar.gz
tor-9767cf8cc091d0c9dd062fbfce258188841ec331.zip
Merge branch 'bug26913_033'
Diffstat (limited to 'src/app')
-rw-r--r--src/app/config/config.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/app/config/config.c b/src/app/config/config.c
index abb3407043..01b48e3c5f 100644
--- a/src/app/config/config.c
+++ b/src/app/config/config.c
@@ -319,7 +319,7 @@ static config_var_t option_vars_[] = {
V(BridgeRelay, BOOL, "0"),
V(BridgeDistribution, STRING, NULL),
VAR("CacheDirectory", FILENAME, CacheDirectory_option, NULL),
- V(CacheDirectoryGroupReadable, BOOL, "0"),
+ V(CacheDirectoryGroupReadable, AUTOBOOL, "auto"),
V(CellStatistics, BOOL, "0"),
V(PaddingStatistics, BOOL, "1"),
V(LearnCircuitBuildTimeout, BOOL, "1"),
@@ -1569,9 +1569,26 @@ options_act_reversible(const or_options_t *old_options, char **msg)
msg) < 0) {
goto done;
}
+
+ /* We need to handle the group-readable flag for the cache directory
+ * specially, since the directory defaults to being the same as the
+ * DataDirectory. */
+ int cache_dir_group_readable;
+ if (options->CacheDirectoryGroupReadable != -1) {
+ /* If the user specified a value, use their setting */
+ cache_dir_group_readable = options->CacheDirectoryGroupReadable;
+ } else if (!strcmp(options->CacheDirectory, options->DataDirectory)) {
+ /* If the user left the value as "auto", and the cache is the same as the
+ * datadirectory, use the datadirectory setting.
+ */
+ cache_dir_group_readable = options->DataDirectoryGroupReadable;
+ } else {
+ /* Otherwise, "auto" means "not group readable". */
+ cache_dir_group_readable = 0;
+ }
if (check_and_create_data_directory(running_tor /* create */,
options->CacheDirectory,
- options->CacheDirectoryGroupReadable,
+ cache_dir_group_readable,
options->User,
msg) < 0) {
goto done;