[Pkg-shadow-commits] sid/debian/patches 319_time_structures.dpatch,NONE,1.1 006_libmisc.dpatch,1.1,1.2 008_src.dpatch,1.6,1.7 00list,1.3,1.4

Nicolas FRAN??OIS pkg-shadow-devel@lists.alioth.debian.org
Sun, 17 Apr 2005 09:22:37 +0000


Update of /cvsroot/pkg-shadow/sid/debian/patches
In directory haydn:/tmp/cvs-serv2941/patches

Modified Files:
	006_libmisc.dpatch 008_src.dpatch 00list 
Added Files:
	319_time_structures.dpatch 
Log Message:
Pick some parts from 006_libmisc and 008_src to create the patch which fix
the time structures usage (319_time_structures).
It is at least partially applied upstream.


Index: 00list
===================================================================
RCS file: /cvsroot/pkg-shadow/sid/debian/patches/00list,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- 00list	16 Apr 2005 23:23:31 -0000	1.3
+++ 00list	17 Apr 2005 09:22:35 -0000	1.4
@@ -52,6 +52,7 @@
 #316_vipw-race-242407
 #317_lastlog_usage_249611
 318_passwd_src_warning
+319_time_structures
 401_cppw_src
 #402_missing_debian_man_pages
 403_sg_symlink_162339_163652

Index: 006_libmisc.dpatch
===================================================================
RCS file: /cvsroot/pkg-shadow/sid/debian/patches/006_libmisc.dpatch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- 006_libmisc.dpatch	20 Mar 2005 14:48:28 -0000	1.1
+++ 006_libmisc.dpatch	17 Apr 2005 09:22:35 -0000	1.2
@@ -2590,18 +2590,6 @@
  #endif /* defined (TEST) */
 +
 +
-diff -Nru shadow-4.0.3/libmisc/log.c shadow-4.0.3_30.4/libmisc/log.c
---- shadow-4.0.3/libmisc/log.c	1998-04-16 21:57:44.000000000 +0200
-+++ shadow-4.0.3_30.4/libmisc/log.c	2004-11-02 22:17:35.000000000 +0100
-@@ -88,7 +88,7 @@
- 	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);
 diff -Nru shadow-4.0.3/libmisc/Makefile.in shadow-4.0.3_30.4/libmisc/Makefile.in
 --- shadow-4.0.3/libmisc/Makefile.in	2002-03-13 20:04:01.000000000 +0100
 +++ shadow-4.0.3_30.4/libmisc/Makefile.in	2004-11-26 07:27:29.000000000 +0100
@@ -3344,87 +3332,6 @@
 +	if (*pw->pw_shell == '*')
 +		pw->pw_shell++;
  }
-diff -Nru shadow-4.0.3/libmisc/utmp.c shadow-4.0.3_30.4/libmisc/utmp.c
---- shadow-4.0.3/libmisc/utmp.c	2002-03-08 05:30:30.000000000 +0100
-+++ shadow-4.0.3_30.4/libmisc/utmp.c	2004-11-02 22:17:35.000000000 +0100
-@@ -111,7 +111,7 @@
- 		/* 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 @@
- 		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 @@
- 		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 @@
- 		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 @@
- {
- 	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 @@
- 
- 	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 @@
- 	 * Put in the current time (common to everyone)
- 	 */
- 
--	(void) time (&utmp.ut_time);
-+	utmp.ut_time = time(0);
- 
- #ifdef UT_HOST
- 	/*
 diff -Nru shadow-4.0.3/libmisc/xmalloc.c shadow-4.0.3_30.4/libmisc/xmalloc.c
 --- shadow-4.0.3/libmisc/xmalloc.c	1998-12-28 21:34:56.000000000 +0100
 +++ shadow-4.0.3_30.4/libmisc/xmalloc.c	2004-11-02 22:17:35.000000000 +0100

Index: 008_src.dpatch
===================================================================
RCS file: /cvsroot/pkg-shadow/sid/debian/patches/008_src.dpatch,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- 008_src.dpatch	16 Apr 2005 23:23:31 -0000	1.6
+++ 008_src.dpatch	17 Apr 2005 09:22:35 -0000	1.7
@@ -70,33 +70,6 @@
  
  			/*
  			 * All group file deletions wind up here. This code
-diff -Nru shadow-4.0.3/src/lastlog.c shadow-4.0.3_30.4/src/lastlog.c
---- shadow-4.0.3/src/lastlog.c	2002-01-05 16:41:43.000000000 +0100
-+++ shadow-4.0.3_30.4/src/lastlog.c	2004-11-02 22:17:38.000000000 +0100
-@@ -184,7 +184,13 @@
- #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 @@
- 	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
 diff -Nru shadow-4.0.3/src/login.c shadow-4.0.3_30.4/src/login.c
 --- shadow-4.0.3/src/login.c	2002-03-08 05:30:28.000000000 +0100
 +++ shadow-4.0.3_30.4/src/login.c	2004-11-02 22:17:38.000000000 +0100
@@ -158,7 +131,7 @@
  				usage ();
  
  #ifdef SVR4
-@@ -763,49 +775,106 @@
+@@ -763,49 +775,98 @@
  			 * MAX_LOGIN_TRIES?
  			 */
  
