From 17026efc75601e93360ad2748ad715bef1ebecaa Mon Sep 17 00:00:00 2001 From: nekral-guest Date: Fri, 4 Jan 2008 19:59:42 +0000 Subject: [PATCH] I finally reviewed 419_time_structures.dpatch, and it needs to be applied. One chunk was not applied upstream. --- debian/changelog | 2 + debian/patches/419_time_structures.dpatch | 174 +--------------------- debian/patches/series | 3 +- 3 files changed, 11 insertions(+), 168 deletions(-) diff --git a/debian/changelog b/debian/changelog index b0a9c8fb..efb45a4e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -32,6 +32,8 @@ shadow (1:4.1.0-1) UNRELEASED; urgency=low -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 from CFLAGS. - 479_chowntty_debug was debian specific. Renamed to 579_chowntty_debug + - Reapply 419_time_structures.dpatch. Remove teh parts which are already + fixed upstream (not necessarily the same way). -- Nicolas FRANCOIS (Nekral) Sat, 17 Nov 2007 18:33:26 +0100 diff --git a/debian/patches/419_time_structures.dpatch b/debian/patches/419_time_structures.dpatch index 23baab27..7182286e 100755 --- a/debian/patches/419_time_structures.dpatch +++ b/debian/patches/419_time_structures.dpatch @@ -11,136 +11,17 @@ ## DP: ## DP: Some parts of this patch have been applied upstream. The other parts ## DP: should be checked. +## DP: +## DP: With the Glibc, with __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32, +## DP: ut_time (i.e. ut_tv.tv_sec) is not a time_t but an int32 (ditto for +## DP: ll_time) @DPATCH@ -Index: shadow-4.0.3/libmisc/log.c +Index: shadow-4.1.0/src/login.c =================================================================== ---- shadow-4.0.3.orig/libmisc/log.c 1998-04-16 21:57:44.000000000 +0200 -+++ shadow-4.0.3/libmisc/log.c 2005-05-12 14:05:29.976542831 +0200 -@@ -88,7 +88,7 @@ dolastlog(struct lastlog *ll, const stru - if (ll) - *ll = newlog; - -- time(&newlog.ll_time); -+ newlog.ll_time = time(0); - strncpy(newlog.ll_line, line, sizeof newlog.ll_line); - #if HAVE_LL_HOST - strncpy(newlog.ll_host, host, sizeof newlog.ll_host); -Index: shadow-4.0.3/libmisc/utmp.c -=================================================================== ---- shadow-4.0.3.orig/libmisc/utmp.c 2002-03-08 05:30:30.000000000 +0100 -+++ shadow-4.0.3/libmisc/utmp.c 2005-05-12 14:05:29.994540142 +0200 -@@ -111,7 +111,7 @@ checkutmp(int picky) - /* XXX - assumes /dev/tty?? */ - strncpy(utent.ut_id, utent.ut_line + 3, sizeof utent.ut_id); - strcpy(utent.ut_user, "LOGIN"); -- time(&utent.ut_time); -+ utent.ut_time = time(0); - } - } - -@@ -195,7 +195,7 @@ checkutmp(int picky) - strcpy(utent.ut_user, "LOGIN"); - utent.ut_pid = getpid(); - utent.ut_type = LOGIN_PROCESS; -- time(&utent.ut_time); -+ utent.ut_time = time(0); - #if HAVE_UTMPX_H - strncpy(utxent.ut_line, line, sizeof utxent.ut_line); - if ((utx = getutxline(&utxent))) -@@ -204,7 +204,15 @@ checkutmp(int picky) - strcpy(utxent.ut_user, "LOGIN"); - utxent.ut_pid = utent.ut_pid; - utxent.ut_type = utent.ut_type; -- gettimeofday((struct timeval *) &utxent.ut_tv, NULL); -+ /* don't assume that utmpx.ut_tv is a struct timeval */ -+ { -+ struct timeval tv; -+ -+ gettimeofday(&tv, NULL); -+ -+ utxent.ut_tv.tv_sec = tv.tv_sec; -+ utxent.ut_tv.tv_usec = tv.tv_usec; -+ } - utent.ut_time = utxent.ut_tv.tv_sec; - #endif - } -@@ -230,7 +238,7 @@ checkutmp(int picky) - line += 5; - - (void) strncpy (utent.ut_line, line, sizeof utent.ut_line); -- (void) time (&utent.ut_time); -+ utent.ut_time = time(0); - } - - #endif /* !USG */ -@@ -286,7 +294,7 @@ setutmp(const char *name, const char *li - { - utent.ut_type = USER_PROCESS; - strncpy(utent.ut_user, name, sizeof utent.ut_user); -- time(&utent.ut_time); -+ utent.ut_time = time(0); - /* other fields already filled in by checkutmp above */ - setutent(); - pututline(&utent); -@@ -375,7 +383,14 @@ setutmp(const char *name, const char *li - - utline.ut_type = utxline.ut_type = USER_PROCESS; - -- gettimeofday(&utxline.ut_tv, NULL); -+ /* don't assume that utmpx.ut_tv is a struct timeval */ -+ { -+ struct timeval tv; -+ -+ gettimeofday(&tv, NULL); -+ utxline.ut_tv.tv_sec = tv.tv_sec; -+ utxline.ut_tv.tv_usec = tv.tv_usec; -+ } - utline.ut_time = utxline.ut_tv.tv_sec; - - strncpy(utxline.ut_host, host ? host : "", sizeof utxline.ut_host); -@@ -435,7 +450,7 @@ setutmp(const char *name, const char *li - * Put in the current time (common to everyone) - */ - -- (void) time (&utmp.ut_time); -+ utmp.ut_time = time(0); - - #ifdef UT_HOST - /* -Index: shadow-4.0.3/src/lastlog.c -=================================================================== ---- shadow-4.0.3.orig/src/lastlog.c 2005-05-12 14:05:24.511359400 +0200 -+++ shadow-4.0.3/src/lastlog.c 2005-05-12 14:05:29.994540142 +0200 -@@ -184,7 +184,13 @@ static void print_one (const struct pass - #endif - once++; - } -- tm = localtime (&lastlog.ll_time); -+ /* don't assume lastlog.ll_time is a time_t */ -+ { -+ time_t when; -+ -+ when = lastlog.ll_time; -+ tm = localtime (&when); -+ } - #ifdef HAVE_STRFTIME - strftime (ptime, sizeof (ptime), "%a %b %e %H:%M:%S %z %Y", tm); - cp = ptime; -@@ -193,7 +199,7 @@ static void print_one (const struct pass - cp[24] = '\0'; - #endif - -- if (lastlog.ll_time == (time_t) 0) -+ if (lastlog.ll_time == 0) - cp = _("**Never logged in**\0"); - - #ifdef HAVE_LL_HOST -Index: shadow-4.0.3/src/login.c -=================================================================== ---- shadow-4.0.3.orig/src/login.c 2005-05-12 14:04:27.490878998 +0200 -+++ shadow-4.0.3/src/login.c 2005-05-12 14:05:29.995539993 +0200 -@@ -849,10 +849,18 @@ int main (int argc, char **argv) +--- shadow-4.1.0.orig/src/login.c 2008-01-03 23:00:48.872001845 +0100 ++++ shadow-4.1.0/src/login.c 2008-01-03 23:15:56.012001027 +0100 +@@ -736,10 +736,18 @@ if (getdef_str("FTMP_FILE") != NULL) { #if HAVE_UTMPX_H failent = utxent; @@ -161,42 +42,3 @@ Index: shadow-4.0.3/src/login.c #endif strncpy(failent.ut_user, failent_user, sizeof(failent.ut_user)); #ifdef USER_PROCESS -@@ -1093,10 +1101,17 @@ int main (int argc, char **argv) - - #if HAVE_UTMPX_H - failent = utxent; -- gettimeofday (&(failent.ut_tv), NULL); -+ /* don't assume that utmpx.ut_tv is a struct timeval */ -+ { -+ struct timeval tv; -+ -+ gettimeofday(&tv, NULL); -+ failent.ut_tv.tv_sec = tv.tv_sec; -+ failent.ut_tv.tv_usec = tv.tv_usec; -+ } - #else - failent = utent; -- time (&failent.ut_time); -+ failent.ut_time = time(0); - #endif - if (pwd) { - failent_user = pwent.pw_name; -@@ -1378,15 +1393,16 @@ int main (int argc, char **argv) - } - if (getdef_bool ("LASTLOG_ENAB") - && lastlog.ll_time != 0) { -+ time_t when = lastlog.ll_time; /* may not be a time_t */ - #ifdef HAVE_STRFTIME - strftime (ptime, sizeof (ptime), - "%a %b %e %H:%M:%S %z %Y", -- localtime (&lastlog.ll_time)); -+ localtime (&when)); - printf (_("Last login: %s on %s"), - ptime, lastlog.ll_line); - #else - printf (_("Last login: %.19s on %s"), -- ctime (&lastlog.ll_time), -+ ctime (&when), - lastlog.ll_line); - #endif - #ifdef HAVE_LL_HOST /* SVR4 || __linux__ || SUN4 */ diff --git a/debian/patches/series b/debian/patches/series index 3e376b86..4ea29e94 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -6,8 +6,7 @@ 434_login_stop_checking_args_after-- 008_login_log_failure_in_FTMP 429_login_FAILLOG_ENAB -# -# 419_time_structures.dpatch # must be checked another time +419_time_structures.dpatch 401_cppw_src.dpatch 504_undef_USE_PAM.dpatch 504_undef_USE_PAM.nolibpam