dom0/qrexec: use default user from VM settings
This commit is contained in:
parent
d0f20e9e59
commit
11e142adb3
@ -5,6 +5,7 @@ import os.path
|
|||||||
import subprocess
|
import subprocess
|
||||||
import xen.lowlevel.xl
|
import xen.lowlevel.xl
|
||||||
import qubes.guihelpers
|
import qubes.guihelpers
|
||||||
|
from qubes.qubes import QubesVmCollection
|
||||||
import fcntl
|
import fcntl
|
||||||
|
|
||||||
POLICY_FILE_DIR="/etc/qubes_rpc/policy"
|
POLICY_FILE_DIR="/etc/qubes_rpc/policy"
|
||||||
@ -156,7 +157,16 @@ def main():
|
|||||||
if policy_dict.has_key("action.user"):
|
if policy_dict.has_key("action.user"):
|
||||||
user=policy_dict["action.user"]
|
user=policy_dict["action.user"]
|
||||||
else:
|
else:
|
||||||
user="user"
|
qvm_collection = QubesVmCollection()
|
||||||
|
qvm_collection.lock_db_for_reading()
|
||||||
|
qvm_collection.load()
|
||||||
|
qvm_collection.unlock_db()
|
||||||
|
vm = qvm_collection.get_vm_by_name(target)
|
||||||
|
if vm is None:
|
||||||
|
print >> sys.stderr, "Cannot find settings of VM '%s', assuming default user 'user'" % target
|
||||||
|
user = "user"
|
||||||
|
else:
|
||||||
|
user = vm.default_user
|
||||||
do_execute(domain, target, user, exec_index, process_ident)
|
do_execute(domain, target, user, exec_index, process_ident)
|
||||||
|
|
||||||
print >> sys.stderr, "Rpc denied:", domain, target, exec_index
|
print >> sys.stderr, "Rpc denied:", domain, target, exec_index
|
||||||
|
Loading…
Reference in New Issue
Block a user