[or-cvs] backport the bugfix: if we get a create cell that asks us to

arma at seul.org arma at seul.org
Thu Jun 8 09:38:20 UTC 2006


Update of /home/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/tor-011x/tor/src/or

Modified Files:
      Tag: tor-0_1_1-patches
	circuitbuild.c 
Log Message:
backport the bugfix: if we get a create cell that asks us to
extend somewhere, but the tor server there doesn't match the
expected digest, we now send a destroy cell back, rather than
doing nothing.


Index: circuitbuild.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/circuitbuild.c,v
retrieving revision 1.230.2.3
retrieving revision 1.230.2.4
diff -u -p -d -r1.230.2.3 -r1.230.2.4
--- circuitbuild.c	6 Jun 2006 04:42:14 -0000	1.230.2.3
+++ circuitbuild.c	8 Jun 2006 09:38:18 -0000	1.230.2.4
@@ -421,12 +421,18 @@ circuit_n_conn_done(connection_t *or_con
     tor_assert(circ->state == CIRCUIT_STATE_OR_WAIT);
     if (!circ->n_conn &&
         circ->n_addr == or_conn->addr &&
-        circ->n_port == or_conn->port &&
-        !memcmp(or_conn->identity_digest, circ->n_conn_id_digest,
-                DIGEST_LEN)) {
+        circ->n_port == or_conn->port) {
+      if (memcmp(or_conn->identity_digest, circ->n_conn_id_digest,
+                 DIGEST_LEN)) {
+        log_fn(LOG_PROTOCOL_WARN, LD_CIRC,
+               "Pending circuit to %s:%d is intended for different digest!",
+               or_conn->address, or_conn->port);
+        circuit_mark_for_close(circ, END_CIRC_REASON_OR_IDENTITY);
+        continue;
+      }
       if (!status) { /* or_conn failed; close circ */
         log_info(LD_CIRC,"or_conn failed. Closing circ.");
-        circuit_mark_for_close(circ, END_CIRC_REASON_OR_IDENTITY);
+        circuit_mark_for_close(circ, END_CIRC_REASON_OR_CONN_CLOSED);
         continue;
       }
       log_debug(LD_CIRC,



More information about the tor-commits mailing list