summaryrefslogtreecommitdiffstats
path: root/src/network/networkd-manager-bus.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-11-22 18:56:19 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-12-21 21:27:36 +0100
commit7b36fb9f96fd5c1f63b9f0f9e75194e3e4dd6a8d (patch)
tree44961376a5e0a1da8e3614bfb7531acbc6dd0912 /src/network/networkd-manager-bus.c
parentMerge pull request #30567 from yuwata/hashmap_isempty (diff)
downloadsystemd-7b36fb9f96fd5c1f63b9f0f9e75194e3e4dd6a8d.tar.xz
systemd-7b36fb9f96fd5c1f63b9f0f9e75194e3e4dd6a8d.zip
polkit: simplify bus_verify_polkit_async() + drop auth-by-cap dbus feature
This simplifies bus_verify_polkit_async() and related calls quite a bit: 1. This removes any support for authentication-by-Linux-capability. This is ultimately a kdbus leftover: with classic AF_UNIX transports we cannot authenticate by capabilities securely (because we cannot acquire it from the peer without races), hence we never actually did. Since the necessary kernel work didn't materialize in the last 10y, and is unlikely to be added, let's just kill this context. We cannot quite remove the caps stuff from sd-bus for API compat, but for our polkit logic let's kill it. 2. The "good_uid" and "interactive" params are only necessary in very few cases, hence let's move them to a new call bus_verify_polkit_async_full() and make bus_verify_polkit_async() a wrapper around it without those two parameters. This also fixes a bunch of wrong uses of the "interactive" bool. The bool makes no sense today as the ALLOW_INTERACTIVE_AUTHORIZATION field in the D-Bus message header replaces it fully. We only need it to implement method calls we introduced prior to that header field becoming available in D-Bus. And it should only be used on such old method calls, and otherwise always be set to false. This does not change behaviour in any way. Just simplifies stuff. Fixes: #21586
Diffstat (limited to 'src/network/networkd-manager-bus.c')
-rw-r--r--src/network/networkd-manager-bus.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/network/networkd-manager-bus.c b/src/network/networkd-manager-bus.c
index aecbc1d67c..a8906f81c1 100644
--- a/src/network/networkd-manager-bus.c
+++ b/src/network/networkd-manager-bus.c
@@ -201,10 +201,12 @@ static int bus_method_reload(sd_bus_message *message, void *userdata, sd_bus_err
Manager *manager = userdata;
int r;
- r = bus_verify_polkit_async(message, CAP_NET_ADMIN,
- "org.freedesktop.network1.reload",
- NULL, true, UID_INVALID,
- &manager->polkit_registry, error);
+ r = bus_verify_polkit_async(
+ message,
+ "org.freedesktop.network1.reload",
+ /* details= */ NULL,
+ &manager->polkit_registry,
+ error);
if (r < 0)
return r;
if (r == 0)