]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/login/logind-dbus.c
logind: refuse operations if the target unit is masked or unavailable
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 10 Apr 2018 11:15:00 +0000 (13:15 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 10 Apr 2018 19:31:59 +0000 (21:31 +0200)
commitc8c8ee85af35f1e9593a7397cfa289a126dfcb8c
treeeeec700a52afe5e3bc38e28045293034f2fe6287
parentbd062910c844a3aa823e1651436d694266c248b1
logind: refuse operations if the target unit is masked or unavailable

If hibernate.target is masked, and systemctl hibernate is invoked, havoc ensues.
logind starts the hibernation operation, but then doesn't go through with it;
gnome-shell segfaults. Let's be nice to the user and refuse doing anything in
that case.

$ sudo systemctl mask hibernate.target
$ busctl call org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager CanHibernate
s "no"
$ sudo systemctl hibernate
Failed to hibernate system via logind: Access denied
Failed to start hibernate.target: Unit hibernate.target is masked.

https://bugzilla.redhat.com/show_bug.cgi?id=1468003#c4
src/login/logind-action.c
src/login/logind-action.h
src/login/logind-dbus.c