mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-25 15:10:48 +01:00
Use SECTION_HEADER, not "HiddenServiceDir".
Add a nonfatal assertion about a branch that should be unreachable.
This commit is contained in:
parent
8aacd78e14
commit
84868109d2
1 changed files with 13 additions and 10 deletions
|
@ -232,6 +232,12 @@ config_learn_service_version(hs_service_t *service)
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Header key indicating the start of a new hidden service configuration
|
||||||
|
* block.
|
||||||
|
**/
|
||||||
|
static const char SECTION_HEADER[] = "HiddenServiceDir";
|
||||||
|
|
||||||
/** Return true iff the given options starting at line_ for a hidden service
|
/** Return true iff the given options starting at line_ for a hidden service
|
||||||
* contains at least one invalid option. Each hidden service option don't
|
* contains at least one invalid option. Each hidden service option don't
|
||||||
* apply to all versions so this function can find out. The line_ MUST start
|
* apply to all versions so this function can find out. The line_ MUST start
|
||||||
|
@ -286,8 +292,11 @@ config_has_invalid_options(const config_line_t *line_,
|
||||||
for (int i = 0; optlist[i]; i++) {
|
for (int i = 0; optlist[i]; i++) {
|
||||||
const char *opt = optlist[i];
|
const char *opt = optlist[i];
|
||||||
for (line = line_; line; line = line->next) {
|
for (line = line_; line; line = line->next) {
|
||||||
if (!strcasecmp(line->key, "HiddenServiceDir")) {
|
if (!strcasecmp(line->key, SECTION_HEADER)) {
|
||||||
/* We just hit the next hidden service, stop right now. */
|
/* We just hit the next hidden service, stop right now.
|
||||||
|
* (This shouldn't be possible, now that we have partitioned the list
|
||||||
|
* into sections.) */
|
||||||
|
tor_assert_nonfatal_unreached();
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if (!strcasecmp(line->key, opt)) {
|
if (!strcasecmp(line->key, opt)) {
|
||||||
|
@ -428,12 +437,6 @@ config_service_v3(const hs_opts_t *hs_opts,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Header key indicating the start of a new hidden service configuration
|
|
||||||
* block.
|
|
||||||
**/
|
|
||||||
static const char SECTION_HEADER[] = "HiddenServiceDir";
|
|
||||||
|
|
||||||
/** Configure a service using the given options in hs_opts and options. This is
|
/** Configure a service using the given options in hs_opts and options. This is
|
||||||
* called for any service regardless of its version which means that all
|
* called for any service regardless of its version which means that all
|
||||||
* directives in this function are generic to any service version. This
|
* directives in this function are generic to any service version. This
|
||||||
|
@ -462,8 +465,8 @@ config_generic_service(const hs_opts_t *hs_opts,
|
||||||
/* Directory where the service's keys are stored. */
|
/* Directory where the service's keys are stored. */
|
||||||
tor_assert(hs_opts->HiddenServiceDir);
|
tor_assert(hs_opts->HiddenServiceDir);
|
||||||
config->directory_path = tor_strdup(hs_opts->HiddenServiceDir);
|
config->directory_path = tor_strdup(hs_opts->HiddenServiceDir);
|
||||||
log_info(LD_CONFIG, "HiddenServiceDir=%s. Configuring...",
|
log_info(LD_CONFIG, "%s=%s. Configuring...",
|
||||||
escaped(config->directory_path));
|
SECTION_HEADER, escaped(config->directory_path));
|
||||||
|
|
||||||
/* Protocol version for the service. */
|
/* Protocol version for the service. */
|
||||||
if (hs_opts->HiddenServiceVersion == -1) {
|
if (hs_opts->HiddenServiceVersion == -1) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue