From 85bfad1875994dee84eab8fff49189ba2be0b532 Mon Sep 17 00:00:00 2001 From: meejah Date: Wed, 10 Dec 2014 22:15:04 -0700 Subject: [PATCH] Pre-check hidden-service-dir permissions/ownership See ticket #13942 where Tor dies if you feed it a hidden service directory with the wrong owner via SETCONF. --- changes/bug13942 | 5 +++++ src/or/rendservice.c | 10 ++++++++++ 2 files changed, 15 insertions(+) create mode 100644 changes/bug13942 diff --git a/changes/bug13942 b/changes/bug13942 new file mode 100644 index 0000000000..c1247b6ac5 --- /dev/null +++ b/changes/bug13942 @@ -0,0 +1,5 @@ + o Minor bugfixes (hidden services): + - Pre-check directory permissions for new hidden-services to avoid + at least one case of "Bug: Acting on config options left us in a + broken state. Dying." + diff --git a/src/or/rendservice.c b/src/or/rendservice.c index 26e5659123..a354d9062c 100644 --- a/src/or/rendservice.c +++ b/src/or/rendservice.c @@ -531,6 +531,16 @@ rend_config_services(const or_options_t *options, int validate_only) } } if (service) { + cpd_check_t check_opts = CPD_CHECK_MODE_ONLY; + if (service->dir_group_readable) { + check_opts |= CPD_GROUP_READ; + } + + if (check_private_dir(service->directory, check_opts, options->User) < 0) { + rend_service_free(service); + return -1; + } + if (validate_only) { rend_service_free(service); } else {