]> git.ipfire.org Git - thirdparty/systemd.git/commit
bus-polkit: shortcut auth. after first denial
authorDavid Tardon <dtardon@redhat.com>
Fri, 7 Mar 2025 15:22:00 +0000 (16:22 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 11 Mar 2025 16:18:12 +0000 (17:18 +0100)
commit536c18e5c33fd682fcd38d228b46a339adbe150b
treee84fe9d40629e49577b7e6aa2e640c2328df112f
parentcd20d48c69f9e586de914e1facf33b11122477ae
bus-polkit: shortcut auth. after first denial

A D-Bus/Varlink method can issue PolicyKit auth. requests for multiple
actions; in this case the method is expected to fail on the first one
that is not allowed. This is enforced by asserts in
async_polkit_read_reply(), but that's a wrong place for the check for
two reasons:

1. it doesn't allow to get a meaningful stack trace;
2. sending the query to polkit is already a pointless exercise.

Let's do the check in *_verify_polkit_async_full() and don't send
anything to PolicyKit in that case.

Inspired by https://bugzilla.redhat.com/show_bug.cgi?id=2349594 .
src/shared/bus-polkit.c