@@ -275,18 +248,10 @@
 +			  if (getdef_str("FTMP_FILE") != NULL) {
 +#if HAVE_UTMPX_H
 +			    failent = utxent;
-+			    /* 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;
-+			    }
++			    gettimeofday(&(failent.ut_tv), NULL);
 +#else
 +			    failent = utent;
-+			    failent.ut_time = time(0);
++			    time(&failent.ut_time);
 +#endif
 +			    strncpy(failent.ut_user, failent_user, sizeof(failent.ut_user));
 +#ifdef USER_PROCESS
@@ -304,7 +269,7 @@
  			retcode = pam_acct_mgmt (pamh, 0);
  
  			if (retcode == PAM_NEW_AUTHTOK_REQD) {
-@@ -828,11 +897,14 @@
+@@ -828,11 +889,14 @@
  
  		if (!pwd || setup_groups (pwd))
  			exit (1);
@@ -320,7 +285,7 @@
  		PAM_FAIL_CHECK;
  
  #else				/* ! USE_PAM */
-@@ -1002,6 +1074,7 @@
+@@ -1002,6 +1066,7 @@
  			failed = 1;
  		}
  #endif
@@ -328,7 +293,7 @@
  		if (pwd && getdef_bool ("FAILLOG_ENAB") &&
  		    !failcheck (pwent.pw_uid, &faillog, failed)) {
  			SYSLOG ((LOG_CRIT, 
-@@ -1009,21 +1082,31 @@
+@@ -1009,12 +1074,15 @@
  				 username, fromhost));
  			failed = 1;
  		}
@@ -344,25 +309,7 @@
  		if (getdef_str ("FTMP_FILE") != NULL) {
  			const char *failent_user;
  
- #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;
-@@ -1208,6 +1291,40 @@
+@@ -1208,6 +1276,40 @@
  	login_fbtab (tty, pwent.pw_uid, pwent.pw_gid);
  #endif
  
@@ -403,26 +350,7 @@
  	/* We call set_groups() above because this clobbers pam_groups.so */
  #ifndef USE_PAM
  	if (setup_uid_gid (&pwent, is_console))
-@@ -1271,15 +1388,16 @@
- 		}
- 		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 */
-@@ -1309,41 +1427,6 @@
+@@ -1309,41 +1410,6 @@
  	signal (SIGTERM, SIG_DFL);	/* default terminate signal */
  	signal (SIGALRM, SIG_DFL);	/* default alarm signal */
  	signal (SIGHUP, SIG_DFL);	/* added this.  --marekm */

--- NEW FILE: 319_time_structures.dpatch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 319_time_structures.dpatch by Nicolas FRANCOIS <nicolas.francois@centraliens.net>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: I didn't find a related bug in the BTS.
## DP: It must be related to the 1:4.0.3-22 changelog:
## DP:   Don't assume that lastlog.ll_time or utmp.ut_time or utmpx.ut_tv are
## DP:   made up of time_ts and timevals, because they aren't on x86-64.
## DP:   Dismaying but true.
## DP:   -- Karl Ramm <kcr@debian.org>  Sun, 14 Mar 2004
## DP: 
## DP: Some parts of this patch have been applied upstream. The other parts
## DP: should be checked.

@DPATCH@
diff -rNau shadow-4.0.3/libmisc/log.c /tmp/shadow-4.0.3/libmisc/log.c
--- shadow-4.0.3/libmisc/log.c	1998-04-16 21:57:44.000000000 +0200
+++ /tmp/shadow-4.0.3/libmisc/log.c	2005-04-17 10:20:39.000000000 +0200
@@ -88,7 +88,7 @@
 	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);
diff -rNau shadow-4.0.3/libmisc/utmp.c /tmp/shadow-4.0.3/libmisc/utmp.c
--- shadow-4.0.3/libmisc/utmp.c	2002-03-08 05:30:30.000000000 +0100
+++ /tmp/shadow-4.0.3/libmisc/utmp.c	2005-04-17 10:20:39.000000000 +0200
@@ -111,7 +111,7 @@
 		/* 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 @@
 		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 @@
 		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 @@
 		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 @@
 {
 	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 @@
 
 	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 @@
 	 * Put in the current time (common to everyone)
 	 */
 
-	(void) time (&utmp.ut_time);
+	utmp.ut_time = time(0);
 
 #ifdef UT_HOST
 	/*
diff -rNau shadow-4.0.3/src/lastlog.c /tmp/shadow-4.0.3/src/lastlog.c
--- shadow-4.0.3/src/lastlog.c	2002-01-05 16:41:43.000000000 +0100
+++ /tmp/shadow-4.0.3/src/lastlog.c	2005-04-17 10:20:39.000000000 +0200
@@ -184,7 +184,13 @@
 #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 @@
 	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
diff -rNau shadow-4.0.3/src/login.c /tmp/shadow-4.0.3/src/login.c
--- shadow-4.0.3/src/login.c	2005-04-17 10:20:24.000000000 +0200
+++ /tmp/shadow-4.0.3/src/login.c	2005-04-17 10:20:39.000000000 +0200
@@ -849,10 +849,18 @@
 			  if (getdef_str("FTMP_FILE") != NULL) {
 #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
 			    strncpy(failent.ut_user, failent_user, sizeof(failent.ut_user));
 #ifdef USER_PROCESS
@@ -1088,10 +1096,17 @@
 
 #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;
@@ -1373,15 +1388,16 @@
 		}
 		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 */