summaryrefslogtreecommitdiffstats
path: root/src/util/pty/update_wtmp.c
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>1996-04-17 02:11:22 +0000
committerKen Raeburn <raeburn@mit.edu>1996-04-17 02:11:22 +0000
commit703bcf4fcbde6c736551c61ce97287b264d0b1de (patch)
treeb8cb0eef9818f08e2d4da9fedac1c557cd4d3700 /src/util/pty/update_wtmp.c
parent1da7e425e03659a281674d7716a37754543f0634 (diff)
downloadkrb5-703bcf4fcbde6c736551c61ce97287b264d0b1de.tar.gz
krb5-703bcf4fcbde6c736551c61ce97287b264d0b1de.tar.xz
krb5-703bcf4fcbde6c736551c61ce97287b264d0b1de.zip
* dump-utmp.c: New file. Not automatically used by anything, but may be useful
for examining utmp/wtmp files when comparing behavior against system software. * update_utmp.c (pty_update_utmp): Always use id "cons" for console. For HP-UX, omit "kl" prefix. Reindent for readability. * update_wtmp.c (ptyint_update_wtmp): For HP-UX, copy ut_id and ut_type from input utmp structure. Reindent for readability. Wed Mar 27 21:14:33 1996 Marc Horowitz <marc@mit.edu> * init_slave.c (pty_initialize_slave): Spurious signal stuff which did nothing deleted. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7819 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/util/pty/update_wtmp.c')
-rw-r--r--src/util/pty/update_wtmp.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/util/pty/update_wtmp.c b/src/util/pty/update_wtmp.c
index 0bda4dbac..8017b1100 100644
--- a/src/util/pty/update_wtmp.c
+++ b/src/util/pty/update_wtmp.c
@@ -34,9 +34,9 @@
long ptyint_update_wtmp (ent , host, user)
struct utmp *ent;
- char *host;
-char *user;
- {
+ char *host;
+ char *user;
+{
struct utmp ut;
struct stat statb;
int fd;
@@ -44,11 +44,12 @@ char *user;
struct utmpx utx;
getutmpx(ent, &utx);
-if (host)
- strncpy(utx.ut_host, host, sizeof(utx.ut_host) );
-else utx.ut_host[0] = 0;
-if (user)
- strncpy(utx.ut_user, user, sizeof(utx.ut_user));
+ if (host)
+ strncpy(utx.ut_host, host, sizeof(utx.ut_host) );
+ else
+ utx.ut_host[0] = 0;
+ if (user)
+ strncpy(utx.ut_user, user, sizeof(utx.ut_user));
updwtmpx(WTMPX_FILE, &utx);
#endif
@@ -62,6 +63,9 @@ if (user)
if ((fd = open(WTMP_FILE, O_WRONLY|O_APPEND, 0)) >= 0) {
if (!fstat(fd, &statb)) {
(void)memset((char *)&ut, 0, sizeof(ut));
+#ifdef __hpux
+ strncpy (ut.ut_id, ent->ut_id, sizeof (ut.ut_id));
+#endif
(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
@@ -72,7 +76,11 @@ if (user)
if (ent->ut_name) {
if (!ut.ut_pid)
ut.ut_pid = getpid();
+#ifndef __hpux
ut.ut_type = USER_PROCESS;
+#else
+ ut.ut_type = ent->ut_type;
+#endif
} else {
#ifdef EMPTY
ut.ut_type = EMPTY;