run: also enable interactive authentication on opening pty

This commit is contained in:
Yu Watanabe
2024-08-19 11:36:32 +09:00
parent 1b8a74678c
commit cc3e48b3c1
+4 -2
View File
@@ -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;