summaryrefslogtreecommitdiff
path: root/src/or/rendservice.c
diff options
context:
space:
mode:
authorDavid Stainton <dstainton415@gmail.com>2014-08-29 05:58:53 +0000
committermeejah <meejah@meejah.ca>2014-08-30 15:23:05 -0600
commit227b65924b557b30855f659360a8547e352c1ec6 (patch)
tree3ccf6d23be24357d0c23a5014a0cdbfa5f56ba64 /src/or/rendservice.c
parentc13db1f6143cf99830dc73dd527898e711e6b704 (diff)
downloadtor-227b65924b557b30855f659360a8547e352c1ec6.tar.gz
tor-227b65924b557b30855f659360a8547e352c1ec6.zip
Clean up patch
Here I clean up anon's patch with a few of nickm's suggestions from comment 12: https://trac.torproject.org/projects/tor/ticket/11291#comment:12 I did not yet completely implement all his suggestions.
Diffstat (limited to 'src/or/rendservice.c')
-rw-r--r--src/or/rendservice.c23
1 files changed, 10 insertions, 13 deletions
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);
}
}