It didn't follow into the while (login_p) because read_wtmp() returned garbage.
It was attempting to read an always 32-bit value (ut.ut_time, actually 
ut.ut_tv.tv_sec) with an arch dependent (time_t *) pointer, which on 64-bit 
systems expects 64-bits of data. So half of the bits were some random junk and 
read_wtmp() was just skipping all past login session records.

The following patch appears to fix that:

--- timeoutd.c-old   2012-05-10 16:00:21.000000000 +0200
+++ timeoutd.c  2012-05-11 14:38:35.514021308 +0200
@@ -418,7 +418,8 @@
.
     while (fread(&ut, sizeof(struct utmp), 1, fp) == 1)
     {
-      tm = localtime(&ut.ut_time);
+      time_t utmp_time = ut.ut_time;
+      tm = localtime(&utmp_time);
.
       if (tm->tm_year != now.tm_year || tm->tm_yday != now.tm_yday)
         break;

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/560925

Title:
  Regression: only session timeout and nologin are checked for timeoutd

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/timeoutd/+bug/560925/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to