|
@@ -170,12 +170,8 @@ dir_conn_purpose_to_string(int purpose)
|
|
|
{
|
|
|
switch (purpose)
|
|
|
{
|
|
|
- case DIR_PURPOSE_FETCH_RENDDESC:
|
|
|
- return "hidden-service descriptor fetch";
|
|
|
case DIR_PURPOSE_UPLOAD_DIR:
|
|
|
return "server descriptor upload";
|
|
|
- case DIR_PURPOSE_UPLOAD_RENDDESC:
|
|
|
- return "hidden-service descriptor upload";
|
|
|
case DIR_PURPOSE_UPLOAD_VOTE:
|
|
|
return "server vote upload";
|
|
|
case DIR_PURPOSE_UPLOAD_SIGNATURES:
|
|
@@ -247,13 +243,13 @@ directories_have_accepted_server_descriptor(void)
|
|
|
|
|
|
* connection purpose <b>dir_purpose</b> and uploading <b>payload</b>
|
|
|
* (of length <b>payload_len</b>). The dir_purpose should be one of
|
|
|
- * 'DIR_PURPOSE_UPLOAD_DIR' or 'DIR_PURPOSE_UPLOAD_RENDDESC'.
|
|
|
+ * 'DIR_PURPOSE_UPLOAD_{DIR|VOTE|SIGNATURES}'.
|
|
|
*
|
|
|
* <b>router_purpose</b> describes the type of descriptor we're
|
|
|
* publishing, if we're publishing a descriptor -- e.g. general or bridge.
|
|
|
*
|
|
|
* <b>type</b> specifies what sort of dir authorities (V1, V3,
|
|
|
- * HIDSERV, BRIDGE, etc) we should upload to.
|
|
|
+ * BRIDGE, etc) we should upload to.
|
|
|
*
|
|
|
* If <b>extrainfo_len</b> is nonzero, the first <b>payload_len</b> bytes of
|
|
|
* <b>payload</b> hold a router descriptor, and the next <b>extrainfo_len</b>
|
|
@@ -410,9 +406,6 @@ directory_get_from_dirserver(uint8_t dir_purpose, uint8_t router_purpose,
|
|
|
type = (router_purpose == ROUTER_PURPOSE_BRIDGE ? BRIDGE_DIRINFO :
|
|
|
V3_DIRINFO);
|
|
|
break;
|
|
|
- case DIR_PURPOSE_FETCH_RENDDESC:
|
|
|
- type = HIDSERV_DIRINFO;
|
|
|
- break;
|
|
|
case DIR_PURPOSE_FETCH_STATUS_VOTE:
|
|
|
case DIR_PURPOSE_FETCH_DETACHED_SIGNATURES:
|
|
|
case DIR_PURPOSE_FETCH_CERTIFICATE:
|
|
@@ -452,7 +445,7 @@ directory_get_from_dirserver(uint8_t dir_purpose, uint8_t router_purpose,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (!options->FetchServerDescriptors && type != HIDSERV_DIRINFO)
|
|
|
+ if (!options->FetchServerDescriptors)
|
|
|
return;
|
|
|
|
|
|
if (!get_via_tor) {
|
|
@@ -523,11 +516,7 @@ directory_get_from_dirserver(uint8_t dir_purpose, uint8_t router_purpose,
|
|
|
}
|
|
|
} else {
|
|
|
|
|
|
- if (dir_purpose == DIR_PURPOSE_FETCH_RENDDESC) {
|
|
|
-
|
|
|
- pds_flags |= PDS_IGNORE_FASCISTFIREWALL|PDS_ALLOW_SELF;
|
|
|
- rs = router_pick_trusteddirserver(HIDSERV_DIRINFO, pds_flags);
|
|
|
- } else {
|
|
|
+ if (1) {
|
|
|
|
|
|
pds_flags |= PDS_IGNORE_FASCISTFIREWALL;
|
|
|
rs = router_pick_directory_server(type, pds_flags);
|
|
@@ -649,7 +638,7 @@ directory_initiate_command_routerstatus_rend(const routerstatus_t *status,
|
|
|
* upload or download a server or rendezvous
|
|
|
* descriptor. <b>dir_purpose</b> determines what
|
|
|
* kind of directory connection we're launching, and must be one of
|
|
|
- * DIR_PURPOSE_{FETCH|UPLOAD}_{DIR|RENDDESC|RENDDESC_V2}. <b>router_purpose</b>
|
|
|
+ * DIR_PURPOSE_{FETCH|UPLOAD}_{DIR|RENDDESC_V2}. <b>router_purpose</b>
|
|
|
* specifies the descriptor purposes we have in mind (currently only
|
|
|
* used for FETCH_DIR).
|
|
|
*
|
|
@@ -900,9 +889,7 @@ directory_initiate_command(const char *address, const tor_addr_t *_addr,
|
|
|
static int
|
|
|
is_sensitive_dir_purpose(uint8_t dir_purpose)
|
|
|
{
|
|
|
- return ((dir_purpose == DIR_PURPOSE_FETCH_RENDDESC) ||
|
|
|
- (dir_purpose == DIR_PURPOSE_HAS_FETCHED_RENDDESC) ||
|
|
|
- (dir_purpose == DIR_PURPOSE_UPLOAD_RENDDESC) ||
|
|
|
+ return ((dir_purpose == DIR_PURPOSE_HAS_FETCHED_RENDDESC_V2) ||
|
|
|
(dir_purpose == DIR_PURPOSE_UPLOAD_RENDDESC_V2) ||
|
|
|
(dir_purpose == DIR_PURPOSE_FETCH_RENDDESC_V2));
|
|
|
}
|
|
@@ -1267,12 +1254,6 @@ directory_send_command(dir_connection_t *conn,
|
|
|
httpcommand = "GET";
|
|
|
tor_asprintf(&url, "/tor/rendezvous2/%s", resource);
|
|
|
break;
|
|
|
- case DIR_PURPOSE_UPLOAD_RENDDESC:
|
|
|
- tor_assert(!resource);
|
|
|
- tor_assert(payload);
|
|
|
- httpcommand = "POST";
|
|
|
- url = tor_strdup("/tor/rendezvous/publish");
|
|
|
- break;
|
|
|
case DIR_PURPOSE_UPLOAD_RENDDESC_V2:
|
|
|
tor_assert(!resource);
|
|
|
tor_assert(payload);
|
|
@@ -1532,20 +1513,18 @@ body_is_plausible(const char *body, size_t len, int purpose)
|
|
|
if (purpose == DIR_PURPOSE_FETCH_MICRODESC) {
|
|
|
return (!strcmpstart(body,"onion-key"));
|
|
|
}
|
|
|
- if (purpose != DIR_PURPOSE_FETCH_RENDDESC) {
|
|
|
+ if (1) {
|
|
|
if (!strcmpstart(body,"router") ||
|
|
|
!strcmpstart(body,"signed-directory") ||
|
|
|
!strcmpstart(body,"network-status") ||
|
|
|
!strcmpstart(body,"running-routers"))
|
|
|
- return 1;
|
|
|
+ return 1;
|
|
|
for (i=0;i<32;++i) {
|
|
|
if (!TOR_ISPRINT(body[i]) && !TOR_ISSPACE(body[i]))
|
|
|
return 0;
|
|
|
}
|
|
|
- return 1;
|
|
|
- } else {
|
|
|
- return 1;
|
|
|
}
|
|
|
+ return 1;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -2104,46 +2083,6 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
|
|
|
* dirservers down just because they don't like us. */
|
|
|
}
|
|
|
|
|
|
- if (conn->base_.purpose == DIR_PURPOSE_FETCH_RENDDESC) {
|
|
|
- tor_assert(conn->rend_data);
|
|
|
- log_info(LD_REND,"Received rendezvous descriptor (size %d, status %d "
|
|
|
- "(%s))",
|
|
|
- (int)body_len, status_code, escaped(reason));
|
|
|
- switch (status_code) {
|
|
|
- case 200:
|
|
|
- if (rend_cache_store(body, body_len, 0,
|
|
|
- conn->rend_data->onion_address) < -1) {
|
|
|
- log_warn(LD_REND,"Failed to parse rendezvous descriptor.");
|
|
|
-
|
|
|
- * connection_about_to_close_connection()
|
|
|
- * cleans this dir conn up. */
|
|
|
-
|
|
|
- * style, it isn't worth the hassle. We'll do better in v2. */
|
|
|
- } else {
|
|
|
-
|
|
|
- * present. Notify pending connections about this. */
|
|
|
- conn->base_.purpose = DIR_PURPOSE_HAS_FETCHED_RENDDESC;
|
|
|
- rend_client_desc_trynow(conn->rend_data->onion_address);
|
|
|
- }
|
|
|
- break;
|
|
|
- case 404:
|
|
|
-
|
|
|
- * connection_about_to_close_connection() cleans this conn up. */
|
|
|
- break;
|
|
|
- case 400:
|
|
|
- log_warn(LD_REND,
|
|
|
- "http status 400 (%s). Dirserver didn't like our "
|
|
|
- "rendezvous query?", escaped(reason));
|
|
|
- break;
|
|
|
- default:
|
|
|
- log_warn(LD_REND,"http status %d (%s) response unexpected while "
|
|
|
- "fetching hidden service descriptor (server '%s:%d').",
|
|
|
- status_code, escaped(reason), conn->base_.address,
|
|
|
- conn->base_.port);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
if (conn->base_.purpose == DIR_PURPOSE_FETCH_RENDDESC_V2) {
|
|
|
#define SEND_HS_DESC_FAILED_EVENT() ( \
|
|
|
control_event_hs_descriptor_failed(conn->rend_data, \
|
|
@@ -2162,20 +2101,13 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
|
|
|
* cleans this dir conn up. */
|
|
|
SEND_HS_DESC_FAILED_EVENT();
|
|
|
break;
|
|
|
- case -1:
|
|
|
-
|
|
|
- * and _not_ performing another request. */
|
|
|
- log_info(LD_REND, "Successfully fetched v2 rendezvous "
|
|
|
- "descriptor, but we already have a v0 descriptor.");
|
|
|
- conn->base_.purpose = DIR_PURPOSE_HAS_FETCHED_RENDDESC;
|
|
|
- break;
|
|
|
default:
|
|
|
|
|
|
log_info(LD_REND, "Successfully fetched v2 rendezvous "
|
|
|
"descriptor.");
|
|
|
control_event_hs_descriptor_received(conn->rend_data,
|
|
|
conn->identity_digest);
|
|
|
- conn->base_.purpose = DIR_PURPOSE_HAS_FETCHED_RENDDESC;
|
|
|
+ conn->base_.purpose = DIR_PURPOSE_HAS_FETCHED_RENDDESC_V2;
|
|
|
rend_client_desc_trynow(conn->rend_data->onion_address);
|
|
|
break;
|
|
|
}
|
|
@@ -2206,8 +2138,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (conn->base_.purpose == DIR_PURPOSE_UPLOAD_RENDDESC ||
|
|
|
- conn->base_.purpose == DIR_PURPOSE_UPLOAD_RENDDESC_V2) {
|
|
|
+ if (conn->base_.purpose == DIR_PURPOSE_UPLOAD_RENDDESC_V2) {
|
|
|
log_info(LD_REND,"Uploaded rendezvous descriptor (status %d "
|
|
|
"(%s))",
|
|
|
status_code, escaped(reason));
|
|
@@ -2311,7 +2242,7 @@ connection_dir_about_to_close(dir_connection_t *dir_conn)
|
|
|
}
|
|
|
|
|
|
* retry as needed. (If a fetch is successful, the connection state
|
|
|
- * is changed to DIR_PURPOSE_HAS_FETCHED_RENDDESC to mark that
|
|
|
+ * is changed to DIR_PURPOSE_HAS_FETCHED_RENDDESC_V2 to mark that
|
|
|
* refetching is unnecessary.) */
|
|
|
if (conn->purpose == DIR_PURPOSE_FETCH_RENDDESC_V2 &&
|
|
|
dir_conn->rend_data &&
|
|
@@ -2452,9 +2383,7 @@ note_client_request(int purpose, int compressed, size_t bytes)
|
|
|
case DIR_PURPOSE_UPLOAD_DIR: kind = "dl/ul-dir"; break;
|
|
|
case DIR_PURPOSE_UPLOAD_VOTE: kind = "dl/ul-vote"; break;
|
|
|
case DIR_PURPOSE_UPLOAD_SIGNATURES: kind = "dl/ul-sig"; break;
|
|
|
- case DIR_PURPOSE_FETCH_RENDDESC: kind = "dl/rend"; break;
|
|
|
case DIR_PURPOSE_FETCH_RENDDESC_V2: kind = "dl/rend2"; break;
|
|
|
- case DIR_PURPOSE_UPLOAD_RENDDESC: kind = "dl/ul-rend"; break;
|
|
|
case DIR_PURPOSE_UPLOAD_RENDDESC_V2: kind = "dl/ul-rend2"; break;
|
|
|
}
|
|
|
if (kind) {
|