When we get a bad nickname, explain what a good one is.

Closes #18300; patch from "icanhasaccount".
This commit is contained in:
Nick Mathewson 2016-04-07 10:54:53 -04:00
parent e703484722
commit 7532cd439b
5 changed files with 12 additions and 3 deletions

3
changes/bug18300 Normal file
View File

@ -0,0 +1,3 @@
o Minor features (logging):
- Provide a more useful warning message when configured with an
invalid Nickname. Closes ticket 18300; patch from "icanhasaccount".

View File

@ -98,6 +98,8 @@
# OutboundBindAddress 10.0.0.5
## A handle for your relay, so people don't have to refer to it by key.
## Nicknames must be between 1 and 19 characters inclusive, and must
## contain only the characters [a-zA-Z0-9].
#Nickname ididnteditheconfig
## Define these to limit how much relayed traffic you will allow. Your

View File

@ -98,6 +98,8 @@
# OutboundBindAddress 10.0.0.5
## A handle for your relay, so people don't have to refer to it by key.
## Nicknames must be between 1 and 19 characters inclusive, and must
## contain only the characters [a-zA-Z0-9].
#Nickname ididnteditheconfig
## Define these to limit how much relayed traffic you will allow. Your

View File

@ -2796,7 +2796,8 @@ options_validate(or_options_t *old_options, or_options_t *options,
} else {
if (!is_legal_nickname(options->Nickname)) {
tor_asprintf(msg,
"Nickname '%s' is wrong length or contains illegal characters.",
"Nickname '%s', nicknames must be between 1 and 19 characters "
"inclusive, and must contain only the characters [a-zA-Z0-9].",
options->Nickname);
return -1;
}

View File

@ -513,8 +513,9 @@ test_options_validate__nickname(void *ignored)
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, -1);
tt_str_op(msg, OP_EQ,
"Nickname 'ThisNickNameIsABitTooLong' is wrong length or"
" contains illegal characters.");
"Nickname 'ThisNickNameIsABitTooLong', nicknames must be between "
"1 and 19 characters inclusive, and must contain only the "
"characters [a-zA-Z0-9].");
tor_free(msg);
free_options_test_data(tdata);