From 0607d9021a73171be2e287d24bf0547d07ac7e59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sun, 27 Mar 2016 04:27:37 +0200 Subject: [PATCH] qrexec: add support for service argument Fixes QubesOS/qubes-issues#1876 --- qrexec/qrexec-daemon.c | 2 +- qrexec/qrexec-policy | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/qrexec/qrexec-daemon.c b/qrexec/qrexec-daemon.c index 7eac63a..c53bac2 100644 --- a/qrexec/qrexec-daemon.c +++ b/qrexec/qrexec-daemon.c @@ -666,7 +666,7 @@ static void handle_execute_service(void) ENSURE_NULL_TERMINATED(untrusted_params.service_name); ENSURE_NULL_TERMINATED(untrusted_params.target_domain); ENSURE_NULL_TERMINATED(untrusted_params.request_id.ident); - sanitize_name(untrusted_params.service_name, ""); + sanitize_name(untrusted_params.service_name, "+"); sanitize_name(untrusted_params.target_domain, ""); sanitize_name(untrusted_params.request_id.ident, " "); params = untrusted_params; diff --git a/qrexec/qrexec-policy b/qrexec/qrexec-policy index ff38caa..0d236ae 100755 --- a/qrexec/qrexec-policy +++ b/qrexec/qrexec-policy @@ -50,9 +50,12 @@ def line_to_dict(line): def read_policy_file(service_name): - policy_file=POLICY_FILE_DIR+"/"+service_name + policy_file = os.path.join(POLICY_FILE_DIR, service_name) if not os.path.isfile(policy_file): - policy_file=DEPRECATED_POLICY_FILE_DIR+"/"+service_name + # fallback to policy without specific argument set (if any) + policy_file = os.path.join(POLICY_FILE_DIR, service_name.split("+")[0]) + if not os.path.isfile(policy_file): + policy_file = os.path.join(DEPRECATED_POLICY_FILE_DIR, service_name) if not os.path.isfile(policy_file): return None print >>sys.stderr, "RPC service '%s' uses deprecated policy location, please move to %s" % (service_name, POLICY_FILE_DIR)