[tor-commits] [stem/master] Check that hidden service introductory points are IPv4

atagar at torproject.org atagar at torproject.org
Sun Mar 1 05:16:35 UTC 2015


commit 58d0556236739760703e61cb345ee687d6dd5af1
Author: Damian Johnson <atagar at torproject.org>
Date:   Tue Feb 24 09:05:36 2015 -0800

    Check that hidden service introductory points are IPv4
    
    Got clarification from Nick on #15010.
---
 stem/descriptor/hidden_service_descriptor.py |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/stem/descriptor/hidden_service_descriptor.py b/stem/descriptor/hidden_service_descriptor.py
index d626144..8e0ba67 100644
--- a/stem/descriptor/hidden_service_descriptor.py
+++ b/stem/descriptor/hidden_service_descriptor.py
@@ -263,7 +263,9 @@ class HiddenServiceDescriptor(Descriptor):
         if keyword == 'introduction-point':
           attr['identifier'] = value
         elif keyword == 'ip-address':
-          # TODO: need clarification about if this IPv4, IPv6, or both
+          if not stem.util.connection.is_valid_ipv4_address(value):
+            raise ValueError("'%s' is an invalid IPv4 address" % value)
+
           attr['address'] = value
         elif keyword == 'onion-port':
           if not stem.util.connection.is_valid_port(value):





More information about the tor-commits mailing list