From 4428823783d62496b6df8b59251fc5da6841c25c Mon Sep 17 00:00:00 2001 From: Sam Hartman Date: Mon, 7 Aug 1995 23:59:39 +0000 Subject: [PATCH] * Include utmp.h in krlogind.c; libpty.h doesn't any more and it needs them to find size of ut_name. * Use new interface to pty_update_utmp. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6454 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/bsd/ChangeLog | 13 ++++++++++--- src/appl/bsd/krlogind.c | 13 +++++++------ src/appl/bsd/login.c | 8 +++----- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/appl/bsd/ChangeLog b/src/appl/bsd/ChangeLog index 0210206da..a95e13e5b 100644 --- a/src/appl/bsd/ChangeLog +++ b/src/appl/bsd/ChangeLog @@ -1,7 +1,14 @@ +Mon Aug 7 17:32:29 1995 Sam Hartman -Mon Aug 7 11:26:46 EDT 1995 Paul Park (pjpark@mit.edu) - * configure.in - Add checks for utmp[x].h so that the inclusion of - libpty.h does the right thing. + * krlogind.c: Close the write side of the syncpipe in the parent + so we get SIGPIPE if child dies. + + * login.c (main): Use new interface to pty_update_utmp + + * configure.in (LOGINLIBS): Check for utmp.h and utmpx.h. + + * krlogind.c (doit): Use new format for pty_update_utmp + * Include utmp.h because libpty.h no longer does. Fri Aug 4 00:50:41 1995 Tom Yu diff --git a/src/appl/bsd/krlogind.c b/src/appl/bsd/krlogind.c index 4b5f612aa..a4de216ca 100644 --- a/src/appl/bsd/krlogind.c +++ b/src/appl/bsd/krlogind.c @@ -210,6 +210,9 @@ struct winsize { #include "krb5.h" #include #include +#ifdef HAVE_UTMP_H +#include +#endif int auth_sys = 0; /* Which version of Kerberos used to authenticate */ @@ -611,7 +614,7 @@ int syncpipe[2]; struct sgttyb b; #endif /* POSIX_TERMIOS */ if ( retval = pty_open_slave(line, &t)) { - com_err(progname,retval, "while opening slave"); + fatal(f, error_message(retval)); exit(1); } @@ -699,11 +702,8 @@ int syncpipe[2]; #ifndef NO_UT_PID { - struct utmp ent; - ent.ut_pid = getpid(); - ent.ut_type = LOGIN_PROCESS; - pty_update_utmp(&ent, "rlogin", line, ""/*host*/); + pty_update_utmp(PTY_LOGIN_PROCESS, getpid(), "rlogin", line, ""/*host*/); } #endif @@ -727,6 +727,7 @@ int syncpipe[2]; ** The master blocks here until it reads a byte. */ +(void) close(syncpipe[1]); if (read(syncpipe[0], &c, 1) != 1) { /* * Problems read failed ... @@ -735,7 +736,7 @@ int syncpipe[2]; fatalperror(p,buferror); } close(syncpipe[0]); - close(syncpipe[1]); + #if defined(KERBEROS) if (do_encrypt) { diff --git a/src/appl/bsd/login.c b/src/appl/bsd/login.c index dceecc0fb..a1f87b76c 100644 --- a/src/appl/bsd/login.c +++ b/src/appl/bsd/login.c @@ -45,6 +45,8 @@ char copyright[] = * only one of: -r -h -k -K */ +#include + #ifdef HAVE_UNISTD_H #include #endif @@ -782,12 +784,8 @@ bad_login: { struct utmp utmp; -#ifndef NO_UT_PID - utmp.ut_type = USER_PROCESS; - utmp.ut_pid = getppid(); -#endif login_time = time(&utmp.ut_time); - if ( (retval = pty_update_utmp(&utmp, username, ttyn, hostname)) < 0 ) + if ( (retval = pty_update_utmp(PTY_USER_PROCESS, getpid(), username, ttyn, hostname)) < 0 ) com_err (argv[0], retval, "while updating utmp"); } -- 2.26.2