[tor-commits] [tor/master] allow manual control port authenticate via netcat

nickm at torproject.org nickm at torproject.org
Wed Nov 16 22:27:53 UTC 2011


commit 67650a869db43f90aa8aa4b7a605afa99ddbd557
Author: Roger Dingledine <arma at torproject.org>
Date:   Mon Apr 11 16:51:10 2011 -0400

    allow manual control port authenticate via netcat
---
 changes/bug2893  |    5 +++++
 src/or/control.c |    8 ++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/changes/bug2893 b/changes/bug2893
new file mode 100644
index 0000000..f6d235c
--- /dev/null
+++ b/changes/bug2893
@@ -0,0 +1,5 @@
+  o Minor bugfixes:
+    - Allow manual 'authenticate' commands to the controller interface
+      from nc as well as telnet. We were rejecting them because they
+      didn't come with the expected whitespace at the end of the command.
+      Bugfix on 0.1.1.1-alpha; fixes bug 2893.
diff --git a/src/or/control.c b/src/or/control.c
index 7785ec5..4d86a23 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -1055,7 +1055,10 @@ handle_control_authenticate(control_connection_t *conn, uint32_t len,
   int bad_cookie=0, bad_password=0;
   smartlist_t *sl = NULL;
 
-  if (TOR_ISXDIGIT(body[0])) {
+  if (!len || TOR_ISSPACE(body[0])) {
+    password = tor_strdup("");
+    password_len = 0;
+  } else if (TOR_ISXDIGIT(body[0])) {
     cp = body;
     while (TOR_ISXDIGIT(*cp))
       ++cp;
@@ -1072,9 +1075,6 @@ handle_control_authenticate(control_connection_t *conn, uint32_t len,
       tor_free(password);
       return 0;
     }
-  } else if (TOR_ISSPACE(body[0])) {
-    password = tor_strdup("");
-    password_len = 0;
   } else {
     if (!decode_escaped_string(body, len, &password, &password_len)) {
       connection_write_str_to_buf("551 Invalid quoted string.  You need "





More information about the tor-commits mailing list