|
|
93a2f57 |
|
|
|
93a2f57 |
On 64-bit platforms such as x86_64, glibc is usally built with 32-bit
|
|
|
93a2f57 |
compatibilty for various structures. One of them is utmp.
|
|
|
93a2f57 |
|
|
|
93a2f57 |
What this means is that gettimeofday(&ut.ut_tv, NULL) on x86_64 will
|
|
|
93a2f57 |
end up overwriting the first parts of ut_addr_v6, leading to garbage
|
|
|
93a2f57 |
in the utmp file.
|
|
|
93a2f57 |
|
|
|
93a2f57 |
|
|
|
93a2f57 |
--- util-linux-2.13-pre6/login-utils/login.c.kzak 2006-08-10 11:38:33.000000000 +0200
|
|
|
93a2f57 |
+++ util-linux-2.13-pre6/login-utils/login.c 2006-08-10 11:38:49.000000000 +0200
|
|
|
93a2f57 |
@@ -257,6 +257,7 @@
|
|
|
93a2f57 |
static void
|
|
|
93a2f57 |
logbtmp(const char *line, const char *username, const char *hostname) {
|
|
|
93a2f57 |
struct utmp ut;
|
|
|
93a2f57 |
+ struct timeval tv;
|
|
|
93a2f57 |
|
|
|
93a2f57 |
memset(&ut, 0, sizeof(ut));
|
|
|
93a2f57 |
|
|
|
93a2f57 |
@@ -267,7 +268,9 @@
|
|
|
93a2f57 |
xstrncpy(ut.ut_line, line, sizeof(ut.ut_line));
|
|
|
93a2f57 |
|
|
|
93a2f57 |
#if defined(_HAVE_UT_TV) /* in <utmpbits.h> included by <utmp.h> */
|
|
|
93a2f57 |
- gettimeofday(&ut.ut_tv, NULL);
|
|
|
93a2f57 |
+ gettimeofday(&tv, NULL);
|
|
|
93a2f57 |
+ ut.ut_tv.tv_sec = tv.tv_sec;
|
|
|
93a2f57 |
+ ut.ut_tv.tv_usec = tv.tv_usec;
|
|
|
93a2f57 |
#else
|
|
|
93a2f57 |
{
|
|
|
93a2f57 |
time_t t;
|
|
|
93a2f57 |
@@ -872,6 +875,7 @@
|
|
|
93a2f57 |
{
|
|
|
93a2f57 |
struct utmp ut;
|
|
|
93a2f57 |
struct utmp *utp;
|
|
|
93a2f57 |
+ struct timeval tv;
|
|
|
93a2f57 |
|
|
|
93a2f57 |
utmpname(_PATH_UTMP);
|
|
|
93a2f57 |
setutent();
|
|
|
93a2f57 |
@@ -911,7 +915,9 @@
|
|
|
93a2f57 |
strncpy(ut.ut_user, username, sizeof(ut.ut_user));
|
|
|
93a2f57 |
xstrncpy(ut.ut_line, tty_name, sizeof(ut.ut_line));
|
|
|
93a2f57 |
#ifdef _HAVE_UT_TV /* in <utmpbits.h> included by <utmp.h> */
|
|
|
93a2f57 |
- gettimeofday(&ut.ut_tv, NULL);
|
|
|
93a2f57 |
+ gettimeofday(&tv, NULL);
|
|
|
93a2f57 |
+ ut.ut_tv.tv_sec = tv.tv_sec;
|
|
|
93a2f57 |
+ ut.ut_tv.tv_usec = tv.tv_usec;
|
|
|
93a2f57 |
#else
|
|
|
93a2f57 |
{
|
|
|
93a2f57 |
time_t t;
|