[or-cvs] Backport fix: compare identity to identity, not to nickname.
Nick Mathewson
nickm at seul.org
Thu Mar 31 23:33:45 UTC 2005
Update of /home/or/cvsroot/tor/src/or
In directory moria.mit.edu:/tmp/cvs-serv2934
Modified Files:
Tag: tor-0_0_9-patches
connection_or.c
Log Message:
Backport fix: compare identity to identity, not to nickname.
Index: connection_or.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/connection_or.c,v
retrieving revision 1.150.2.3
retrieving revision 1.150.2.4
diff -u -d -r1.150.2.3 -r1.150.2.4
--- connection_or.c 3 Feb 2005 23:05:39 -0000 1.150.2.3
+++ connection_or.c 31 Mar 2005 23:33:42 -0000 1.150.2.4
@@ -406,7 +406,18 @@
if (connection_or_nonopen_was_started_here(conn)) {
/* I initiated this connection. */
- if (strcasecmp(conn->nickname, nickname)) {
+ if (conn->nickname[0] == '$') {
+ /* I was aiming for a particular digest. Did I get it? */
+ char d[HEX_DIGEST_LEN+1];
+ base16_encode(d, HEX_DIGEST_LEN+1, digest_rcvd, DIGEST_LEN);
+ if (strcasecmp(d,conn->nickname+1)) {
+ log_fn(LOG_WARN, "Identity key not as expected for router at %s:%d: wanted %s but got %s",
+ conn->address, conn->port, conn->nickname, d);
+ control_event_or_conn_status(conn, OR_CONN_EVENT_FAILED);
+ return -1;
+ }
+ } else if (strcasecmp(conn->nickname, nickname)) {
+ /* I was aiming for a nickname. Did I get it? */
log_fn(authdir_mode(options) ? LOG_WARN : LOG_INFO,
"Other side (%s:%d) is '%s', but we tried to connect to '%s'",
conn->address, conn->port, nickname, conn->nickname);
More information about the tor-commits
mailing list