[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] When we get a bad nickname, explain what a good one is.



commit 7532cd439bc7d95a7c38b3c72bed0b3e46a26fa2
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Thu Apr 7 10:54:53 2016 -0400

    When we get a bad nickname, explain what a good one is.
    
    Closes #18300; patch from "icanhasaccount".
---
 changes/bug18300                    | 3 +++
 src/config/torrc.minimal.in-staging | 2 ++
 src/config/torrc.sample.in          | 2 ++
 src/or/config.c                     | 3 ++-
 src/test/test_options.c             | 5 +++--
 5 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/changes/bug18300 b/changes/bug18300
new file mode 100644
index 0000000..791752a
--- /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 248cb5c..d4dfd5f 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 248cb5c..d4dfd5f 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 ed436f9..6f9854f 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 bd00e61..d0a0bef 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);

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits