From 40b139ab826cc14733f6f4836d72e9401e743a61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 5 Sep 2016 14:31:50 +0200 Subject: [PATCH] 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. --- qrexec/qrexec-policy | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/qrexec/qrexec-policy b/qrexec/qrexec-policy index 7d0bf1b..950ba6e 100755 --- a/qrexec/qrexec-policy +++ b/qrexec/qrexec-policy @@ -129,9 +129,15 @@ def find_policy(policy, source_domain, target, target_domain=None): 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 if target == '$dispvm' or target.startswith('$dispvm:'): - return True + return None return app.domains[target]