diff options
author | Sebastian Hahn <sebastian@torproject.org> | 2011-10-26 23:30:27 +0200 |
---|---|---|
committer | Sebastian Hahn <sebastian@torproject.org> | 2011-10-26 23:30:27 +0200 |
commit | df05e5ef4d5e379e50b38e29fa23228e5b260e8a (patch) | |
tree | 36f76e0bf35cd6a92229114959e200dfe7ce4a17 /src/or/command.c | |
parent | f85c56182f485bea483288a26fd74cefcb87653a (diff) | |
parent | a74e7fd40f1a77eb4000d8216bb5b80cdd8a6193 (diff) | |
download | tor-df05e5ef4d5e379e50b38e29fa23228e5b260e8a.tar.gz tor-df05e5ef4d5e379e50b38e29fa23228e5b260e8a.zip |
Merge branch 'maint-0.2.1_secfix' into maint-0.2.2_secfix
Conflicts:
src/or/connection_or.c
Diffstat (limited to 'src/or/command.c')
-rw-r--r-- | src/or/command.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/or/command.c b/src/or/command.c index 12b4c30f5c..1fa8bc6a7e 100644 --- a/src/or/command.c +++ b/src/or/command.c @@ -232,6 +232,7 @@ static void command_process_create_cell(cell_t *cell, or_connection_t *conn) { or_circuit_t *circ; + or_options_t *options = get_options(); int id_is_high; if (we_are_hibernating()) { @@ -243,9 +244,11 @@ command_process_create_cell(cell_t *cell, or_connection_t *conn) return; } - if (!server_mode(get_options())) { + if (!server_mode(options) || + (!public_server_mode(options) && conn->is_outgoing)) { log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL, - "Received create cell (type %d) from %s:%d, but we're a client. " + "Received create cell (type %d) from %s:%d, but we're connected " + "to it as a client. " "Sending back a destroy.", (int)cell->command, conn->_base.address, conn->_base.port); connection_or_send_destroy(cell->circ_id, conn, @@ -305,7 +308,13 @@ command_process_create_cell(cell_t *cell, or_connection_t *conn) * a CPU worker. */ char keys[CPATH_KEY_MATERIAL_LEN]; char reply[DIGEST_LEN*2]; + tor_assert(cell->command == CELL_CREATE_FAST); + + /* Make sure we never try to use the OR connection on which we + * received this cell to satisfy an EXTEND request, */ + conn->is_connection_with_client = 1; + if (fast_server_handshake(cell->payload, (uint8_t*)reply, (uint8_t*)keys, sizeof(keys))<0) { log_warn(LD_OR,"Failed to generate key material. Closing."); |