Fixed obtaining process list in power.sh to avoid SELinux denials
Resolves: rhbz#1408457
This commit is contained in:
parent
ce6e405603
commit
b490262b76
@ -2,12 +2,19 @@
|
||||
|
||||
PATH=/usr/sbin:/usr/bin
|
||||
|
||||
# $1 = session number
|
||||
function get_session_processes() {
|
||||
local uid=$(loginctl show-session $1 | grep '^User=' | sed -r -e 's/^User=(.*)$/\1/')
|
||||
systemd-cgls "/user.slice/user-${uid}.slice/session-${1}.scope"
|
||||
}
|
||||
|
||||
# Check session status using systemd
|
||||
session_ids=$(loginctl list-sessions 2>/dev/null | awk '{print $1}')
|
||||
for session in ${session_ids} ; do
|
||||
session_status=$(loginctl session-status ${session})
|
||||
echo "${session_status}" | grep -e '\(Active: yes\|State: active\)' &> /dev/null &&
|
||||
echo "${session_status}" | grep -e '\(gnome-settings-daemon\|cinnamon-settings-daemon\|kded[4-5]\|plasmashell\|xfce4-power-manager\|mate-power-manager\)' &> /dev/null && exit 0
|
||||
session_status=$(loginctl show-session ${session})
|
||||
session_processes="$(get_session_processes ${session})"
|
||||
echo "${session_status}" | grep -e 'Active=yes' &> /dev/null &&
|
||||
echo "${session_processes}" | grep -e '\(gnome-settings-daemon\|cinnamon-settings-daemon\|kded[4-5]\|plasmashell\|xfce4-power-manager\|mate-power-manager\)' &> /dev/null && exit 0
|
||||
done
|
||||
|
||||
# Get the ID of the first active X11 session: using ConsoleKit
|
||||
|
@ -8,7 +8,7 @@
|
||||
Summary: ACPI Event Daemon
|
||||
Name: acpid
|
||||
Version: 2.0.28
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
License: GPLv2+
|
||||
Group: System Environment/Daemons
|
||||
Source: http://downloads.sourceforge.net/acpid2/%{name}-%{version}.tar.xz
|
||||
@ -135,6 +135,10 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Jan 18 2017 Ondřej Lysoněk <olysonek@redhat.com> - 2.0.28-2
|
||||
- Fixed obtaining process list in power.sh to avoid SELinux denials
|
||||
Resolves: rhbz#1408457
|
||||
|
||||
* Fri Sep 16 2016 Jaroslav Škarvada <jskarvad@redhat.com> - 2.0.28-1
|
||||
- New version
|
||||
Resolves: rhbz#1376618
|
||||
|
Loading…
Reference in New Issue
Block a user