Browse Source

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

Closes #18300; patch from "icanhasaccount".
Nick Mathewson 8 years ago
parent
commit
7532cd439b

+ 3 - 0
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".

+ 2 - 0
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

+ 2 - 0
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

+ 2 - 1
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;
     }

+ 3 - 2
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);