diff --git a/changes/bug5283 b/changes/bug5283 new file mode 100644 index 0000000000000000000000000000000000000000..f0325cf26c1eec511081925ce90ca40710a0ee02 --- /dev/null +++ b/changes/bug5283 @@ -0,0 +1,6 @@ + o Major bugfixes: + - Fix an edge case where if we fetch or publish a hidden service + descriptor, we might build a 4-hop circuit and then use that circuit + for exiting afterwards -- even if the new last hop doesn't obey our + ExitNodes config option. Fixes bug 5283; bugfix on 0.2.0.10-alpha. + diff --git a/src/or/circuituse.c b/src/or/circuituse.c index de0aa7da20a48e2493977888e0a975448519ff80..6f4202ea218d2c69892fa050cc0133116c8421b6 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -1412,7 +1412,13 @@ circuit_get_open_circ_or_launch(entry_connection_t *conn, need_uptime = !conn->want_onehop && !conn->use_begindir && smartlist_string_num_isin(options->LongLivedPorts, conn->socks_request->port); - need_internal = desired_circuit_purpose != CIRCUIT_PURPOSE_C_GENERAL; + + if (desired_circuit_purpose != CIRCUIT_PURPOSE_C_GENERAL) + need_internal = 1; + else if (conn->use_begindir || conn->want_onehop) + need_internal = 1; + else + need_internal = 0; circ = circuit_get_best(conn, 1, desired_circuit_purpose, need_uptime, need_internal);