qrexec-policy: fix handling special target VM names
Function validate_target should return either valid QubesVM object or None in case of success. And throw an exception in case of failure.
这个提交包含在:
父节点
a513b33da3
当前提交
40b139ab82
@ -129,9 +129,15 @@ def find_policy(policy, source_domain, target, target_domain=None):
|
|||||||
|
|
||||||
|
|
||||||
def validate_target(app, target):
|
def validate_target(app, target):
|
||||||
|
"""Validate target name. Throw KeYError for invalid name.
|
||||||
|
|
||||||
|
:param app: Qubes app object
|
||||||
|
:param target: target name to validate
|
||||||
|
:return: QubesVM object or None (in case of spacial target)
|
||||||
|
"""
|
||||||
# special targets
|
# special targets
|
||||||
if target == '$dispvm' or target.startswith('$dispvm:'):
|
if target == '$dispvm' or target.startswith('$dispvm:'):
|
||||||
return True
|
return None
|
||||||
|
|
||||||
return app.domains[target]
|
return app.domains[target]
|
||||||
|
|
||||||
|
正在加载...
在新工单中引用
屏蔽一个用户