From 58a12f951cdb5e03d516216391e737690b5f5021 Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Sat, 14 Jul 2012 22:54:23 +0200 Subject: [PATCH] dom0+vm/qrexec-services: pass remote domain via env variable not argument Most qrexec services doesn't use remote domain name, as policy is enforced earlier. So pass it in way that will allow use of generic command as qrexec service. --- qubes_rpc/qfile-unpacker.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/qubes_rpc/qfile-unpacker.c b/qubes_rpc/qfile-unpacker.c index eaa5c06..dd0a510 100644 --- a/qubes_rpc/qfile-unpacker.c +++ b/qubes_rpc/qfile-unpacker.c @@ -51,13 +51,19 @@ int main(int argc, char ** argv) char *incoming_dir; int pipefds[2]; int uid; + char *remote_domain; pipe(pipefds); uid = prepare_creds_return_uid("user"); + remote_domain = getenv("QREXEC_REMOTE_DOMAIN"); + if (!remote_domain) { + gui_fatal("Cannot get remote domain name"); + exit(1); + } mkdir(INCOMING_DIR_ROOT, 0700); - asprintf(&incoming_dir, "%s/from-%s", INCOMING_DIR_ROOT, argv[1]); + asprintf(&incoming_dir, "%s/from-%s", INCOMING_DIR_ROOT, remote_domain); mkdir(incoming_dir, 0700); if (chdir(incoming_dir)) gui_fatal("Error chdir to %s", incoming_dir);