[tor-commits] [stem/master] Drop hidden service descriptor's service-authentication

atagar at torproject.org atagar at torproject.org
Sat Nov 7 18:59:22 UTC 2015


commit 2120fde1f8dccc0d4c8661609c51e41b6b54c115
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Nov 7 10:54:25 2015 -0800

    Drop hidden service descriptor's service-authentication
    
    Dropping support for a hidden service descriptor field that was never
    implemented in tor. Attribute is now deprecated, and will be dropped
    in the future...
    
      https://trac.torproject.org/projects/tor/ticket/15190
      https://gitweb.torproject.org/torspec.git/commit/?id=9c218f9
---
 docs/change_log.rst                          |    1 +
 stem/descriptor/hidden_service_descriptor.py |   18 +++---------------
 2 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/docs/change_log.rst b/docs/change_log.rst
index 39e6f57..70bb05e 100644
--- a/docs/change_log.rst
+++ b/docs/change_log.rst
@@ -60,6 +60,7 @@ The following are only available within Stem's `git repository
   * Replaced the :class:`~stem.descriptor.microdescriptor.Microdescriptor` identifier and identifier_type attributes with an identifiers hash since it can now appear multiple times (:spec:`09ff9e2`)
   * Unable to read descriptors from data directories on Windows due to their CRLF newlines (:trac:`17051`)
   * TypeError under python3 when using 'use_mirrors = True' (:trac:`17083`)
+  * Deprecated hidden service descriptor's *introduction_points_auth* field, which was never implemented in tor (:trac:`15190`, :spec:`9c218f9`)
 
  * **Utilities**
 
diff --git a/stem/descriptor/hidden_service_descriptor.py b/stem/descriptor/hidden_service_descriptor.py
index 31a99cc..935b432 100644
--- a/stem/descriptor/hidden_service_descriptor.py
+++ b/stem/descriptor/hidden_service_descriptor.py
@@ -153,26 +153,13 @@ def _parse_introduction_points_line(descriptor, entries):
     raise ValueError("'introduction-points' should be followed by a MESSAGE block, but was a %s" % block_type)
 
   descriptor.introduction_points_encoded = block_contents
+  descriptor.introduction_points_auth = []  # field was never implemented in tor (#15190)
 
   try:
-    decoded_field = _bytes_for_block(block_contents)
+    descriptor.introduction_points_content = _bytes_for_block(block_contents)
   except TypeError:
     raise ValueError("'introduction-points' isn't base64 encoded content:\n%s" % block_contents)
 
-  auth_types = []
-
-  while decoded_field.startswith(b'service-authentication ') and b'\n' in decoded_field:
-    auth_line, decoded_field = decoded_field.split(b'\n', 1)
-    auth_line_comp = auth_line.split(b' ')
-
-    if len(auth_line_comp) < 3:
-      raise ValueError("Within introduction-points we expected 'service-authentication [auth_type] [auth_data]', but had '%s'" % auth_line)
-
-    auth_types.append((auth_line_comp[1], auth_line_comp[2]))
-
-  descriptor.introduction_points_auth = auth_types
-  descriptor.introduction_points_content = decoded_field
-
 _parse_rendezvous_service_descriptor_line = _parse_simple_line('rendezvous-service-descriptor', 'descriptor_id')
 _parse_permanent_key_line = _parse_key_block('permanent-key', 'permanent_key', 'RSA PUBLIC KEY')
 _parse_secret_id_part_line = _parse_simple_line('secret-id-part', 'secret_id_part')
@@ -194,6 +181,7 @@ class HiddenServiceDescriptor(Descriptor):
   :var str introduction_points_encoded: raw introduction points blob
   :var list introduction_points_auth: **\*** tuples of the form
     (auth_method, auth_data) for our introduction_points_content
+    (**deprecated**, always **[]**)
   :var bytes introduction_points_content: decoded introduction-points content
     without authentication data, if using cookie authentication this is
     encrypted



More information about the tor-commits mailing list