[or-cvs] Use service IDs in rendmid. (rendclient and common require ...

Nick Mathewson nickm at seul.org
Mon Apr 12 18:10:31 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv21793/src/or

Modified Files:
	rendmid.c 
Log Message:
Use service IDs in rendmid. (rendclient and common require no changes, it seems)

Index: rendmid.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendmid.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- rendmid.c	8 Apr 2004 04:47:39 -0000	1.16
+++ rendmid.c	12 Apr 2004 18:10:28 -0000	1.17
@@ -16,7 +16,7 @@
   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 @@
     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 @@
 
   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 @@
 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 @@
     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 @@
   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 @@
   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);
 



More information about the tor-commits mailing list