diff options
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/config.c | 2 | ||||
-rw-r--r-- | src/or/or.h | 2 | ||||
-rw-r--r-- | src/or/rendservice.c | 23 |
3 files changed, 12 insertions, 15 deletions
diff --git a/src/or/config.c b/src/or/config.c index 1753722f95..97b3601706 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -271,7 +271,7 @@ static config_var_t option_vars_[] = { V(AccelDir, FILENAME, NULL), V(HashedControlPassword, LINELIST, NULL), V(HidServDirectoryV2, BOOL, "1"), - V(HiddenServiceGroupReadable, BOOL, "0"), + V(HiddenServiceDirGroupReadable, BOOL, "0"), VAR("HiddenServiceDir", LINELIST_S, RendConfigLines, NULL), OBSOLETE("HiddenServiceExcludeNodes"), OBSOLETE("HiddenServiceNodes"), diff --git a/src/or/or.h b/src/or/or.h index 9207dbaa91..1544b70996 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -4225,7 +4225,7 @@ typedef struct { int Support022HiddenServices; /** Create the Hidden Service directories and hostname files group readable. */ - int HiddenServiceGroupReadable; + int HiddenServiceDirGroupReadable; } or_options_t; diff --git a/src/or/rendservice.c b/src/or/rendservice.c index 83e6a3b82c..456b548715 100644 --- a/src/or/rendservice.c +++ b/src/or/rendservice.c @@ -368,12 +368,10 @@ rend_config_services(const or_options_t *options, int validate_only) for (line = options->RendConfigLines; line; line = line->next) { if (!strcasecmp(line->key, "HiddenServiceDir")) { if (service) { /* register the one we just finished parsing */ - if (validate_only) { + if (validate_only) rend_service_free(service); - } - else { + else rend_add_service(service); - } } service = tor_malloc_zero(sizeof(rend_service_t)); service->directory = tor_strdup(line->value); @@ -517,8 +515,7 @@ rend_config_services(const or_options_t *options, int validate_only) if (service) { if (validate_only) { rend_service_free(service); - } - else { + } else { rend_add_service(service); } } @@ -699,7 +696,7 @@ rend_service_load_keys(rend_service_t *s) char buf[128]; cpd_check_t check_opts = CPD_CREATE; - if (get_options()->HiddenServiceGroupReadable) { + if (get_options()->HiddenServiceDirGroupReadable) { check_opts |= CPD_GROUP_READ; } /* Check/create directory */ @@ -707,9 +704,9 @@ rend_service_load_keys(rend_service_t *s) return -1; } #ifndef _WIN32 - if (get_options()->HiddenServiceGroupReadable) { - /** Only new dirs created get new opts, also enforce group read. */ - if (chmod(s->directory, STAT_RWXU|STAT_RGRP|STAT_XGRP)) { + if (get_options()->HiddenServiceDirGroupReadable) { + /* Only new dirs created get new opts, also enforce group read. */ + if (chmod(s->directory, 0750)) { log_warn(LD_FS,"Unable to make %s group-readable.", s->directory); } } @@ -751,9 +748,9 @@ rend_service_load_keys(rend_service_t *s) return -1; } #ifndef _WIN32 - if (get_options()->HiddenServiceGroupReadable) { - /** Also verify hostname file created with group read. */ - if (chmod(fname, STAT_RUSR|STAT_WUSR|STAT_RGRP)) { + if (get_options()->HiddenServiceDirGroupReadable) { + /* Also verify hostname file created with group read. */ + if (chmod(fname, 0640)) { log_warn(LD_FS,"Unable to make hidden hostname file %s group-readable.", fname); } } |