1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-12 08:58:20 +03:00

polkit: move asserts up, so that they cover all reply codepaths

(cherry picked from commit c1b2e1a89a54dc5ec51f5f1c6257a2956782b296)
This commit is contained in:
Lennart Poettering 2023-08-09 10:51:40 +02:00 committed by Zbigniew Jędrzejewski-Szmek
parent 154b83bb6c
commit 7ddbacbaa5

View File

@ -255,6 +255,11 @@ static int async_polkit_read_reply(sd_bus_message *reply, AsyncPolkitQuery *q) {
assert(reply);
assert(q);
/* Processing of a PolicyKit checks is canceled on the first auth. error. */
assert(!q->denied_action);
assert(!q->error_action);
assert(!sd_bus_error_is_set(&q->error));
assert(q->action);
a = TAKE_PTR(q->action);
@ -272,7 +277,6 @@ static int async_polkit_read_reply(sd_bus_message *reply, AsyncPolkitQuery *q) {
/* Treat no PK available as access denied */
q->denied_action = TAKE_PTR(a);
return 0;
}
@ -282,12 +286,6 @@ static int async_polkit_read_reply(sd_bus_message *reply, AsyncPolkitQuery *q) {
if (r < 0)
return r;
/* It's currently expected that processing of a DBus message shall be interrupted on the first
* auth. error */
assert(!q->denied_action);
assert(!q->error_action);
assert(!sd_bus_error_is_set(&q->error));
if (authorized)
LIST_PREPEND(authorized, q->authorized_actions, TAKE_PTR(a));
else if (challenge) {