From cc3e48b3c1c5d878ce7ea78eb4f3b6fa2a685450 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 16 Aug 2024 20:00:25 +0900 Subject: [PATCH] run: also enable interactive authentication on opening pty --- src/run/run.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/run/run.c b/src/run/run.c index f2f94c5dfda..fb800758b38 100644 --- a/src/run/run.c +++ b/src/run/run.c @@ -1730,6 +1730,8 @@ static int start_transient_service(sd_bus *bus) { assert(bus); + (void) polkit_agent_open_if_enabled(arg_transport, arg_ask_password); + if (arg_stdio == ARG_STDIO_PTY) { if (IN_SET(arg_transport, BUS_TRANSPORT_LOCAL, BUS_TRANSPORT_CAPSULE)) { @@ -1765,6 +1767,8 @@ static int start_transient_service(sd_bus *bus) { if (r < 0) return log_error_errno(r, "Failed to connect to system bus: %m"); + (void) sd_bus_set_allow_interactive_authorization(system_bus, arg_ask_password); + r = bus_call_method(system_bus, bus_machine_mgr, "OpenMachinePTY", @@ -1819,8 +1823,6 @@ static int start_transient_service(sd_bus *bus) { return r; slave = safe_close(slave); - (void) polkit_agent_open_if_enabled(arg_transport, arg_ask_password); - r = bus_call_with_hint(bus, m, "service", &reply); if (r < 0) return r; -- 2.47.3