diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-11-15 16:47:25 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-11-15 16:47:25 -0500 |
commit | 63312e0299090bb61de62cd5ed45166a70b7f698 (patch) | |
tree | c6000d6716b0ab00b18964ea0bc52c881668797f | |
parent | 1e6ffeaeaaf3c01a85c69e9cee76f124720bb8c8 (diff) | |
parent | aebe8a82c9a1a8ee1df9d1dbb82807d342f49203 (diff) | |
download | tor-63312e0299090bb61de62cd5ed45166a70b7f698.tar.gz tor-63312e0299090bb61de62cd5ed45166a70b7f698.zip |
Merge branch 'maint-0.3.3' into maint-0.3.4
-rw-r--r-- | changes/ticket26913 | 7 | ||||
-rw-r--r-- | doc/tor.1.txt | 6 | ||||
-rw-r--r-- | src/or/config.c | 21 |
3 files changed, 30 insertions, 4 deletions
diff --git a/changes/ticket26913 b/changes/ticket26913 new file mode 100644 index 0000000000..d6555764ec --- /dev/null +++ b/changes/ticket26913 @@ -0,0 +1,7 @@ + o Minor bugfixes (directory permissions): + - When a user requests a group-readable DataDirectory, give it to + them. Previously, when the DataDirectory and the CacheDirectory + were the same, the default setting (0) for + CacheDirectoryGroupReadable would always override the setting for + DataDirectoryGroupReadable. Fixes bug 26913; bugfix on + 0.3.3.1-alpha. diff --git a/doc/tor.1.txt b/doc/tor.1.txt index f42ad0dd3c..6dd1b60b23 100644 --- a/doc/tor.1.txt +++ b/doc/tor.1.txt @@ -426,10 +426,12 @@ GENERAL OPTIONS running. (Default: uses the value of DataDirectory.) -[[CacheDirectoryGroupReadable]] **CacheDirectoryGroupReadable** **0**|**1**:: +[[CacheDirectoryGroupReadable]] **CacheDirectoryGroupReadable** **0**|**1**|**auto**:: If this option is set to 0, don't allow the filesystem group to read the CacheDirectory. If the option is set to 1, make the CacheDirectory readable - by the default GID. (Default: 0) + by the default GID. If the option is "auto", then we use the + setting for DataDirectoryGroupReadable when the CacheDirectory is the + same as the DataDirectory, and 0 otherwise. (Default: auto) [[FallbackDir]] **FallbackDir** __ipv4address__:__port__ orport=__port__ id=__fingerprint__ [weight=__num__] [ipv6=**[**__ipv6address__**]**:__orport__]:: When we're unable to connect to any directory cache for directory info diff --git a/src/or/config.c b/src/or/config.c index 2660fbd787..53c19e3900 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -280,7 +280,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"), @@ -1527,9 +1527,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; |