]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/machine/machined-dbus.c
polkit: simplify bus_verify_polkit_async() + drop auth-by-cap dbus feature
authorLennart Poettering <lennart@poettering.net>
Wed, 22 Nov 2023 17:56:19 +0000 (18:56 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 21 Dec 2023 20:27:36 +0000 (05:27 +0900)
commit7b36fb9f96fd5c1f63b9f0f9e75194e3e4dd6a8d
tree44961376a5e0a1da8e3614bfb7531acbc6dd0912
parent207aafe7e1c8838fadca0df153f49fad3e2b5d8b
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
29 files changed:
src/core/dbus-service.c
src/core/dbus-unit.c
src/core/dbus-util.c
src/core/dbus-util.h
src/core/dbus.c
src/home/homed-home-bus.c
src/home/homed-manager-bus.c
src/hostname/hostnamed.c
src/import/importd.c
src/locale/localed.c
src/login/logind-dbus.c
src/login/logind-polkit.c
src/login/logind-seat-dbus.c
src/login/logind-session-dbus.c
src/login/logind-user-dbus.c
src/machine/image-dbus.c
src/machine/machine-dbus.c
src/machine/machined-dbus.c
src/network/networkd-link-bus.c
src/network/networkd-manager-bus.c
src/portable/portabled-bus.c
src/portable/portabled-image-bus.c
src/resolve/resolved-bus.c
src/resolve/resolved-dnssd-bus.c
src/resolve/resolved-link-bus.c
src/shared/bus-polkit.c
src/shared/bus-polkit.h
src/timedate/timedated.c
src/timesync/timesyncd-bus.c