|
@@ -654,7 +654,7 @@ static int parse_ports(or_options_t *options, int validate_only,
|
|
static int check_server_ports(const smartlist_t *ports,
|
|
static int check_server_ports(const smartlist_t *ports,
|
|
const or_options_t *options,
|
|
const or_options_t *options,
|
|
int *num_low_ports_out);
|
|
int *num_low_ports_out);
|
|
-
|
|
|
|
|
|
+static int check_bridge_distribution_setting(const char *bd);
|
|
static int validate_data_directory(or_options_t *options);
|
|
static int validate_data_directory(or_options_t *options);
|
|
static int write_configuration_file(const char *fname,
|
|
static int write_configuration_file(const char *fname,
|
|
const or_options_t *options);
|
|
const or_options_t *options);
|
|
@@ -3347,10 +3347,16 @@ options_validate(or_options_t *old_options, or_options_t *options,
|
|
options->DirPort_set = 0;
|
|
options->DirPort_set = 0;
|
|
}
|
|
}
|
|
|
|
|
|
- if (options->BridgeDistribution && !options->BridgeRelay) {
|
|
|
|
- REJECT("You have set BridgeDistribution, yet you didn't set BridgeRelay!");
|
|
|
|
|
|
+ if (options->BridgeDistribution) {
|
|
|
|
+ if (!options->BridgeRelay) {
|
|
|
|
+ REJECT("You set BridgeDistribution, but you didn't set BridgeRelay!");
|
|
|
|
+ }
|
|
|
|
+ if (check_bridge_distribution_setting(options->BridgeDistribution) < 0) {
|
|
|
|
+ REJECT("Invalid BridgeDistribution value.");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
if (options->MinUptimeHidServDirectoryV2 < 0) {
|
|
if (options->MinUptimeHidServDirectoryV2 < 0) {
|
|
log_warn(LD_CONFIG, "MinUptimeHidServDirectoryV2 option must be at "
|
|
log_warn(LD_CONFIG, "MinUptimeHidServDirectoryV2 option must be at "
|
|
"least 0 seconds. Changing to 0.");
|
|
"least 0 seconds. Changing to 0.");
|
|
@@ -6344,6 +6350,37 @@ warn_client_dns_cache(const char *option, int disabling)
|
|
"to your destination.");
|
|
"to your destination.");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/** Warn if <b>bd</b> is an unrecognized bridge distribution setting;
|
|
|
|
+ * return -1 if it is invalid. */
|
|
|
|
+static int
|
|
|
|
+check_bridge_distribution_setting(const char *bd)
|
|
|
|
+{
|
|
|
|
+ if (bd == NULL)
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+ const char *RECOGNIZED[] = {
|
|
|
|
+ "none", "any", "https", "email", "moat", "hyphae"
|
|
|
|
+ };
|
|
|
|
+ unsigned i;
|
|
|
|
+ for (i = 0; i < ARRAY_LENGTH(RECOGNIZED); ++i) {
|
|
|
|
+ if (!strcmp(bd, RECOGNIZED[i]))
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const char *cp = bd;
|
|
|
|
+ // Method = (KeywordChar | "_") +
|
|
|
|
+ while (TOR_ISALNUM(*cp) || *cp == '-' || *cp == '_')
|
|
|
|
+ ++cp;
|
|
|
|
+
|
|
|
|
+ if (*cp == 0) {
|
|
|
|
+ log_warn(LD_CONFIG, "Unrecognized BridgeDistribution value %s. I'll "
|
|
|
|
+ "assume you know what you are doing...", escaped(bd));
|
|
|
|
+ return 0; // we reached the end of the string; all is well
|
|
|
|
+ } else {
|
|
|
|
+ return -1; // we found a bad character in the string.
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Parse port configuration for a single port type.
|
|
* Parse port configuration for a single port type.
|
|
*
|
|
*
|