Commit 7e156524 authored by anonym's avatar anonym
Browse files

tor-controlport-filter: improve variable names.

parent c09b9293
...@@ -324,17 +324,17 @@ class FilteredControlPortProxyHandler(socketserver.StreamRequestHandler): ...@@ -324,17 +324,17 @@ class FilteredControlPortProxyHandler(socketserver.StreamRequestHandler):
# in place, to combine multiple matched filters # in place, to combine multiple matched filters
# without loss. # without loss.
if 'commands' in filter_: if 'commands' in filter_:
for key in filter_['commands']: for cmd in filter_['commands']:
new = filter_['commands'][key] new_rules = filter_['commands'][cmd]
key = key.upper() cmd = cmd.upper()
old = allowed_commands.get(key, []) old_rules = allowed_commands.get(cmd, [])
# Allow "simple" matching rules where the # Allow "simple" matching rules where the
# 'pattern' key is implicit. # 'pattern' key is implicit.
for i in range(len(new)): for i in range(len(new_rules)):
rule = new[i] rule = new_rules[i]
if isinstance(rule, str): if isinstance(rule, str):
new[i] = {'pattern': rule} new_rules[i] = {'pattern': rule}
allowed_commands[key] = old + new allowed_commands[cmd] = old_rules + new_rules
if 'events' in filter_: if 'events' in filter_:
for key in filter_['events']: for key in filter_['events']:
val = filter_['events'][key] val = filter_['events'][key]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment