commit 0e5b6607046eddc7c2a224009a6dd0eaa5b3a322 Author: Damian Johnson atagar@torproject.org Date: Sat Jul 7 11:28:02 2018 -0700
NetinfoCell didn't populate unused content
Great catch from dmr...
https://trac.torproject.org/projects/tor/ticket/26684 --- stem/client/cell.py | 2 +- test/unit/client/cell.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/stem/client/cell.py b/stem/client/cell.py index 0f9ae59e..337e8a2d 100644 --- a/stem/client/cell.py +++ b/stem/client/cell.py @@ -565,7 +565,7 @@ class NetinfoCell(Cell): addr, content = Address.pop(content) sender_addresses.append(addr)
- return NetinfoCell(receiver_address, sender_addresses, datetime.datetime.utcfromtimestamp(timestamp), unused = b'') + return NetinfoCell(receiver_address, sender_addresses, datetime.datetime.utcfromtimestamp(timestamp), unused = content)
def __hash__(self): return _hash_attr(self, 'timestamp', 'receiver_address', 'sender_addresses') diff --git a/test/unit/client/cell.py b/test/unit/client/cell.py index 402a1d4e..36abc77c 100644 --- a/test/unit/client/cell.py +++ b/test/unit/client/cell.py @@ -170,6 +170,7 @@ class TestCell(unittest.TestCase): self.assertEqual(datetime.datetime(2018, 1, 14, 1, 46, 56), netinfo_cell.timestamp) self.assertEqual(Address('127.0.0.1'), netinfo_cell.receiver_address) self.assertEqual([Address('97.113.15.2')], netinfo_cell.sender_addresses) + self.assertEqual(ZERO * 492, netinfo_cell.unused)
self.assertEqual(b'', content) # check that we've consumed all of the bytes
@@ -263,7 +264,7 @@ class TestCell(unittest.TestCase): self.assertEqual(timestamp, cell.timestamp) self.assertEqual(receiver_address, cell.receiver_address) self.assertEqual(sender_addresses, cell.sender_addresses) - self.assertEqual(b'', cell.unused) + self.assertEqual(ZERO * 492, cell.unused)
def test_vpadding_cell(self): for cell_bytes, payload in VPADDING_CELLS.items():
tor-commits@lists.torproject.org