]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
run: also enable interactive authentication on opening pty 34009/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 16 Aug 2024 11:00:25 +0000 (20:00 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 19 Aug 2024 02:36:32 +0000 (11:36 +0900)
src/run/run.c

index f2f94c5dfda6e4abc10e74d9aa970d7690f4b29a..fb800758b383063cf333ee5e55001f458cd632d9 100644 (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;