|
9 | 9 |
|
10 | 10 | #include "alloc-util.h"
|
11 | 11 | #include "audit-util.h"
|
12 |
| -#include "bitfield.h" |
13 | 12 | #include "bootspec.h"
|
14 | 13 | #include "bus-common-errors.h"
|
15 | 14 | #include "bus-error.h"
|
@@ -3236,30 +3235,26 @@ static int method_inhibit(sd_bus_message *message, void *userdata, sd_bus_error
|
3236 | 3235 | return sd_bus_error_setf(error, BUS_ERROR_OPERATION_IN_PROGRESS,
|
3237 | 3236 | "The operation inhibition has been requested for is already running");
|
3238 | 3237 |
|
3239 |
| - BIT_FOREACH(i, w) { |
3240 |
| - const InhibitWhat v = 1U << i; |
3241 |
| - |
3242 |
| - r = bus_verify_polkit_async( |
3243 |
| - message, |
3244 |
| - CAP_SYS_BOOT, |
3245 |
| - v == INHIBIT_SHUTDOWN ? (mm == INHIBIT_BLOCK ? "org.freedesktop.login1.inhibit-block-shutdown" : "org.freedesktop.login1.inhibit-delay-shutdown") : |
3246 |
| - v == INHIBIT_SLEEP ? (mm == INHIBIT_BLOCK ? "org.freedesktop.login1.inhibit-block-sleep" : "org.freedesktop.login1.inhibit-delay-sleep") : |
3247 |
| - v == INHIBIT_IDLE ? "org.freedesktop.login1.inhibit-block-idle" : |
3248 |
| - v == INHIBIT_HANDLE_POWER_KEY ? "org.freedesktop.login1.inhibit-handle-power-key" : |
3249 |
| - v == INHIBIT_HANDLE_SUSPEND_KEY ? "org.freedesktop.login1.inhibit-handle-suspend-key" : |
3250 |
| - v == INHIBIT_HANDLE_REBOOT_KEY ? "org.freedesktop.login1.inhibit-handle-reboot-key" : |
3251 |
| - v == INHIBIT_HANDLE_HIBERNATE_KEY ? "org.freedesktop.login1.inhibit-handle-hibernate-key" : |
3252 |
| - "org.freedesktop.login1.inhibit-handle-lid-switch", |
3253 |
| - /* details= */ NULL, |
3254 |
| - false, |
3255 |
| - UID_INVALID, |
3256 |
| - &m->polkit_registry, |
3257 |
| - error); |
3258 |
| - if (r < 0) |
3259 |
| - return r; |
3260 |
| - if (r == 0) |
3261 |
| - return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ |
3262 |
| - } |
| 3238 | + r = bus_verify_polkit_async( |
| 3239 | + message, |
| 3240 | + CAP_SYS_BOOT, |
| 3241 | + w == INHIBIT_SHUTDOWN ? (mm == INHIBIT_BLOCK ? "org.freedesktop.login1.inhibit-block-shutdown" : "org.freedesktop.login1.inhibit-delay-shutdown") : |
| 3242 | + w == INHIBIT_SLEEP ? (mm == INHIBIT_BLOCK ? "org.freedesktop.login1.inhibit-block-sleep" : "org.freedesktop.login1.inhibit-delay-sleep") : |
| 3243 | + w == INHIBIT_IDLE ? "org.freedesktop.login1.inhibit-block-idle" : |
| 3244 | + w == INHIBIT_HANDLE_POWER_KEY ? "org.freedesktop.login1.inhibit-handle-power-key" : |
| 3245 | + w == INHIBIT_HANDLE_SUSPEND_KEY ? "org.freedesktop.login1.inhibit-handle-suspend-key" : |
| 3246 | + w == INHIBIT_HANDLE_REBOOT_KEY ? "org.freedesktop.login1.inhibit-handle-reboot-key" : |
| 3247 | + w == INHIBIT_HANDLE_HIBERNATE_KEY ? "org.freedesktop.login1.inhibit-handle-hibernate-key" : |
| 3248 | + "org.freedesktop.login1.inhibit-handle-lid-switch", |
| 3249 | + NULL, |
| 3250 | + false, |
| 3251 | + UID_INVALID, |
| 3252 | + &m->polkit_registry, |
| 3253 | + error); |
| 3254 | + if (r < 0) |
| 3255 | + return r; |
| 3256 | + if (r == 0) |
| 3257 | + return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ |
3263 | 3258 |
|
3264 | 3259 | r = sd_bus_query_sender_creds(message, SD_BUS_CREDS_EUID|SD_BUS_CREDS_PID, &creds);
|
3265 | 3260 | if (r < 0)
|
|
0 commit comments