1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-02 13:47:27 +03:00

sd-bus: also intrepret $SYSTEMD_SSH env var

To make things symmetric to the $SYSTEMD_SSH logic that the varlink
transport supports, let's also honour such a variable in sd-bus when
picking ssh transport.
This commit is contained in:
Lennart Poettering 2024-01-08 23:06:48 +01:00
parent a1bb30de7f
commit bcb1bb379e
2 changed files with 11 additions and 4 deletions

View File

@ -611,7 +611,8 @@ SYSTEMD_HOME_DEBUG_SUFFIX=foo \
to expose a single device only, since those identifiers better should be kept
unique.
Tools using the Varlink protocol, such as `varlinkctl`:
Tools using the Varlink protocol (such as `varlinkctl`) or sd-bus (such as
`busctl`):
* `$SYSTEMD_SSH` the ssh binary to invoke when the `ssh:` transport is
used. May be a filename (which is searched for in `$PATH`) or absolute path.

View File

@ -1486,9 +1486,15 @@ interpret_port_as_machine_old_syntax:
return -ENOMEM;
}
a = strjoin("unixexec:path=ssh,argv1=-xT", p ? ",argv2=-p,argv3=" : "", strempty(p),
",argv", p ? "4" : "2", "=--,argv", p ? "5" : "3", "=", e,
",argv", p ? "6" : "4", "=systemd-stdio-bridge", c);
const char *ssh = secure_getenv("SYSTEMD_SSH") ?: "ssh";
_cleanup_free_ char *ssh_escaped = bus_address_escape(ssh);
if (!ssh_escaped)
return -ENOMEM;
a = strjoin("unixexec:path=", ssh_escaped, ",argv1=-xT",
p ? ",argv2=-p,argv3=" : "", strempty(p),
",argv", p ? "4" : "2", "=--,argv", p ? "5" : "3", "=", e,
",argv", p ? "6" : "4", "=systemd-stdio-bridge", c);
if (!a)
return -ENOMEM;