summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-11-16 17:30:24 -0500
committerNick Mathewson <nickm@torproject.org>2011-11-16 17:30:24 -0500
commit240893451694a19a3cf9ba7ddcaea6bb37581406 (patch)
tree93ad25ff7e0046167e093ed1b64d51a7853cc1c0
parent07a5fd10544be1ce382e02824617685d960ab3b7 (diff)
parent7bd46344df500439e0c90aaec23d8a61f055e7d9 (diff)
downloadtor-240893451694a19a3cf9ba7ddcaea6bb37581406.tar.gz
tor-240893451694a19a3cf9ba7ddcaea6bb37581406.zip
Merge remote-tracking branch 'sebastian/bug2893'
-rw-r--r--changes/bug28935
-rw-r--r--src/or/control.c10
2 files changed, 10 insertions, 5 deletions
diff --git a/changes/bug2893 b/changes/bug2893
new file mode 100644
index 0000000000..f6d235cf53
--- /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 7785ec5f3f..109eb8857b 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) {
+ 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 "
@@ -3118,7 +3118,7 @@ connection_control_process_inbuf(control_connection_t *conn)
args = conn->incoming_cmd+cmd_len+1;
tor_assert(data_len>(size_t)cmd_len);
data_len -= (cmd_len+1); /* skip the command and NUL we added after it */
- while (*args == ' ' || *args == '\t') {
+ while (TOR_ISSPACE(*args)) {
++args;
--data_len;
}