|
@@ -2298,34 +2298,34 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
|
|
|
rend_cache_entry_t *entry = NULL;
|
|
|
|
|
|
if (rend_cache_store_v2_desc_as_client(body,
|
|
|
- conn->requested_resource, conn->rend_data, &entry) < 0) {
|
|
|
- log_warn(LD_REND,"Fetching v2 rendezvous descriptor failed. "
|
|
|
- "Retrying at another directory.");
|
|
|
- /* We'll retry when connection_about_to_close_connection()
|
|
|
- * cleans this dir conn up. */
|
|
|
- SEND_HS_DESC_FAILED_EVENT("BAD_DESC");
|
|
|
- SEND_HS_DESC_FAILED_CONTENT();
|
|
|
- break;
|
|
|
+ conn->requested_resource, conn->rend_data, &entry) < 0) {
|
|
|
+ log_warn(LD_REND,"Fetching v2 rendezvous descriptor failed. "
|
|
|
+ "Retrying at another directory.");
|
|
|
+ /* We'll retry when connection_about_to_close_connection()
|
|
|
+ * cleans this dir conn up. */
|
|
|
+ SEND_HS_DESC_FAILED_EVENT("BAD_DESC");
|
|
|
+ SEND_HS_DESC_FAILED_CONTENT();
|
|
|
+ break;
|
|
|
} else {
|
|
|
- char service_id[REND_SERVICE_ID_LEN_BASE32 + 1];
|
|
|
- /* Should never be NULL here if we found the descriptor. */
|
|
|
- tor_assert(entry);
|
|
|
- rend_get_service_id(entry->parsed->pk, service_id);
|
|
|
-
|
|
|
- /* success. notify pending connections about this. */
|
|
|
- log_info(LD_REND, "Successfully fetched v2 rendezvous "
|
|
|
- "descriptor.");
|
|
|
- control_event_hs_descriptor_received(service_id,
|
|
|
- conn->rend_data,
|
|
|
- conn->identity_digest);
|
|
|
- control_event_hs_descriptor_content(service_id,
|
|
|
- conn->requested_resource,
|
|
|
- conn->identity_digest,
|
|
|
- body);
|
|
|
- conn->base_.purpose = DIR_PURPOSE_HAS_FETCHED_RENDDESC_V2;
|
|
|
- rend_client_desc_trynow(service_id);
|
|
|
- memwipe(service_id, 0, sizeof(service_id));
|
|
|
- break;
|
|
|
+ char service_id[REND_SERVICE_ID_LEN_BASE32 + 1];
|
|
|
+ /* Should never be NULL here if we found the descriptor. */
|
|
|
+ tor_assert(entry);
|
|
|
+ rend_get_service_id(entry->parsed->pk, service_id);
|
|
|
+
|
|
|
+ /* success. notify pending connections about this. */
|
|
|
+ log_info(LD_REND, "Successfully fetched v2 rendezvous "
|
|
|
+ "descriptor.");
|
|
|
+ control_event_hs_descriptor_received(service_id,
|
|
|
+ conn->rend_data,
|
|
|
+ conn->identity_digest);
|
|
|
+ control_event_hs_descriptor_content(service_id,
|
|
|
+ conn->requested_resource,
|
|
|
+ conn->identity_digest,
|
|
|
+ body);
|
|
|
+ conn->base_.purpose = DIR_PURPOSE_HAS_FETCHED_RENDDESC_V2;
|
|
|
+ rend_client_desc_trynow(service_id);
|
|
|
+ memwipe(service_id, 0, sizeof(service_id));
|
|
|
+ break;
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
@@ -3429,13 +3429,13 @@ directory_handle_command_post(dir_connection_t *conn, const char *headers,
|
|
|
if (connection_dir_is_encrypted(conn) &&
|
|
|
!strcmpstart(url,"/tor/rendezvous2/publish")) {
|
|
|
if (rend_cache_store_v2_desc_as_dir(body) < 0) {
|
|
|
- log_warn(LD_REND, "Rejected v2 rend descriptor (length %d) from %s.",
|
|
|
- (int)body_len, conn->base_.address);
|
|
|
- write_http_status_line(conn, 400,
|
|
|
- "Invalid v2 service descriptor rejected");
|
|
|
+ log_warn(LD_REND, "Rejected v2 rend descriptor (length %d) from %s.",
|
|
|
+ (int)body_len, conn->base_.address);
|
|
|
+ write_http_status_line(conn, 400,
|
|
|
+ "Invalid v2 service descriptor rejected");
|
|
|
} else {
|
|
|
- write_http_status_line(conn, 200, "Service descriptor (v2) stored");
|
|
|
- log_info(LD_REND, "Handled v2 rendezvous descriptor post: accepted");
|
|
|
+ write_http_status_line(conn, 200, "Service descriptor (v2) stored");
|
|
|
+ log_info(LD_REND, "Handled v2 rendezvous descriptor post: accepted");
|
|
|
}
|
|
|
goto done;
|
|
|
}
|