From: Roger Dingledine Date: Sun, 7 Nov 2004 11:33:04 +0000 (+0000) Subject: allow unauth control connections for now X-Git-Tag: debian-version-0.0.8+0.0.9pre5-1~82 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3236ee3127c5cbb9e1de87e1a1d74cd6454888c9;p=thirdparty%2Ftor.git allow unauth control connections for now let control connections recognize eof svn:r2699 --- 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)) {