summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMark Eichin <eichin@mit.edu>1995-03-24 01:28:24 +0000
committerMark Eichin <eichin@mit.edu>1995-03-24 01:28:24 +0000
commit337f6ec174e59ad7a6f221ad789f38c8aca08cc0 (patch)
treef8fb51284865ccd01a0f80e7c644e6c44db1cec4 /src
parent6fde91238272451862148b5107cbf01898086525 (diff)
downloadkrb5-337f6ec174e59ad7a6f221ad789f38c8aca08cc0.tar.gz
krb5-337f6ec174e59ad7a6f221ad789f38c8aca08cc0.tar.xz
krb5-337f6ec174e59ad7a6f221ad789f38c8aca08cc0.zip
* logutil.c (update_wtmp): initialize ut from ent the way the V4
code did. Appears to handle SunOS case (when nearly all of the ifdef's are off) correctly now. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5207 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r--src/appl/bsd/ChangeLog6
-rw-r--r--src/appl/bsd/logutil.c16
2 files changed, 22 insertions, 0 deletions
diff --git a/src/appl/bsd/ChangeLog b/src/appl/bsd/ChangeLog
index a4d3899cb..9f38f19bf 100644
--- a/src/appl/bsd/ChangeLog
+++ b/src/appl/bsd/ChangeLog
@@ -1,3 +1,9 @@
+Thu Mar 23 20:22:57 1995 Mark Eichin <eichin@cygnus.com>
+
+ * logutil.c (update_wtmp): initialize ut from ent the way the V4
+ code did. Appears to handle SunOS case (when nearly all of the
+ ifdef's are off) correctly now.
+
Tue Mar 14 16:08:08 1995 <tytso@rsx-11.mit.edu>
* Makefile.in, configure.in: Use the libdes425 library so that the
diff --git a/src/appl/bsd/logutil.c b/src/appl/bsd/logutil.c
index 1f22083f2..70dd6588d 100644
--- a/src/appl/bsd/logutil.c
+++ b/src/appl/bsd/logutil.c
@@ -164,6 +164,22 @@ void update_wtmp(ent)
if ((fd = open(WTMP_FILE, O_WRONLY|O_APPEND, 0)) >= 0) {
if (!fstat(fd, &statb)) {
+ (void)memset((char *)&ut, 0, sizeof(ut));
+ (void)strncpy(ut.ut_line, ent->ut_line, sizeof(ut.ut_line));
+ (void)strncpy(ut.ut_name, ent->ut_name, sizeof(ut.ut_name));
+#ifndef NO_UT_HOST
+ (void)strncpy(ut.ut_host, ent->ut_host, sizeof(ut.ut_host));
+#endif
+ (void)time(&ut.ut_time);
+#ifdef HAVE_GETUTENT
+ if (*name) {
+ if (!ut.ut_pid)
+ ut.ut_pid = getpid();
+ ut.ut_type = USER_PROCESS;
+ } else {
+ ut.ut_type = EMPTY;
+ }
+#endif
if (write(fd, (char *)&ut, sizeof(struct utmp)) !=
sizeof(struct utmp))
(void)ftruncate(fd, statb.st_size);