Add script to unlock a broken session via ConsoleKit.
ClosedPublic

Authored by tcberner on Jan 7 2018, 5:56 PM.

Diff Detail

Repository
R133 KScreenLocker
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
tcberner created this revision.Jan 7 2018, 5:56 PM
Restricted Application added a project: Plasma. · View Herald TranscriptJan 7 2018, 5:56 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
tcberner requested review of this revision.Jan 7 2018, 5:56 PM
graesslin requested changes to this revision.Jan 9 2018, 5:26 AM
graesslin added a subscriber: graesslin.
graesslin added inline comments.
abstractlocker.cpp
54

I think this needs to be runtime detected.

This revision now requires changes to proceed.Jan 9 2018, 5:26 AM
tcberner added inline comments.Jan 9 2018, 6:07 AM
abstractlocker.cpp
54

So something ala

  • if logingd-runing then logindmessage
  • if consolekit-running then consolekitmessage
  • else falback message
graesslin added inline comments.Jan 9 2018, 6:57 PM
abstractlocker.cpp
54

That would be the ultimate solution ;-)

tcberner updated this revision to Diff 26031.Jan 27 2018, 10:16 AM

Use QDbus to query whether ConsoleKit or LoginD is presnet (note, I have not tested LoginD :) )

tcberner added a reviewer: Plasma.
graesslin accepted this revision.Jan 27 2018, 2:19 PM

I like it! Thanks a lot for adding the runtime checking.

This revision is now accepted and ready to land.Jan 27 2018, 2:19 PM
pprkut added a subscriber: pprkut.Jan 27 2018, 2:29 PM
pprkut added inline comments.
CMakeLists.txt
102

Nitpick, but this should probably mention ConsoleKit/ConsoleKit2, not loginctl

adridg added a subscriber: adridg.Jan 27 2018, 5:18 PM
adridg added inline comments.
abstractlocker.cpp
69

Drop ".Session", since the service is registered (Manjaro, KDE Neon) as "org.freedesktop.login1".

tcberner updated this revision to Diff 27898.Feb 24 2018, 8:05 AM
  • Fix logind1 dbus path
  • Improve CMakeLists.txt to only display the feature once

On FreeBSD the configure now looks like:

[...]
-- Could NOT find loginctl (missing: loginctl_EXECUTABLE) 
-- Found ConsoleKit: /usr/local/bin/ck-list-sessions  
[...]
 * prctl/procctl tracing control, Required for disallowing ptrace on greeter and kcheckpass process
 * sys/event.h, Use the kevent() and sigwaitinfo() api for signalhandling
 * XInput, Required for grabbing XInput2 devices in the screen locker
 * Unlock broken screenlocker, Needed for emergency unlock in case that the greeter is broken. In case your distribution does not provide loginctl or consolekit please contact plasma-devel@kde.org to discuss alternatives.

-- The following OPTIONAL packages have been found:

 * WaylandScanner, Executable that converts XML protocol files to C code, <http://wayland.freedesktop.org>
 * PkgConfig

-- The following RECOMMENDED packages have been found:

 * ConsoleKit, Framework for defining and tracking users, <http://www.freedesktop.org/wiki/Software/ConsoleKit>
[...]

Framework for […] tracking users

is a bit of an unfortunate term

pprkut added inline comments.Feb 24 2018, 8:28 AM
CMakeLists.txt
99

It's probably better to refer to https://github.com/ConsoleKit2/ConsoleKit2 here. The freedesktop site doesn't mention ConsoleKit2 anywhere (afaics) and classic freedesktop ConsoleKit is old and doesn't provide the necessary dbus interfaces needed for plasma.

tcberner updated this revision to Diff 27901.Feb 24 2018, 9:05 AM
  • Switch the url to https://github.com/ConsoleKit2/ConsoleKit2
  • coble together something less "unfortunate" from the official description: ConsoleKit2 is a framework for defining and tracking users, login sessions, and seats.
graesslin accepted this revision.Feb 24 2018, 6:52 PM
This revision was automatically updated to reflect the committed changes.
tcberner marked an inline comment as done.
arfrever added inline comments.
CMakeLists.txt
97

I would suggest that this build-time detection of ConsoleKit occur always, and as a result, that ck-unlock-session be always installed if ConsoleKit is installed.
For example, I have both loginctl and ConsoleKit installed, but loginctl is not running and ConsoleKit is running.
(loginctl is part of systemd whose library functionality can be used by other packages even when systemd is not used as init system.)

graesslin added inline comments.Feb 25 2018, 8:20 PM
CMakeLists.txt
97

You can disable the detection of loginctl through cmake functionality.

We could certainly do that by removing the wrapping if ( NOT HAVE_LOGINCTL ).
Additionally, also the order of the if-branches in abstractlocker.cpp would probably need to be reordered as to prefere login1.