summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-04-07 10:54:53 -0400
committerNick Mathewson <nickm@torproject.org>2016-04-07 10:54:53 -0400
commit7532cd439bc7d95a7c38b3c72bed0b3e46a26fa2 (patch)
tree18408ee1638ee7966ad9624b8b545754fb825949
parente7034847225b1ca39dfb122e04006728d31f8db6 (diff)
downloadtor-7532cd439bc7d95a7c38b3c72bed0b3e46a26fa2.tar.gz
tor-7532cd439bc7d95a7c38b3c72bed0b3e46a26fa2.zip
When we get a bad nickname, explain what a good one is.
Closes #18300; patch from "icanhasaccount".
-rw-r--r--changes/bug183003
-rw-r--r--src/config/torrc.minimal.in-staging2
-rw-r--r--src/config/torrc.sample.in2
-rw-r--r--src/or/config.c3
-rw-r--r--src/test/test_options.c5
5 files changed, 12 insertions, 3 deletions
diff --git a/changes/bug18300 b/changes/bug18300
new file mode 100644
index 0000000000..791752ae0b
--- /dev/null
+++ b/changes/bug18300
@@ -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".
diff --git a/src/config/torrc.minimal.in-staging b/src/config/torrc.minimal.in-staging
index 248cb5cf02..d4dfd5f6bb 100644
--- a/src/config/torrc.minimal.in-staging
+++ b/src/config/torrc.minimal.in-staging
@@ -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
diff --git a/src/config/torrc.sample.in b/src/config/torrc.sample.in
index 248cb5cf02..d4dfd5f6bb 100644
--- a/src/config/torrc.sample.in
+++ b/src/config/torrc.sample.in
@@ -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
diff --git a/src/or/config.c b/src/or/config.c
index ed436f929f..6f9854f2cc 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -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;
}
diff --git a/src/test/test_options.c b/src/test/test_options.c
index bd00e6105e..d0a0bef4f5 100644
--- a/src/test/test_options.c
+++ b/src/test/test_options.c
@@ -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);