[tor-commits] [stem/master] Empty hidden services are invalid

atagar at torproject.org atagar at torproject.org
Tue Dec 6 17:52:21 UTC 2016


commit c0aae485b23698d087c1df86b6c40dbfc76bdb02
Author: Damian Johnson <atagar at torproject.org>
Date:   Tue Dec 6 09:50:33 2016 -0800

    Empty hidden services are invalid
    
    Tor added some more validation for the hidden service configuration...
    
      https://trac.torproject.org/projects/tor/ticket/20860
    
    This broke our integ tests...
    
      ======================================================================
      ERROR: test_hidden_services_conf
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "/home/atagar/Desktop/stem/test/runner.py", line 127, in wrapped
          return func(self, *args, **kwargs)
        File "/home/atagar/Desktop/stem/test/integ/control/controller.py", line 549, in test_hidden_services_conf
          controller.set_hidden_service_conf(initialconf)
        File "/home/atagar/Desktop/stem/stem/control.py", line 2582, in set_hidden_service_conf
          self.set_options(hidden_service_options)
        File "/home/atagar/Desktop/stem/stem/control.py", line 2419, in set_options
          raise stem.InvalidRequest(response.code, response.message)
      InvalidRequest: Unacceptable option value: Failed to configure rendezvous options. See logs for details.
    
      ----------------------------------------------------------------------
    
    Reproing this with the tor-prompt the log says...
    
      WARN Hidden service ("/tmp/hs_dir") with no ports configured.
    
    That's fine. This isn't what we were testing anyway.
---
 test/integ/control/controller.py | 14 +++++---------
 test/unit/installation.py        |  2 +-
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/test/integ/control/controller.py b/test/integ/control/controller.py
index 149dc03..c249c08 100644
--- a/test/integ/control/controller.py
+++ b/test/integ/control/controller.py
@@ -510,7 +510,6 @@ class TestController(unittest.TestCase):
     service2_path = os.path.join(test_dir, 'test_hidden_service2')
     service3_path = os.path.join(test_dir, 'test_hidden_service3')
     service4_path = os.path.join(test_dir, 'test_hidden_service4')
-    empty_service_path = os.path.join(test_dir, 'test_hidden_service_empty')
 
     with runner.get_tor_controller() as controller:
       try:
@@ -541,9 +540,6 @@ class TestController(unittest.TestCase):
               (8032, '127.0.0.1', 8032),
             ]
           },
-          empty_service_path: {
-            'HiddenServicePort': []
-          }
         }
 
         controller.set_hidden_service_conf(initialconf)
@@ -565,18 +561,18 @@ class TestController(unittest.TestCase):
         self.assertTrue(hs_address1.endswith('.onion'))
 
         conf = controller.get_hidden_service_conf()
-        self.assertEqual(4, len(conf))
+        self.assertEqual(3, len(conf))
         self.assertEqual(2, len(conf[hs_path]['HiddenServicePort']))
 
         # remove a hidden service, the service dir should still be there
 
         controller.remove_hidden_service(hs_path, 8888)
-        self.assertEqual(4, len(controller.get_hidden_service_conf()))
+        self.assertEqual(3, len(controller.get_hidden_service_conf()))
 
         # remove a service completely, it should now be gone
 
         controller.remove_hidden_service(hs_path, 8989)
-        self.assertEqual(3, len(controller.get_hidden_service_conf()))
+        self.assertEqual(2, len(controller.get_hidden_service_conf()))
 
         # add a new service, this time with client authentication
 
@@ -589,13 +585,13 @@ class TestController(unittest.TestCase):
         self.assertTrue(hs_attributes.hostname_for_client['c2'].endswith('.onion'))
 
         conf = controller.get_hidden_service_conf()
-        self.assertEqual(4, len(conf))
+        self.assertEqual(3, len(conf))
         self.assertEqual(1, len(conf[hs_path]['HiddenServicePort']))
 
         # remove a hidden service
 
         controller.remove_hidden_service(hs_path, 8888)
-        self.assertEqual(3, len(controller.get_hidden_service_conf()))
+        self.assertEqual(2, len(controller.get_hidden_service_conf()))
       finally:
         controller.set_hidden_service_conf({})  # drop hidden services created during the test
 
diff --git a/test/unit/installation.py b/test/unit/installation.py
index 719abfe..53d9c41 100644
--- a/test/unit/installation.py
+++ b/test/unit/installation.py
@@ -77,7 +77,7 @@ class TestInstallation(unittest.TestCase):
         path = os.path.join(directory, filename)
         file_type = path.split('.')[-1]
 
-        if not file_type in ['.py', '.pyc', '.swp', '.swo', 'orig']:
+        if file_type not in ['.py', '.pyc', '.swp', '.swo', 'orig']:
           continue
         elif path not in data_files:
           self.fail("setup.py doesn't install %s" % path)



More information about the tor-commits mailing list