[Pkg-privacy-commits] [onionbalance] 03/117: Do not publish descriptors without IPs, avoids a Tor crash bug

Donncha O'Cearbahill donncha-guest at moszumanska.debian.org
Wed Dec 16 23:18:40 UTC 2015


This is an automated email from the git hooks/post-receive script.

donncha-guest pushed a commit to branch debian/sid
in repository onionbalance.

commit 9d7f48c1ba528fce46975214d4a5cc430d3287b4
Author: Donncha O'Cearbhaill <donncha at donncha.is>
Date:   Thu Apr 2 13:01:30 2015 +0100

    Do not publish descriptors without IPs, avoids a Tor crash bug
---
 onion-balance/descriptor.py    | 8 ++++++++
 onion-balance/hiddenservice.py | 6 +++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/onion-balance/descriptor.py b/onion-balance/descriptor.py
index e23420f..9dfdf36 100644
--- a/onion-balance/descriptor.py
+++ b/onion-balance/descriptor.py
@@ -34,6 +34,13 @@ def generate_hs_descriptor(permanent_key, introduction_point_list=None,
     secret_id_part = util.calc_secret_id_part(time_period, None, replica)
     descriptor_id = util.calc_descriptor_id(permanent_id, secret_id_part)
 
+    # If we have no introduction
+    if not introduction_point_list:
+        logger.warning("No introduction points for service '%s'. "
+                       "Skipping upload." % util.calc_onion_address(
+                            permanent_key))
+        return None
+
     intro_section = make_introduction_points_part(
         introduction_point_list
     )
@@ -185,6 +192,7 @@ def upload_descriptor(controller, signed_descriptor, hsdirs=None):
     responsible directories
     """
     logger.debug("Sending HS descriptor upload")
+    print(signed_descriptor)
 
     # Provide server fingerprints to control command if HSDirs are specified.
     if hsdirs:
diff --git a/onion-balance/hiddenservice.py b/onion-balance/hiddenservice.py
index 37f6b5c..75a4feb 100644
--- a/onion-balance/hiddenservice.py
+++ b/onion-balance/hiddenservice.py
@@ -166,7 +166,11 @@ class HiddenService(object):
         """
         for replica in range(0, config.cfg.config.get("replicas")):
             signed_descriptor = self._get_signed_descriptor(replica=replica)
-            descriptor.upload_descriptor(self.controller, signed_descriptor)
+
+            # Upload if a signed descriptor was generated successfully
+            if signed_descriptor:
+                descriptor.upload_descriptor(self.controller,
+                                             signed_descriptor)
 
         self.last_uploaded = datetime.datetime.utcnow()
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/onionbalance.git



More information about the Pkg-privacy-commits mailing list