- merge in another hunk that we reported along with what was already in

here
This commit is contained in:
Nalin Dahyabhai 2009-06-26 21:42:13 +00:00
parent 7d63382d8d
commit 6e77eee565

View File

@ -1,9 +1,52 @@
This apparently-vestigial code could corrupt the stack. Handle ut_tv not always being a struct timeval. RT#TBD
diff -up krb5-1.7/src/appl/bsd/login.c krb5-1.7/src/appl/bsd/login.c Index: krb5/src/appl/libpty/update_utmp.c
--- krb5-1.7/src/appl/bsd/login.c 2009-06-02 17:53:45.000000000 -0400 ===================================================================
+++ krb5-1.7/src/appl/bsd/login.c 2009-06-02 17:53:47.000000000 -0400 --- krb5/src/appl/libpty/update_utmp.c (revision 22423)
@@ -724,7 +724,6 @@ int main(argc, argv) +++ krb5/src/appl/libpty/update_utmp.c (working copy)
@@ -291,6 +291,12 @@
* The ut_exit field seems to exist in utmp, but not utmpx. The files
* utmp and wtmp seem to exist, but not utmpx, or wtmpx.
*
+ * glibc:
+ *
+ * The ut_tv field of struct utmp/utmpx may be an anonymous structure
+ * containing 32-bit values on systems where time_t is 64 bits. Its
+ * fields have the same names, though.
+ *
* libpty Implementation Decisions:
* --------------------------------
*
@@ -505,6 +511,8 @@
const char *line, const char *host, int flags)
{
PTY_STRUCT_UTMPX utx, *utxtmp, utx2;
+ struct timeval ut_tv;
+ time_t login_time;
const char *cp;
size_t len;
char utmp_id[5];
@@ -577,10 +585,13 @@
utxtmp = best_utxent(&utx);
#ifdef HAVE_SETUTXENT
- if (gettimeofday(&utx.ut_tv, NULL))
+ if (gettimeofday(&ut_tv, NULL))
return errno;
+ utx.ut_tv.tv_sec = ut_tv.tv_sec;
+ utx.ut_tv.tv_usec = ut_tv.tv_usec;
#else
- (void)time(&utx.ut_time);
+ (void)time(&login_time);
+ utx.ut_time = login_time;
#endif
/*
* On what system is there not ut_host? Unix98 doesn't mandate
Index: krb5/src/appl/bsd/login.c
===================================================================
--- krb5/src/appl/bsd/login.c (revision 22423)
+++ krb5/src/appl/bsd/login.c (working copy)
@@ -719,7 +719,6 @@
char *domain, **envinit, *ttyn, *tty; char *domain, **envinit, *ttyn, *tty;
char tbuf[MAXPATHLEN + 2]; char tbuf[MAXPATHLEN + 2];
char *ttyname(), *crypt(), *getpass(); char *ttyname(), *crypt(), *getpass();
@ -11,7 +54,7 @@ diff -up krb5-1.7/src/appl/bsd/login.c krb5-1.7/src/appl/bsd/login.c
int retval; int retval;
int rewrite_ccache = 1; /*try to write out ccache*/ int rewrite_ccache = 1; /*try to write out ccache*/
#ifdef KRB5_GET_TICKETS #ifdef KRB5_GET_TICKETS
@@ -1124,9 +1123,6 @@ int main(argc, argv) @@ -1071,9 +1070,6 @@
/* nothing else left to fail -- really log in */ /* nothing else left to fail -- really log in */
{ {