mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-24 22:58:50 +01:00
Finish renaming rend_service field
svn:r1447
This commit is contained in:
parent
a8d805e292
commit
2bc2f1ed03
4 changed files with 15 additions and 14 deletions
|
@ -329,12 +329,12 @@ circuit_t *circuit_get_newest(connection_t *conn,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the first circuit in global_circuitlist after 'start' whose
|
/* Return the first circuit in global_circuitlist after 'start' whose
|
||||||
* rend_service field is servid and whose purpose is purpose. Returns
|
* rend_pk_digest field is 'digest' and whose purpose is purpose. Returns
|
||||||
* NULL if no circuit is found. If 'start' is null, begin at the start of
|
* NULL if no circuit is found. If 'start' is null, begin at the start of
|
||||||
* the list.
|
* the list.
|
||||||
*/
|
*/
|
||||||
circuit_t *circuit_get_next_by_service_and_purpose(circuit_t *start,
|
circuit_t *circuit_get_next_by_pk_and_purpose(circuit_t *start,
|
||||||
const char *servid, int purpose)
|
const char *digest, int purpose)
|
||||||
{
|
{
|
||||||
circuit_t *circ;
|
circuit_t *circ;
|
||||||
if (start == NULL)
|
if (start == NULL)
|
||||||
|
@ -347,7 +347,7 @@ circuit_t *circuit_get_next_by_service_and_purpose(circuit_t *start,
|
||||||
continue;
|
continue;
|
||||||
if (circ->purpose != purpose)
|
if (circ->purpose != purpose)
|
||||||
continue;
|
continue;
|
||||||
if (!memcmp(circ->rend_service, servid, CRYPTO_SHA1_DIGEST_LEN))
|
if (!memcmp(circ->rend_pk_digest, digest, CRYPTO_SHA1_DIGEST_LEN))
|
||||||
return circ;
|
return circ;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -698,7 +698,7 @@ circuit_t *circuit_get_by_circ_id_conn(uint16_t circ_id, connection_t *conn);
|
||||||
circuit_t *circuit_get_by_conn(connection_t *conn);
|
circuit_t *circuit_get_by_conn(connection_t *conn);
|
||||||
circuit_t *circuit_get_newest(connection_t *conn,
|
circuit_t *circuit_get_newest(connection_t *conn,
|
||||||
int must_be_open, uint8_t conn_purpose);
|
int must_be_open, uint8_t conn_purpose);
|
||||||
circuit_t *circuit_get_next_by_service_and_purpose(circuit_t *circuit,
|
circuit_t *circuit_get_next_by_pk_and_purpose(circuit_t *circuit,
|
||||||
const char *servid, int purpose);
|
const char *servid, int purpose);
|
||||||
circuit_t *circuit_get_rendezvous(const char *cookie);
|
circuit_t *circuit_get_rendezvous(const char *cookie);
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ rend_mid_establish_intro(circuit_t *circ, char *request, int request_len)
|
||||||
|
|
||||||
/* Close any other intro circuits with the same pk. */
|
/* Close any other intro circuits with the same pk. */
|
||||||
c = NULL;
|
c = NULL;
|
||||||
while ((c = circuit_get_next_by_service_and_purpose(
|
while ((c = circuit_get_next_by_pk_and_purpose(
|
||||||
c,pk_digest,CIRCUIT_PURPOSE_INTRO_POINT))) {
|
c,pk_digest,CIRCUIT_PURPOSE_INTRO_POINT))) {
|
||||||
log_fn(LOG_INFO, "Replacing old circuit %d for service %s", c->p_circ_id, hexid);
|
log_fn(LOG_INFO, "Replacing old circuit %d for service %s", c->p_circ_id, hexid);
|
||||||
circuit_mark_for_close(c);
|
circuit_mark_for_close(c);
|
||||||
|
@ -75,7 +75,7 @@ rend_mid_establish_intro(circuit_t *circ, char *request, int request_len)
|
||||||
|
|
||||||
/* Now, set up this circuit. */
|
/* Now, set up this circuit. */
|
||||||
circ->purpose = CIRCUIT_PURPOSE_INTRO_POINT;
|
circ->purpose = CIRCUIT_PURPOSE_INTRO_POINT;
|
||||||
memcpy(circ->rend_service, pk_digest, 20);
|
memcpy(circ->rend_pk_digest, pk_digest, 20);
|
||||||
|
|
||||||
log_fn(LOG_INFO, "Established introduction point on circuit %d for service %s",
|
log_fn(LOG_INFO, "Established introduction point on circuit %d for service %s",
|
||||||
circ->p_circ_id, hexid);
|
circ->p_circ_id, hexid);
|
||||||
|
@ -104,7 +104,7 @@ rend_mid_introduce(circuit_t *circ, char *request, int request_len)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The first 20 bytes are all we look at: they have a hash of Bob's PK. */
|
/* The first 20 bytes are all we look at: they have a hash of Bob's PK. */
|
||||||
intro_circ = circuit_get_next_by_service_and_purpose(
|
intro_circ = circuit_get_next_by_pk_and_purpose(
|
||||||
NULL, request, CIRCUIT_PURPOSE_INTRO_POINT);
|
NULL, request, CIRCUIT_PURPOSE_INTRO_POINT);
|
||||||
if (!intro_circ) {
|
if (!intro_circ) {
|
||||||
log_fn(LOG_WARN,
|
log_fn(LOG_WARN,
|
||||||
|
|
|
@ -340,7 +340,7 @@ rend_service_introduce(circuit_t *circuit, char *request, int request_len)
|
||||||
log_fn(LOG_WARN, "Got an INTRODUCE2 cell for an unrecognized service");
|
log_fn(LOG_WARN, "Got an INTRODUCE2 cell for an unrecognized service");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!memcmp(circuit->rend_service, request, 20)) {
|
if (!memcmp(circuit->rend_pk_digest, request, 20)) {
|
||||||
log_fn(LOG_WARN, "Got an INTRODUCE2 cell for the wrong service");
|
log_fn(LOG_WARN, "Got an INTRODUCE2 cell for the wrong service");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -398,7 +398,8 @@ rend_service_introduce(circuit_t *circuit, char *request, int request_len)
|
||||||
}
|
}
|
||||||
assert(launched->build_state);
|
assert(launched->build_state);
|
||||||
/* Fill in the circuit's state. */
|
/* Fill in the circuit's state. */
|
||||||
memcpy(launched->rend_service, circuit->rend_service,CRYPTO_SHA1_DIGEST_LEN);
|
memcpy(launched->rend_pk_digest, circuit->rend_pk_digest,
|
||||||
|
CRYPTO_SHA1_DIGEST_LEN);
|
||||||
memcpy(launched->rend_cookie, r_cookie, REND_COOKIE_LEN);
|
memcpy(launched->rend_cookie, r_cookie, REND_COOKIE_LEN);
|
||||||
launched->build_state->pending_final_cpath = cpath =
|
launched->build_state->pending_final_cpath = cpath =
|
||||||
tor_malloc_zero(sizeof(crypt_path_t));
|
tor_malloc_zero(sizeof(crypt_path_t));
|
||||||
|
@ -431,7 +432,7 @@ rend_service_launch_establish_intro(rend_service_t *service, char *nickname)
|
||||||
nickname);
|
nickname);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
memcpy(launched->rend_service, service->pk_digest, CRYPTO_SHA1_DIGEST_LEN);
|
memcpy(launched->rend_pk_digest, service->pk_digest, CRYPTO_SHA1_DIGEST_LEN);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -449,7 +450,7 @@ rend_service_intro_is_ready(circuit_t *circuit)
|
||||||
|
|
||||||
assert(circuit->purpose == CIRCUIT_PURPOSE_S_ESTABLISH_INTRO);
|
assert(circuit->purpose == CIRCUIT_PURPOSE_S_ESTABLISH_INTRO);
|
||||||
assert(circuit->cpath);
|
assert(circuit->cpath);
|
||||||
service = rend_service_get_by_pk_digest(circuit->rend_service);
|
service = rend_service_get_by_pk_digest(circuit->rend_pk_digest);
|
||||||
if (!service) {
|
if (!service) {
|
||||||
log_fn(LOG_WARN, "Internal error: unrecognized service ID on introduction circuit");
|
log_fn(LOG_WARN, "Internal error: unrecognized service ID on introduction circuit");
|
||||||
goto err;
|
goto err;
|
||||||
|
@ -499,7 +500,7 @@ rend_service_rendezvous_is_ready(circuit_t *circuit)
|
||||||
hop = circuit->build_state->pending_final_cpath;
|
hop = circuit->build_state->pending_final_cpath;
|
||||||
assert(hop);
|
assert(hop);
|
||||||
|
|
||||||
service = rend_service_get_by_pk_digest(circuit->rend_service);
|
service = rend_service_get_by_pk_digest(circuit->rend_pk_digest);
|
||||||
if (!service) {
|
if (!service) {
|
||||||
log_fn(LOG_WARN, "Internal error: unrecognized service ID on introduction circuit");
|
log_fn(LOG_WARN, "Internal error: unrecognized service ID on introduction circuit");
|
||||||
goto err;
|
goto err;
|
||||||
|
@ -567,7 +568,7 @@ int rend_services_init(void) {
|
||||||
goto remove_point;
|
goto remove_point;
|
||||||
circ = NULL;
|
circ = NULL;
|
||||||
found = 1;
|
found = 1;
|
||||||
while ((circ = circuit_get_next_by_service_and_purpose(
|
while ((circ = circuit_get_next_by_pk_and_purpose(
|
||||||
circ,service->pk_digest,
|
circ,service->pk_digest,
|
||||||
CIRCUIT_PURPOSE_S_ESTABLISH_INTRO))) {
|
CIRCUIT_PURPOSE_S_ESTABLISH_INTRO))) {
|
||||||
assert(circ->cpath);
|
assert(circ->cpath);
|
||||||
|
|
Loading…
Add table
Reference in a new issue