diff options
author | Roger Dingledine <arma@torproject.org> | 2004-11-07 11:33:04 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-11-07 11:33:04 +0000 |
commit | 3236ee3127c5cbb9e1de87e1a1d74cd6454888c9 (patch) | |
tree | 222eaa585eb77b5412df7d74a4ea0a14892600ae | |
parent | 394554cfbf49624d537360ee89afc7032fa369e2 (diff) | |
download | tor-3236ee3127c5cbb9e1de87e1a1d74cd6454888c9.tar.gz tor-3236ee3127c5cbb9e1de87e1a1d74cd6454888c9.zip |
allow unauth control connections for now
let control connections recognize eof
svn:r2699
-rw-r--r-- | src/or/control.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/or/control.c b/src/or/control.c index 5a2f68777d..571a4a7607 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -248,7 +248,8 @@ static int handle_control_authenticate(connection_t *conn, uint16_t len, authentication_cookie_is_set && !memcmp(authentication_cookie, body, len)) { goto ok; - } else if (options->HashedControlPassword) { + } + if (options->HashedControlPassword) { char expected[S2K_SPECIFIER_LEN+DIGEST_LEN]; char received[DIGEST_LEN]; if (base64_decode(expected,sizeof(expected), @@ -262,6 +263,9 @@ static int handle_control_authenticate(connection_t *conn, uint16_t len, if (!memcmp(expected+S2K_SPECIFIER_LEN, received, DIGEST_LEN)) goto ok; } + if (len == 0) { /* accept it for now */ + goto ok; + } err: send_control_error(conn, ERR_FAILED_AUTHENTICATION,"Authentication failed"); @@ -271,7 +275,6 @@ static int handle_control_authenticate(connection_t *conn, uint16_t len, send_control_done(conn); conn->state = CONTROL_CONN_STATE_OPEN; return 0; - } int connection_control_finished_flushing(connection_t *conn) { @@ -289,6 +292,12 @@ int connection_control_process_inbuf(connection_t *conn) { tor_assert(conn); tor_assert(conn->type == CONN_TYPE_CONTROL); + if(conn->inbuf_reached_eof) { + log_fn(LOG_INFO,"Control connection reached EOF. Closing."); + connection_mark_for_close(conn); + return 0; + } + again: switch(fetch_from_buf_control(conn->inbuf, &body_len, &command_type, &body)) { |