[PATCH] make pam use correct lastlog time value on X86-64
problem (see also patch for login posted earlier):
For X86-64, utmp and utmpx contain 32 bit fields to make it compatible with
what a 32-bit application expects.
This leads to the problem, that in lastlog, utmp and utmpx there are fields
for time and timeval that have a different data size than the original time_t
and struct timeval types.
In pam, the pam_lastlog module is affected by this difference.
solution:
This patch changes pam_lastlog.c simply by copying 32 bit data into the 64 bit
data type.
The patch is against 0.76-15
Sam,
can you please include this patch in your next packages?
amd64-list:
libpam-modules_0.76-15.0.1_amd64.deb
(only package affected by patch) is available under:
http://home.arcor.de/hfvogt/debian/
--
--
Hans-Frieder Vogt e-mail: hfvogt@arcor.de
--- pam-0.76.orig/Linux-PAM/modules/pam_lastlog/pam_lastlog.c 2002-09-15 22:08:49.000000000 +0200
+++ pam-0.76/Linux-PAM/modules/pam_lastlog/pam_lastlog.c 2004-03-14 10:37:49.480542704 +0100
@@ -256,8 +256,14 @@
if (last_login.ll_time) {
char *the_time;
char *remark;
+#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
+ time_t t;
+ t = last_login.ll_time;
+ the_time = ctime(&t);
+#else
the_time = ctime(&last_login.ll_time);
+#endif
the_time[-1+strlen(the_time)] = '\0'; /* delete '\n' */
remark = malloc(LASTLOG_MAXSIZE);
@@ -321,11 +327,19 @@
{
const char *remote_host=NULL
, *terminal_line=DEFAULT_TERM;
+#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
+ time_t t;
+#endif
/* set this login date */
D(("set the most recent login time"));
+#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
+ (void) time(&t); /* set the time */
+ last_login.ll_time = t;
+#else
(void) time(&last_login.ll_time); /* set the time */
+#endif
/* set the remote host */
(void) pam_get_item(pamh, PAM_RHOST, (const void **)&remote_host);
Reply to: