[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [sbws/master] Avoid exception when we can't fetch an ed25519_master_key



commit 08f6205744d1a5888598c51ee59e4bec2b7987ab
Author: Matt Traudt <sirmatt@xxxxxxx>
Date:   Tue Jun 12 21:42:45 2018 -0400

    Avoid exception when we can't fetch an ed25519_master_key
---
 CHANGELOG.md          | 2 ++
 sbws/lib/relaylist.py | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 918421a..a8f2bd9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,6 +26,8 @@ the exit position.
   tried fixing something in this area with `88fae60bc` but neglected to
 remember that `.join()` wants only string arguments and can't handle a `None`.
 So fix that.
+- Exception when failing to get a relay's `ed25519_master_key` from Tor and
+  trying to do `.rstrip()` on a None.
 
 
 [Unreleased]: https://github.com/pastly/simple-bw-scanner/compare/v0.4.0...master
diff --git a/sbws/lib/relaylist.py b/sbws/lib/relaylist.py
index f1899ca..f87d3d0 100644
--- a/sbws/lib/relaylist.py
+++ b/sbws/lib/relaylist.py
@@ -85,7 +85,10 @@ class Relay:
         """
         # Even if this key is called master-key-ed25519 in dir-spec.txt,
         # it seems that stem parses it as ed25519_master_key
-        return self._from_desc('ed25519_master_key').rstrip('=')
+        key = self._from_desc('ed25519_master_key')
+        if key is None:
+            return None
+        return key.rstrip('=')
 
     def can_exit_to(self, host, port):
         '''



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits