Fix a bug introduced by purging rend_cache on NEWNYM

If the user sent a SIGNAL NEWNYM command after we fetched a rendezvous
descriptor, while we were building the introduction-point circuit, we
would give up entirely on trying to connect to the hidden service.

Original patch by rransom slightly edited to go into 0.2.1
This commit is contained in:
Robert Ransom 2011-04-25 06:38:35 -07:00 committed by Sebastian Hahn
parent 2ad18ae736
commit f1cf9bd74d

View File

@ -74,10 +74,27 @@ rend_client_send_introduction(origin_circuit_t *introcirc,
if (rend_cache_lookup_entry(introcirc->rend_data->onion_address, -1, if (rend_cache_lookup_entry(introcirc->rend_data->onion_address, -1,
&entry) < 1) { &entry) < 1) {
log_warn(LD_REND, log_info(LD_REND,
"query %s didn't have valid rend desc in cache. Failing.", "query %s didn't have valid rend desc in cache. "
escaped_safe_str(introcirc->rend_data->onion_address)); "Refetching descriptor.",
goto perm_err; safe_str(introcirc->rend_data->onion_address));
/* Fetch both v0 and v2 rend descriptors in parallel. Use whichever
* arrives first. Exception: When using client authorization, only
* fetch v2 descriptors.*/
rend_client_refetch_v2_renddesc(introcirc->rend_data);
if (introcirc->rend_data->auth_type == REND_NO_AUTH)
rend_client_refetch_renddesc(introcirc->rend_data->onion_address);
{
connection_t *conn;
while ((conn = connection_get_by_type_state_rendquery(CONN_TYPE_AP,
AP_CONN_STATE_CIRCUIT_WAIT,
introcirc->rend_data->onion_address, -1))) {
conn->state = AP_CONN_STATE_RENDDESC_WAIT;
}
}
return -1;
} }
/* first 20 bytes of payload are the hash of Bob's pk */ /* first 20 bytes of payload are the hash of Bob's pk */