]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/dbus-manager: refuse SoftReboot() for user managers
authorMike Yuan <me@yhndnzj.com>
Tue, 2 Jul 2024 16:08:06 +0000 (18:08 +0200)
committerMike Yuan <me@yhndnzj.com>
Wed, 3 Jul 2024 08:11:24 +0000 (10:11 +0200)
Otherwise, busctl --user call ... SoftReboot results in
user manager broadcasting signal and initiating soft-reboot...

src/core/dbus-manager.c

index ddc721f5d19774643f8d9d68ca64832c0222981d..3d2796f2c41079c0c5e617472ef93391d6c3a304 100644 (file)
@@ -1709,6 +1709,10 @@ static int method_soft_reboot(sd_bus_message *message, void *userdata, sd_bus_er
 
         assert(message);
 
+        if (!MANAGER_IS_SYSTEM(m))
+                return sd_bus_error_set(error, SD_BUS_ERROR_NOT_SUPPORTED,
+                                        "Soft reboot is only supported by system manager.");
+
         r = verify_run_space_permissive("soft reboot may fail", error);
         if (r < 0)
                 return r;