size_t plaintext_len,
char **err_msg_out);
-static int rend_service_check_private_dir(const rend_service_t *s, int create);
+static int rend_service_check_private_dir(const or_options_t *options,
+ const rend_service_t *s,
+ int create);
/** Represents the mapping from a virtual port of a rendezvous service to
* a real port on some IP.
for (line = options->RendConfigLines; line; line = line->next) {
if (!strcasecmp(line->key, "HiddenServiceDir")) {
if (service) { /* register the one we just finished parsing */
- if (rend_service_check_private_dir(service, 0) < 0) {
+ if (rend_service_check_private_dir(options, service, 0) < 0) {
rend_service_free(service);
return -1;
}
}
}
if (service) {
- if (rend_service_check_private_dir(service, 0) < 0) {
+ if (rend_service_check_private_dir(options, service, 0) < 0) {
rend_service_free(service);
return -1;
}
}
/* Make sure the directory exists */
- if (rend_service_check_private_dir(service, 1) < 0)
+ if (rend_service_check_private_dir(get_options(), service, 1) < 0)
return -1;
poison_fname = rend_service_sos_poison_path(service);
return 0;
}
-/** Make sure that the directory for <b>s</b> is private.
+/** Make sure that the directory for <b>s</b> is private, using the config in
+ * <b>options</b>.
* If <b>create</b> is true:
* - if the directory exists, change permissions if needed,
* - if the directory does not exist, create it with the correct permissions.
* - if the directory does not exist, check if we think we can create it.
* Return 0 on success, -1 on failure. */
static int
-rend_service_check_private_dir(const rend_service_t *s, int create)
+rend_service_check_private_dir(const or_options_t *options,
+ const rend_service_t *s,
+ int create)
{
cpd_check_t check_opts = CPD_NONE;
if (create) {
check_opts |= CPD_GROUP_READ;
}
/* Check/create directory */
- if (check_private_dir(s->directory, check_opts, get_options()->User) < 0) {
+ if (check_private_dir(s->directory, check_opts, options->User) < 0) {
return -1;
}
return 0;
char *fname = NULL;
char buf[128];
- if (rend_service_check_private_dir(s, 1) < 0)
+ if (rend_service_check_private_dir(get_options(), s, 1) < 0)
goto err;
/* Load key */