forked from pool/systemd
e7c96ab7f3
- Add patch 0001-bnc888612-logind-polkit-acpi.patch from Frederic to solve bnc#888612 - AUDIT-0: Power button press at gdm login should not prompt for credentials - Add upstream bugfix patches 0001-journal-Do-not-count-on-the-compiler-initializing-fo.patch 0002-include-fcntl.h-rather-than-sys-fcntl.h.patch 0003-mount-order-options-before-other-arguments-to-mount.patch 0004-shared-wtmp-utmp-don-t-clear-store_wtmp-in-utmp_put_.patch 0005-shared-label.h-add-missing-stdio.h-include.patch 0006-shared-sparse-endian.h-add-missing-byteswap.h-includ.patch 0007-libudev-monitor-warn-if-we-fail-to-request-SO_PASSCR.patch 0008-shared-conf-parser-don-t-leak-memory-on-error-in-DEF.patch 1080-udevd-parse_argv-warn-if-argumens-are-invalid.patch 1081-udevd-check-return-of-various-functions.patch 1082-udevadm-hwdb-check-return-value-of-fseeko.patch 1083-udev-node-warn-if-chmod-chown-fails.patch 1084-udev-ctrl-log-if-setting-SO_PASSCRED-fails.patch 1085-udev-fix-typos.patch 1086-udevd-don-t-fail-if-run-udev-exists.patch - Add upstream bugfix patches 0001-core-fix-resource-leak-in-manager_environment_add.patch 0002-util-remove-a-unnecessary-check.patch 0003-udev-event-explicitly-don-t-read-from-invalid-fd.patch 0004-shared-conf-parser.patch 0005-logind-fix-typo.patch 0006-systemctl-fix-resource-leak-CID-1237747.patch 0007-libudev-monitor-warn-if-we-fail-to-request-SO_PASSCR.patch 0008-shared-conf-parser-don-t-leak-memory-on-error-in-DEF.patc OBS-URL: https://build.opensuse.org/request/show/250254 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=207
76 lines
3.4 KiB
Diff
76 lines
3.4 KiB
Diff
---
|
|
src/login/logind-action.c | 5 +++++
|
|
src/login/logind-dbus.c | 20 ++++++++++++++++----
|
|
2 files changed, 21 insertions(+), 4 deletions(-)
|
|
|
|
Index: systemd-210/src/login/logind-action.c
|
|
===================================================================
|
|
--- systemd-210/src/login/logind-action.c
|
|
+++ systemd-210/src/login/logind-action.c
|
|
@@ -101,6 +101,11 @@ int manager_handle_action(
|
|
|
|
/* If the key handling is inhibited, don't do anything */
|
|
if (inhibit_key > 0) {
|
|
+ if (inhibit_key == INHIBIT_HANDLE_POWER_KEY) {
|
|
+ int fd;
|
|
+ fd = open("/run/systemd/acpi-shutdown", O_CREAT|O_WRONLY|O_TRUNC, S_IRUSR);
|
|
+ close(fd);
|
|
+ }
|
|
if (manager_is_inhibited(m, inhibit_key, INHIBIT_BLOCK, NULL, true, false, 0, NULL)) {
|
|
log_debug("Refusing operation, %s is inhibited.", inhibit_what_to_string(inhibit_key));
|
|
return 0;
|
|
Index: systemd-210/src/login/logind-dbus.c
|
|
===================================================================
|
|
--- systemd-210/src/login/logind-dbus.c
|
|
+++ systemd-210/src/login/logind-dbus.c
|
|
@@ -1469,9 +1469,11 @@ static int method_do_shutdown_or_sleep(
|
|
sd_bus_error *error) {
|
|
|
|
_cleanup_bus_creds_unref_ sd_bus_creds *creds = NULL;
|
|
- bool multiple_sessions, blocked;
|
|
+ bool multiple_sessions, blocked, shutdown_through_acpi;
|
|
int interactive, r;
|
|
uid_t uid;
|
|
+ int fd;
|
|
+ struct stat buf;
|
|
|
|
assert(m);
|
|
assert(message);
|
|
@@ -1515,7 +1517,17 @@ static int method_do_shutdown_or_sleep(
|
|
multiple_sessions = r > 0;
|
|
blocked = manager_is_inhibited(m, w, INHIBIT_BLOCK, NULL, false, true, uid, NULL);
|
|
|
|
- if (multiple_sessions) {
|
|
+ fd = open ("/run/systemd/acpi-shutdown", O_NOFOLLOW|O_PATH|O_CLOEXEC);
|
|
+ if (fd >= 0) {
|
|
+ shutdown_through_acpi = ((fstat(fd,&buf) == 0) && (time(NULL) - buf.st_mtime <= 65));
|
|
+ close(fd);
|
|
+ unlink ("/run/systemd/acpi-shutdown");
|
|
+ }
|
|
+ else
|
|
+ shutdown_through_acpi = false;
|
|
+
|
|
+
|
|
+ if (multiple_sessions && !shutdown_through_acpi) {
|
|
r = bus_verify_polkit_async(m->bus, &m->polkit_registry, message,
|
|
action_multiple_sessions, interactive, error, method, m);
|
|
if (r < 0)
|
|
@@ -1524,7 +1536,7 @@ static int method_do_shutdown_or_sleep(
|
|
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
|
|
}
|
|
|
|
- if (blocked) {
|
|
+ if (blocked && !shutdown_through_acpi) {
|
|
r = bus_verify_polkit_async(m->bus, &m->polkit_registry, message,
|
|
action_ignore_inhibit, interactive, error, method, m);
|
|
if (r < 0)
|
|
@@ -1533,7 +1545,7 @@ static int method_do_shutdown_or_sleep(
|
|
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
|
|
}
|
|
|
|
- if (!multiple_sessions && !blocked) {
|
|
+ if (!multiple_sessions && !blocked && !shutdown_through_acpi) {
|
|
r = bus_verify_polkit_async(m->bus, &m->polkit_registry, message,
|
|
action, interactive, error, method, m);
|
|
if (r < 0)
|