firewall: prefer - over _ for QubesDB path
This commit is contained in:
parent
50e448e23a
commit
1cbbcd7b80
@ -169,12 +169,12 @@ class FirewallWorker(object):
|
||||
User applications may watch these paths for count increases to remain
|
||||
up to date with QubesDB changes.
|
||||
"""
|
||||
cnt = self.qdb.read('/qubes-firewall_handled/{}'.format(addr))
|
||||
cnt = self.qdb.read('/qubes-firewall-handled/{}'.format(addr))
|
||||
try:
|
||||
cnt = int(cnt)
|
||||
except (TypeError, ValueError):
|
||||
cnt = 0
|
||||
self.qdb.write('/qubes-firewall_handled/{}'.format(addr), str(cnt+1))
|
||||
self.qdb.write('/qubes-firewall-handled/{}'.format(addr), str(cnt+1))
|
||||
|
||||
def list_targets(self):
|
||||
return set(t.split('/')[2] for t in self.qdb.list('/qubes-firewall/'))
|
||||
|
@ -685,17 +685,17 @@ class TestFirewallWorker(TestCase):
|
||||
def test_handle_addr(self):
|
||||
self.obj.handle_addr('10.137.0.2')
|
||||
self.assertEqual(self.obj.rules['10.137.0.2'], [{'action': 'accept'}])
|
||||
self.assertEqual(self.obj.qdb.entries['/qubes-firewall_handled/10.137.0.2'], '1')
|
||||
self.assertEqual(self.obj.qdb.entries['/qubes-firewall-handled/10.137.0.2'], '1')
|
||||
self.obj.handle_addr('10.137.0.2')
|
||||
self.assertEqual(self.obj.rules['10.137.0.2'], [{'action': 'accept'}])
|
||||
self.assertEqual(self.obj.qdb.entries['/qubes-firewall_handled/10.137.0.2'], '2')
|
||||
self.assertEqual(self.obj.qdb.entries['/qubes-firewall-handled/10.137.0.2'], '2')
|
||||
# fallback to block all
|
||||
self.obj.handle_addr('10.137.0.3')
|
||||
self.assertEqual(self.obj.rules['10.137.0.3'], [{'action': 'drop'}])
|
||||
self.assertEqual(self.obj.qdb.entries['/qubes-firewall_handled/10.137.0.3'], '1')
|
||||
self.assertEqual(self.obj.qdb.entries['/qubes-firewall-handled/10.137.0.3'], '1')
|
||||
self.obj.handle_addr('10.137.0.4')
|
||||
self.assertEqual(self.obj.rules['10.137.0.4'], [{'action': 'drop'}])
|
||||
self.assertEqual(self.obj.qdb.entries['/qubes-firewall_handled/10.137.0.4'], '1')
|
||||
self.assertEqual(self.obj.qdb.entries['/qubes-firewall-handled/10.137.0.4'], '1')
|
||||
|
||||
@patch('os.path.isfile')
|
||||
@patch('os.access')
|
||||
|
Loading…
Reference in New Issue
Block a user