Merge branch 'maint-0.3.5' into maint-0.4.2

This commit is contained in:
Alexander Færøy 2020-06-30 14:03:04 +00:00
commit c9c4a3d0f6
3 changed files with 24 additions and 11 deletions

3
changes/ticket33361 Normal file
View File

@ -0,0 +1,3 @@
o Minor bugfix (relay, configuration):
- Now warn if the ContactInfo field is not set and mention that the relay
might get rejected if so. Fixes bug 33361; bugfix on 0.1.1.10-alpha.

View File

@ -3439,10 +3439,15 @@ options_validate(or_options_t *old_options, or_options_t *options,
}
}
if (server_mode(options) && !options->ContactInfo)
log_notice(LD_CONFIG, "Your ContactInfo config option is not set. "
"Please consider setting it, so we can contact you if your server is "
"misconfigured or something else goes wrong.");
if (server_mode(options) && !options->ContactInfo) {
log_warn(LD_CONFIG,
"Your ContactInfo config option is not set. Please strongly "
"consider setting it, so we can contact you if your relay is "
"misconfigured, end-of-life, or something else goes wrong. "
"It is also possible that your relay might get rejected from "
"the network due to a missing valid contact address.");
}
const char *ContactInfo = options->ContactInfo;
if (ContactInfo && !string_is_utf8(ContactInfo, strlen(ContactInfo)))
REJECT("ContactInfo config option must be UTF-8.");

View File

@ -494,7 +494,8 @@ test_options_validate__uname_for_server(void *ignored)
#endif
options_test_data_t *tdata = get_options_test_data(
"ORPort 127.0.0.1:5555");
"ORPort 127.0.0.1:5555\n"
"ContactInfo nobody@example.com");
setup_capture_of_logs(LOG_WARN);
MOCK(get_uname, fixed_get_uname);
@ -642,9 +643,11 @@ test_options_validate__contactinfo(void *ignored)
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, -1);
expect_log_msg(
"Your ContactInfo config option is not"
" set. Please consider setting it, so we can contact you if your"
" server is misconfigured or something else goes wrong.\n");
"Your ContactInfo config option is not set. Please strongly "
"consider setting it, so we can contact you if your relay is "
"misconfigured, end-of-life, or something else goes wrong. It "
"is also possible that your relay might get rejected from the "
"network due to a missing valid contact address.\n");
tor_free(msg);
free_options_test_data(tdata);
@ -654,9 +657,11 @@ test_options_validate__contactinfo(void *ignored)
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, -1);
expect_no_log_msg(
"Your ContactInfo config option is not"
" set. Please consider setting it, so we can contact you if your"
" server is misconfigured or something else goes wrong.\n");
"Your ContactInfo config option is not set. Please strongly "
"consider setting it, so we can contact you if your relay is "
"misconfigured, end-of-life, or something else goes wrong. It "
"is also possible that your relay might get rejected from the "
"network due to a missing valid contact address.\n");
tor_free(msg);
done: