Skip to content

Commit 400261f

Browse files
committed
Revert "logind-dbus: check auth. for all inhibitor operations"
This has been reported to cause a regression. Fixes #447 This reverts commit 75aefdd.
1 parent 85cc6a4 commit 400261f

File tree

1 file changed

+20
-25
lines changed

1 file changed

+20
-25
lines changed

src/login/logind-dbus.c

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
#include "alloc-util.h"
1111
#include "audit-util.h"
12-
#include "bitfield.h"
1312
#include "bootspec.h"
1413
#include "bus-common-errors.h"
1514
#include "bus-error.h"
@@ -3236,30 +3235,26 @@ static int method_inhibit(sd_bus_message *message, void *userdata, sd_bus_error
32363235
return sd_bus_error_setf(error, BUS_ERROR_OPERATION_IN_PROGRESS,
32373236
"The operation inhibition has been requested for is already running");
32383237

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 */
32633258

32643259
r = sd_bus_query_sender_creds(message, SD_BUS_CREDS_EUID|SD_BUS_CREDS_PID, &creds);
32653260
if (r < 0)

0 commit comments

Comments
 (0)