From: Lennart Poettering Date: Mon, 17 Sep 2012 23:16:23 +0000 (+0200) Subject: logind: split up inhibit acquire policy X-Git-Tag: v190~46 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=b14eda963c698aa89fac1d91501d572ec644cc2f logind: split up inhibit acquire policy --- diff --git a/TODO b/TODO index 0a2ced476..eed8ff934 100644 --- a/TODO +++ b/TODO @@ -24,8 +24,6 @@ Bugfixes: F18: -* refuse automount triggers when automount is queued for stop, much like we refuse socket triggers when sockets are queued for stop - * logind: different policy actions for idle, suspend, shutdown blockers: allow idle blockers by default, don't allow suspend blockers by default * selinux: merge systemd selinux access controls (dwalsh) diff --git a/src/core/socket.c b/src/core/socket.c index f975a4333..f346030f0 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -1850,7 +1850,8 @@ static void socket_fd_event(Unit *u, int fd, uint32_t events, Watch *w) { if (w->socket_accept) { for (;;) { - if ((cfd = accept4(fd, NULL, NULL, SOCK_NONBLOCK)) < 0) { + cfd = accept4(fd, NULL, NULL, SOCK_NONBLOCK); + if (cfd < 0) { if (errno == EINTR) continue; diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index af62d8782..4f180b013 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -723,9 +723,10 @@ static int bus_manager_inhibit(Manager *m, DBusConnection *connection, DBusMessa } r = verify_polkit(connection, message, - m == INHIBIT_BLOCK ? - "org.freedesktop.login1.inhibit-block" : - "org.freedesktop.login1.inhibit-delay", false, NULL, error); + w == INHIBIT_SHUTDOWN ? (mm == INHIBIT_BLOCK ? "org.freedesktop.login1.inhibit-block-shutdown" : "org.freedesktop.login1.inhibit-delay-shutdown") : + w == INHIBIT_SLEEP ? (mm == INHIBIT_BLOCK ? "org.freedesktop.login1.inhibit-block-sleep" : "org.freedesktop.login1.inhibit-delay-sleep") : + (mm == INHIBIT_BLOCK ? "org.freedesktop.login1.inhibit-block-idle" : "org.freedesktop.login1.inhibit-delay-idle"), + false, NULL, error); if (r < 0) goto fail; diff --git a/src/login/org.freedesktop.login1.policy.in b/src/login/org.freedesktop.login1.policy.in index 92c0a4d32..970adbeff 100644 --- a/src/login/org.freedesktop.login1.policy.in +++ b/src/login/org.freedesktop.login1.policy.in @@ -16,9 +16,9 @@ The systemd Project http://www.freedesktop.org/wiki/Software/systemd - - <_description>Allow applications to inhibit system shutdown and suspend - <_message>Authentication is required to allow an application to inhibit system shutdown or suspend. + + <_description>Allow applications to inhibit system shutdown + <_message>Authentication is required to allow an application to inhibit system shutdown. auth_admin_keep yes @@ -26,9 +26,49 @@ - - <_description>Allow applications to delay system shutdown and suspend - <_message>Authentication is required to allow an application to delay system shutdown or suspend. + + <_description>Allow applications to inhibit system sleep + <_message>Authentication is required to allow an application to inhibit system sleep. + + auth_admin_keep + yes + yes + + + + + <_description>Allow applications to inhibit automatic system suspend + <_message>Authentication is required to allow an application to inhibit automatic system suspend. + + yes + yes + yes + + + + + <_description>Allow applications to delay system shutdown + <_message>Authentication is required to allow an application to delay system shutdown. + + yes + yes + yes + + + + + <_description>Allow applications to delay system sleep + <_message>Authentication is required to allow an application to delay system sleep. + + yes + yes + yes + + + + + <_description>Allow applications to delay automatic system suspend + <_message>Authentication is required to allow an application to delay automatic system suspend. yes yes