Remove some dead checks

The only code that could set these options to be negative was in the
unit tests.
This commit is contained in:
Nick Mathewson 2020-01-17 08:31:18 -05:00
parent 648e1afc33
commit 6d2b9c9631
2 changed files with 1 additions and 29 deletions

View File

@ -403,12 +403,6 @@ dirauth_options_pre_normalize(void *arg, char **msg_out)
"AuthDirGuardBWGuarantee", msg_out) < 0)
return -1;
if (options->MinUptimeHidServDirectoryV2 < 0) {
log_warn(LD_CONFIG, "MinUptimeHidServDirectoryV2 option must be at "
"least 0 seconds. Changing to 0.");
options->MinUptimeHidServDirectoryV2 = 0;
}
return 0;
}
@ -437,9 +431,7 @@ dirauth_options_validate(const void *arg, char **msg)
t = format_recommended_version_list(options->RecommendedServerVersions, 1);
tor_free(t);
if (options->TestingAuthDirTimeToLearnReachability < 0) {
REJECT("TestingAuthDirTimeToLearnReachability must be non-negative.");
} else if (options->TestingAuthDirTimeToLearnReachability > 2*60*60) {
if (options->TestingAuthDirTimeToLearnReachability > 2*60*60) {
COMPLAIN("TestingAuthDirTimeToLearnReachability is insanely high.");
}

View File

@ -991,19 +991,6 @@ test_options_validate__authdir(void *ignored)
"but ClientOnly also set.");
tor_free(msg);
free_options_test_data(tdata);
tdata = get_options_test_data(ENABLE_AUTHORITY_V3);
/* We have to set this value manually, because it won't parse */
get_dirauth_options(tdata->opt)->MinUptimeHidServDirectoryV2 = -1;
mock_clean_saved_logs();
ret = options_validate(NULL, tdata->opt, &msg);
tt_int_op(ret, OP_EQ, 0);
expect_log_msg("MinUptimeHidServDirectoryV2 "
"option must be at least 0 seconds. Changing to 0.\n");
tt_int_op(get_dirauth_options(tdata->opt)->MinUptimeHidServDirectoryV2,
OP_EQ, 0);
tor_free(msg);
done:
teardown_capture_of_logs();
// sandbox_free_getaddrinfo_cache();
@ -3879,13 +3866,6 @@ test_options_validate__testing_options(void *ignored)
tor_free(msg); \
STMT_END
TEST_TESTING_OPTION(TestingAuthDirTimeToLearnReachability,
get_dirauth_options, -1, 8000,
"must be non-negative.", ENABLE_AUTHORITY_V3);
TEST_TESTING_OPTION(TestingAuthDirTimeToLearnReachability,
get_dirauth_options, -1, 8000,
"must be non-negative.", ENABLE_AUTHORITY_BRIDGE);
TEST_TESTING_OPTION(TestingEstimatedDescriptorPropagationTime, , -1, 3601,
"must be non-negative.", "");
TEST_TESTING_OPTION(TestingClientMaxIntervalWithoutRequest, , -1, 3601,