Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Aug 2002 19:45:05 -0700 (PDT)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 16532 for review
Message-ID:  <200208250245.g7P2j5fq059628@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=16532

Change 16532 by peter@peter_mckinley on 2002/08/24 19:44:31

	make this work with 64 bit time_t.
	XXX what is /usr/include/timeconv.h for?

Affected files ...

.. //depot/projects/ia64/lib/libpam/modules/pam_lastlog/pam_lastlog.c#8 edit

Differences ...

==== //depot/projects/ia64/lib/libpam/modules/pam_lastlog/pam_lastlog.c#8 (text+ko) ====

@@ -71,6 +71,7 @@
 	struct passwd *pwd;
 	struct utmp utmp;
 	struct lastlog ll;
+	time_t t;
 	const char *rhost, *user, *tty;
 	off_t llpos;
 	int fd, pam_err;
@@ -109,13 +110,14 @@
 		goto file_err;
 	if ((flags & PAM_SILENT) == 0) {
 		if (read(fd, &ll, sizeof ll) == sizeof ll && ll.ll_time != 0) {
+			t = ll.ll_time;
 			if (*ll.ll_host != '\0')
 				pam_info(pamh, "Last login: %.*s from %.*s",
-				    24 - 5, ctime(&ll.ll_time),
+				    24 - 5, ctime(&t),
 				    (int)sizeof(ll.ll_host), ll.ll_host);
 			else
 				pam_info(pamh, "Last login: %.*s on %.*s",
-				    24 - 5, ctime(&ll.ll_time),
+				    24 - 5, ctime(&t),
 				    (int)sizeof(ll.ll_line), ll.ll_line);
 		}
 		if (lseek(fd, llpos, L_SET) != llpos)
@@ -123,7 +125,8 @@
 	}
 
 	bzero(&ll, sizeof(ll));
-	time(&ll.ll_time);
+	time(&t);
+	ll.ll_time = t;
 
 	/* note: does not need to be NUL-terminated */
 	strncpy(ll.ll_line, tty, sizeof(ll.ll_line));
@@ -140,7 +143,8 @@
 	 * Record session in utmp(5) and wtmp(5).
 	 */
 	bzero(&utmp, sizeof(utmp));
-	time(&utmp.ut_time);
+	time(&t);
+	utmp.ut_time = t;
 	/* note: does not need to be NUL-terminated */
 	strncpy(utmp.ut_name, user, sizeof(utmp.ut_name));
 	if (rhost != NULL)

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208250245.g7P2j5fq059628>