diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-08-15 17:40:13 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-08-15 17:40:13 -0400 |
commit | 967b4e7c54b53391e1a0b67e0a5bf70bc2e6a896 (patch) | |
tree | 26a9fced28aa495bfc4cd2afa2ac606bc744b520 /src/or/config.c | |
parent | 0cb028b7c0d040e49fa7c8569f71a3e44cdd7d1a (diff) | |
parent | 112c984f9242699d273f3096d669eb1024d7f64b (diff) | |
download | tor-967b4e7c54b53391e1a0b67e0a5bf70bc2e6a896.tar.gz tor-967b4e7c54b53391e1a0b67e0a5bf70bc2e6a896.zip |
Merge remote-tracking branch 'asn/nickm-bug12864_025' into maint-0.2.5
Diffstat (limited to 'src/or/config.c')
-rw-r--r-- | src/or/config.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/or/config.c b/src/or/config.c index 2661ce3b73..f53186a5f9 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -238,6 +238,7 @@ static config_var_t option_vars_[] = { V(ExtendAllowPrivateAddresses, BOOL, "0"), VPORT(ExtORPort, LINELIST, NULL), V(ExtORPortCookieAuthFile, STRING, NULL), + V(ExtORPortCookieAuthFileGroupReadable, BOOL, "0"), V(ExtraInfoStatistics, BOOL, "1"), V(FallbackDir, LINELIST, NULL), @@ -6824,11 +6825,14 @@ config_maybe_load_geoip_files_(const or_options_t *options, * in <b>cookie_out</b>. * Then write it down to <b>fname</b> and prepend it with <b>header</b>. * + * If <b>group_readable</b> is set, set <b>fname</b> to be readable + * by the default GID. + * * If the whole procedure was successful, set * <b>cookie_is_set_out</b> to True. */ int init_cookie_authentication(const char *fname, const char *header, - int cookie_len, + int cookie_len, int group_readable, uint8_t **cookie_out, int *cookie_is_set_out) { char cookie_file_str_len = strlen(header) + cookie_len; @@ -6861,6 +6865,14 @@ init_cookie_authentication(const char *fname, const char *header, goto done; } +#ifndef _WIN32 + if (group_readable) { + if (chmod(fname, 0640)) { + log_warn(LD_FS,"Unable to make %s group-readable.", escaped(fname)); + } + } +#endif + /* Success! */ log_info(LD_GENERAL, "Generated auth cookie file in '%s'.", escaped(fname)); *cookie_is_set_out = 1; |