commit 74a63e2e814a406db22e8c09aa0a4d038d9ce2b8 Author: Isis Lovecruft isis@torproject.org Date: Wed Dec 11 01:01:16 2013 +0000
Add base64 padding to networkstatus 'descDigest' field.
The trailing '='s in the "descriptor digest" field of an `@type-bridge-networkstatus` descriptor are removed before placing them in the descriptor. Therefore, before un-base64-encoding this field, we must re-add the trailing '='s character padding back in, the same as we already to for the "identity digest" field on that same descriptor line.
* FIXES a bug in function `bridgedb.parse.networkstatus.parseRLine()` which resulted in the "descriptor digest" field (and all fields after it on the 'r'-line) being set to `None`, due to a base64 decoding error from missing '=' character padding. --- lib/bridgedb/parse/networkstatus.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/bridgedb/parse/networkstatus.py b/lib/bridgedb/parse/networkstatus.py index 293fdd0..7fd9e18 100644 --- a/lib/bridgedb/parse/networkstatus.py +++ b/lib/bridgedb/parse/networkstatus.py @@ -128,7 +128,8 @@ def parseRLine(line): ID = None else: try: - descDigest = binascii.a2b_base64(fields[2]) + paddedDigest = padBase64(fields[2]) + descDigest = binascii.b2a_base64(paddedDigest) timestamp = time.mktime(time.strptime(" ".join(fields[3:5]), "%Y-%m-%d %H:%M:%S")) ORaddr = fields[5]
tor-commits@lists.torproject.org