]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix get_configured_bridge_by_addr_port_digest(.,.,NULL)
authorrl1987 <rl1987@sdf.lonestar.org>
Sun, 8 Dec 2013 18:42:33 +0000 (20:42 +0200)
committerNick Mathewson <nickm@torproject.org>
Mon, 9 Dec 2013 16:22:22 +0000 (11:22 -0500)
The old behavior was that NULL matched only bridges without known
identities; the correct behavior is that NULL should match all
bridges (assuming that their addr:port matches).

changes/bug9162 [new file with mode: 0644]
src/or/entrynodes.c

diff --git a/changes/bug9162 b/changes/bug9162
new file mode 100644 (file)
index 0000000..c1a247a
--- /dev/null
@@ -0,0 +1,6 @@
+  o Minor bugfixes:
+    - Fix a get_configured_bridge_by_addr_port_digest() function so
+      that it would return a bridge with given address and port even
+      if bridge digest is not specified by caller.  Fixes bug 9162;
+      bugfix on 0.2.0.3-alpha.  Based on a patch from "rl1987".
+
index ebbd85c78feb7dc1ede78d1728f04dadc2919aaf..d463303fc040aac84bc36907dfd68c3cd337f476 100644 (file)
@@ -1657,7 +1657,8 @@ get_configured_bridge_by_orports_digest(const char *digest,
 
 /** If we have a bridge configured whose digest matches <b>digest</b>, or a
  * bridge with no known digest whose address matches <b>addr</b>:<b>/port</b>,
- * return that bridge.  Else return NULL. */
+ * return that bridge.  Else return NULL. If <b>digest</b> is NULL, check for
+ * address/port matches only. */
 static bridge_info_t *
 get_configured_bridge_by_addr_port_digest(const tor_addr_t *addr,
                                           uint16_t port,
@@ -1667,7 +1668,7 @@ get_configured_bridge_by_addr_port_digest(const tor_addr_t *addr,
     return NULL;
   SMARTLIST_FOREACH_BEGIN(bridge_list, bridge_info_t *, bridge)
     {
-      if (tor_digest_is_zero(bridge->identity) &&
+      if ((tor_digest_is_zero(bridge->identity) || digest == NULL) &&
           !tor_addr_compare(&bridge->addr, addr, CMP_EXACT) &&
           bridge->port == port)
         return bridge;