Skip to content

Commit

Permalink
Always pass a service argument
Browse files Browse the repository at this point in the history
The argument is not really optional, and not passing one leads to bugs
on the VM side.
  • Loading branch information
DemiMarie committed Jan 8, 2025
1 parent 3b9da29 commit f3307e1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
11 changes: 9 additions & 2 deletions qubesadmin/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,8 +861,15 @@ def run_service(self, dest, service, user=None, *, filter_esc=False,
kwargs.setdefault('stdout', subprocess.PIPE)
kwargs.setdefault('stderr', subprocess.PIPE)
proc = subprocess.Popen(
[qubesadmin.config.QREXEC_CLIENT] + qrexec_opts + [
'{}:QUBESRPC {} dom0'.format(user, service)], **kwargs)
[qubesadmin.config.QREXEC_CLIENT]
+ qrexec_opts
+ [
"{}:QUBESRPC {}{} dom0".format(
user, service, "" if "+" in service else "+"
)
],
**kwargs,
)
return proc


Expand Down
6 changes: 3 additions & 3 deletions qubesadmin/tests/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ def test_010_run_service(self):
self.app.run_service('some-vm', 'service.name')
mock_proc.assert_called_once_with([
qubesadmin.config.QREXEC_CLIENT,
'-d', 'some-vm', '-T', 'DEFAULT:QUBESRPC service.name dom0'],
'-d', 'some-vm', '-T', 'DEFAULT:QUBESRPC service.name+ dom0'],
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)

Expand All @@ -1013,7 +1013,7 @@ def test_011_run_service_filter_esc(self):
mock_proc.assert_called_once_with([
qubesadmin.config.QREXEC_CLIENT,
'-d', 'some-vm', '-t', '-T',
'DEFAULT:QUBESRPC service.name dom0'],
'DEFAULT:QUBESRPC service.name+ dom0'],
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)

Expand All @@ -1028,7 +1028,7 @@ def test_012_run_service_user(self):
mock_proc.assert_called_once_with([
qubesadmin.config.QREXEC_CLIENT,
'-d', 'some-vm', '-T',
'user:QUBESRPC service.name dom0'],
'user:QUBESRPC service.name+ dom0'],
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)

Expand Down

0 comments on commit f3307e1

Please sign in to comment.