[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#714428: killer: Should it consult ck-list-sessions to find local sessions?



Package:  killer
Version:  0.90-8
Severity: wishlist
User:     debian-edu@lists.debian.org
Usertags: debian-edu

As can be seen in <URL: http://bugs.debian.org/648604 > and
<URL: http://bugs.debian.org/709521 >, some times display managers fail
to update the utmp database of currently logged in users, and this cause
killer to throw out logged in users.

While this definitely is a bug in lightdm and other display managers to
not update utmp and wtmp, we could consider asking the consolekit module
to list local users when utmp is empty.

Something similar to this might work (the patch is incomplete and
untested):

--- killer-0.90/killer  2000-02-10 16:55:57.000000000 +0100
+++ killer      2013-06-29 09:03:51.000000000 +0200
@@ -871,8 +871,7 @@
 
     $consoleuser = "";
 
-    open ( W, "$whocmd|") || return;
-
+    if (open ( W, "$whocmd|")) {
     while ( <W> ) {
        chop;
        @parts = split(/[ \t]+/);
@@ -883,6 +882,24 @@
     }
     close(W);
 }
+    my $consolekitcmd = '/usr/bin/ck-list-sessions'
+    if ( ! $consoleuser && -x $consolekitcmd) {
+        open ( W, "$consolekitcmd|") || return;
+        my $user;
+        while ( <W> ) {
+            chomp;
+            if (/^\tunix-user = '(\d+)'/) {
+                $user = $1;
+            }
+            if (/^\tis-local = (.+)$/) {
+                if ('TRUE' eq $1) {
+                    $consoleuser = uid2username($user);
+                }
+            }
+        }
+        close(W);
+    }
+}
 
 =head2 showConsoleUser
 
The output from ck-list-sessions look like this:

$ ck-list-sessions 
Session1:
	unix-user = '10001'
	realname = 'Some User'
	seat = 'Seat1'
	session-type = ''
	active = TRUE
	x11-display = ':0'
	x11-display-device = '/dev/tty7'
	display-device = ''
	remote-host-name = ''
	is-local = TRUE
	on-since = '2013-06-28T07:41:00.536509Z'
	login-session-id = ''
%

Should we try to extend killer like this?

-- 
Happy hacking
Petter Reinholdtsen


Reply to: