]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: check for reset-statistics polkit action via D-Bus too
authorLuca Boccassi <luca.boccassi@gmail.com>
Tue, 14 Apr 2026 18:15:48 +0000 (19:15 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 14 Apr 2026 22:07:47 +0000 (00:07 +0200)
The varlink method checks for polkit authorization, so also
update the D-Bus method to match it.

Follow-up for cf01bbb7a45fb1eec28cd0a813bd68fde413410f

src/resolve/resolved-bus.c

index 9e075277ec196fc3414d328008aadca8c74a2a81..e20c975de8b38fd54ef4333f4ec756ce03b34e55 100644 (file)
@@ -1722,9 +1722,21 @@ static int bus_property_get_resolv_conf_mode(
 
 static int bus_method_reset_statistics(sd_bus_message *message, void *userdata, sd_bus_error *error) {
         Manager *m = ASSERT_PTR(userdata);
+        int r;
 
         assert(message);
 
+        r = bus_verify_polkit_async(
+                        message,
+                        "org.freedesktop.resolve1.reset-statistics",
+                        /* details= */ NULL,
+                        &m->polkit_registry,
+                        error);
+        if (r < 0)
+                return r;
+        if (r == 0)
+                return 1; /* Polkit will call us back */
+
         bus_client_log(message, "statistics reset");
 
         dns_manager_reset_statistics(m);