[tor-commits] [stem/master] Transport parsing wasn't idempotent

atagar at torproject.org atagar at torproject.org
Sun Jan 25 22:37:34 UTC 2015


commit 8870510e4194da6c7ee8fb143e898a7c83932234
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Jan 18 09:57:03 2015 -0800

    Transport parsing wasn't idempotent
    
    Oops, this parsing function appended to the descriptor's existing dictionary
    rather than assigning one of its own. Assuming it ran over the same content
    this wasn't an issue in practice since it would clobber the existing results,
    but still not rights.
---
 stem/descriptor/extrainfo_descriptor.py |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/stem/descriptor/extrainfo_descriptor.py b/stem/descriptor/extrainfo_descriptor.py
index 124ce16..1eebe46 100644
--- a/stem/descriptor/extrainfo_descriptor.py
+++ b/stem/descriptor/extrainfo_descriptor.py
@@ -256,6 +256,8 @@ def _parse_transport_line(descriptor, entries):
   # on non-bridges in the wild when the relay operator configured it this
   # way.
 
+  transports = {}
+
   for value in _values('transport', entries):
     name, address, port, args = None, None, None, None
 
@@ -285,7 +287,9 @@ def _parse_transport_line(descriptor, entries):
       port = int(port_str)
       args = value_comp[2:] if len(value_comp) >= 3 else []
 
-    descriptor.transport[name] = (address, port, args)
+    transports[name] = (address, port, args)
+
+  descriptor.transport = transports
 
 
 def _parse_cell_circuits_per_decline_line(descriptor, entries):





More information about the tor-commits mailing list