diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-04-12 18:10:28 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-04-12 18:10:28 +0000 |
commit | fc5a7662983e1711b91a486093e1f0ad220d7fcc (patch) | |
tree | 4e9411438b0593963778782e6903738cf53d7a29 /src | |
parent | 2321d21b3b49899684817f8f63560347cd6d5d24 (diff) | |
download | tor-fc5a7662983e1711b91a486093e1f0ad220d7fcc.tar tor-fc5a7662983e1711b91a486093e1f0ad220d7fcc.tar.gz |
Use service IDs in rendmid. (rendclient and common require no changes, it seems)
svn:r1594
Diffstat (limited to 'src')
-rw-r--r-- | src/or/rendmid.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/or/rendmid.c b/src/or/rendmid.c index d6267a705..4ab87cbaa 100644 --- a/src/or/rendmid.c +++ b/src/or/rendmid.c @@ -16,7 +16,7 @@ rend_mid_establish_intro(circuit_t *circ, const char *request, int request_len) char pk_digest[DIGEST_LEN]; int asn1len; circuit_t *c; - char hexid[9]; + char serviceid[REND_SERVICE_ID_LEN+1]; log_fn(LOG_INFO, "Received an ESTABLISH_INTRO request on circuit %d", circ->p_circ_id); @@ -64,14 +64,17 @@ rend_mid_establish_intro(circuit_t *circ, const char *request, int request_len) goto err; } - hex_encode(pk_digest, 4, hexid); + if (base32_encode(serviceid, REND_SERVICE_ID_LEN+1, + pk_digest,10)) { + goto err; + } /* Close any other intro circuits with the same pk. */ c = NULL; while ((c = circuit_get_next_by_pk_and_purpose( c,pk_digest,CIRCUIT_PURPOSE_INTRO_POINT))) { log_fn(LOG_INFO, "Replacing old circuit %d for service %s", - c->p_circ_id, hexid); + c->p_circ_id, serviceid); circuit_mark_for_close(c); } @@ -89,7 +92,7 @@ rend_mid_establish_intro(circuit_t *circ, const char *request, int request_len) log_fn(LOG_INFO, "Established introduction point on circuit %d for service %s", - circ->p_circ_id, hexid); + circ->p_circ_id, serviceid); return 0; truncated: @@ -108,7 +111,7 @@ int rend_mid_introduce(circuit_t *circ, const char *request, int request_len) { circuit_t *intro_circ; - char hexid[9]; + char serviceid[REND_SERVICE_ID_LEN+1]; if (circ->purpose != CIRCUIT_PURPOSE_OR || circ->n_conn) { log_fn(LOG_WARN, "Rejecting INTRODUCE1 on non-OR or non-edge circuit %d", @@ -124,7 +127,10 @@ rend_mid_introduce(circuit_t *circ, const char *request, int request_len) goto err; } - hex_encode(request,4,hexid); + if (base32_encode(serviceid, REND_SERVICE_ID_LEN+1, request,10)) { + goto err; + } + /* The first 20 bytes are all we look at: they have a hash of Bob's PK. */ intro_circ = circuit_get_next_by_pk_and_purpose( @@ -132,13 +138,13 @@ rend_mid_introduce(circuit_t *circ, const char *request, int request_len) if (!intro_circ) { log_fn(LOG_WARN, "No intro circ found for INTRODUCE1 cell (%s) from circuit %d; dropping", - hexid, circ->p_circ_id); + serviceid, circ->p_circ_id); goto err; } log_fn(LOG_INFO, "Sending introduction request for service %s from circ %d to circ %d", - hexid, circ->p_circ_id, intro_circ->p_circ_id); + serviceid, circ->p_circ_id, intro_circ->p_circ_id); /* Great. Now we just relay the cell down the circuit. */ if (connection_edge_send_command(NULL, intro_circ, @@ -188,7 +194,9 @@ rend_mid_establish_rendezvous(circuit_t *circ, const char *request, int request_ circ->purpose = CIRCUIT_PURPOSE_REND_POINT_WAITING; memcpy(circ->rend_cookie, request, REND_COOKIE_LEN); + hex_encode(request,4,hexid); + log_fn(LOG_INFO, "Established rendezvous point on circuit %d for cookie %s", circ->p_circ_id, hexid); |