Package: lightdm
Followup-For: Bug #648604

Hi,

I've hacked lightdm a bit and added support for wtmp, I'm attaching
a patch. Support for btmp is still missing but that will also only
involve a few changes.

Cheers,

Adrian
=== modified file 'src/session-child.c'
--- old/src/session-child.c	2012-07-23 05:28:25 +0000
+++ new/src/session-child.c	2012-10-17 14:12:40 +0000
@@ -19,6 +19,28 @@
 #include "privileges.h"
 #include "xauthority.h"
 
+/* shamelessly stolen from gdm3 */
+
+#ifndef LIGHTDM_BAD_SESSION_RECORDS_FILE
+#define LIGHTDM_BAD_SESSION_RECORDS_FILE "/var/log/btmp"
+#endif
+
+#if !defined(LIGHTDM_NEW_SESSION_RECORDS_FILE)
+#    if defined(WTMPX_FILE)
+#        define LIGHTDM_NEW_SESSION_RECORDS_FILE WTMPX_FILE
+#    elif defined(_PATH_WTMPX)
+#        define LIGHTDM_NEW_SESSION_RECORDS_FILE _PATH_WTMPX
+#    elif defined(WTMPX_FILENAME)
+#        define LIGHTDM_NEW_SESSION_RECORDS_FILE WTMPX_FILENAME
+#    elif defined(WTMP_FILE)
+#        define LIGHTDM_NEW_SESSION_RECORDS_FILE WTMP_FILE
+#    elif defined(_PATH_WTMP) /* BSD systems */
+#        define LIGHTDM_NEW_SESSION_RECORDS_FILE _PATH_WTMP
+#    else
+#        define LIGHTDM_NEW_SESSION_RECORDS_FILE "/var/log/wtmp"
+#    endif
+#endif
+
 /* Child process being run */
 static GPid child_pid = 0;
 
@@ -548,6 +570,8 @@
             ut.ut_tv.tv_sec = tv.tv_sec;
             ut.ut_tv.tv_usec = tv.tv_usec;
 
+            updwtmp (LIGHTDM_NEW_SESSION_RECORDS_FILE, &ut);
+
             setutxent ();
             if (!pututxline (&ut))
                 g_printerr ("Failed to write utmpx: %s\n", strerror (errno));
@@ -577,6 +601,8 @@
             ut.ut_tv.tv_sec = tv.tv_sec;
             ut.ut_tv.tv_usec = tv.tv_usec;
 
+            updwtmp (LIGHTDM_NEW_SESSION_RECORDS_FILE, &ut);
+
             setutxent ();
             if (!pututxline (&ut))
                 g_printerr ("Failed to write utmpx: %s\n", strerror (errno));

Reply via email to