aboutsummaryrefslogtreecommitdiff
path: root/src/or/command.c
diff options
context:
space:
mode:
authorSebastian Hahn <sebastian@torproject.org>2011-10-27 00:15:25 +0200
committerSebastian Hahn <sebastian@torproject.org>2011-10-27 00:38:45 +0200
commit2dec6597af4014eb731d8caac55a8a87964ce371 (patch)
treebb2b9020ab2d67f46a619026530c57ec607c07bb /src/or/command.c
parent2c4e89b86703f188f45f9edfc0fd3e4bbeac3511 (diff)
parent4684ced1b3fced0543fa65bf01f75c5d81eaf464 (diff)
downloadtor-2dec6597af4014eb731d8caac55a8a87964ce371.tar.gz
tor-2dec6597af4014eb731d8caac55a8a87964ce371.zip
Merge branch 'maint-0.2.2_secfix' into master_secfix
Conflicts: src/common/tortls.c src/or/connection_or.c src/or/dirserv.c src/or/or.h
Diffstat (limited to 'src/or/command.c')
-rw-r--r--src/or/command.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/or/command.c b/src/or/command.c
index c85b057878..d35e2a9c80 100644
--- a/src/or/command.c
+++ b/src/or/command.c
@@ -316,6 +316,7 @@ static void
command_process_create_cell(cell_t *cell, or_connection_t *conn)
{
or_circuit_t *circ;
+ const or_options_t *options = get_options();
int id_is_high;
if (we_are_hibernating()) {
@@ -327,9 +328,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,
@@ -392,7 +395,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.");