summaryrefslogtreecommitdiff
path: root/src/or/rendservice.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2016-12-22 16:40:21 -0500
committerDavid Goulet <dgoulet@torproject.org>2017-04-07 09:22:52 -0400
commit419c0c07881c71050546c1049173a7eadf936799 (patch)
treea5b371cbea93ae0bdeec9c9b135451d07cc185f7 /src/or/rendservice.c
parent489ef6b38ba66f59bb6562a4702c0500478a7495 (diff)
downloadtor-419c0c07881c71050546c1049173a7eadf936799.tar.gz
tor-419c0c07881c71050546c1049173a7eadf936799.zip
hs: Move service check private dir to hs_common.c
Another building blocks for prop224 service work. This also makes the function takes specific argument instead of the or_option_t object. Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/rendservice.c')
-rw-r--r--src/or/rendservice.c35
1 files changed, 4 insertions, 31 deletions
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index ac231c2d1f..6b40ed980a 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -76,9 +76,6 @@ static ssize_t rend_service_parse_intro_for_v3(
static int rend_service_check_private_dir(const or_options_t *options,
const rend_service_t *s,
int create);
-static int rend_service_check_private_dir_impl(const or_options_t *options,
- const rend_service_t *s,
- int create);
static const smartlist_t* rend_get_service_list(
const smartlist_t* substitute_service_list);
static smartlist_t* rend_get_service_list_mutable(
@@ -1294,7 +1291,8 @@ poison_new_single_onion_hidden_service_dir_impl(const rend_service_t *service,
}
/* Make sure the directory was created before calling this function. */
- if (BUG(rend_service_check_private_dir_impl(options, service, 0) < 0))
+ if (BUG(hs_check_service_private_dir(options->User, service->directory,
+ service->dir_group_readable, 0) < 0))
return -1;
poison_fname = rend_service_sos_poison_path(service);
@@ -1444,32 +1442,6 @@ rend_service_derive_key_digests(struct rend_service_t *s)
return 0;
}
-/* Implements the directory check from rend_service_check_private_dir,
- * without doing the single onion poison checks. */
-static int
-rend_service_check_private_dir_impl(const or_options_t *options,
- const rend_service_t *s,
- int create)
-{
- cpd_check_t check_opts = CPD_NONE;
- if (create) {
- check_opts |= CPD_CREATE;
- } else {
- check_opts |= CPD_CHECK_MODE_ONLY;
- check_opts |= CPD_CHECK;
- }
- if (s->dir_group_readable) {
- check_opts |= CPD_GROUP_READ;
- }
- /* Check/create directory */
- if (check_private_dir(s->directory, check_opts, options->User) < 0) {
- log_warn(LD_REND, "Checking service directory %s failed.", s->directory);
- return -1;
- }
-
- return 0;
-}
-
/** Make sure that the directory for <b>s</b> is private, using the config in
* <b>options</b>.
* If <b>create</b> is true:
@@ -1490,7 +1462,8 @@ rend_service_check_private_dir(const or_options_t *options,
}
/* Check/create directory */
- if (rend_service_check_private_dir_impl(options, s, create) < 0) {
+ if (hs_check_service_private_dir(options->User, s->directory,
+ s->dir_group_readable, create) < 0) {
return -1;
}