From 347e695283db1429168618f8992531d1a359220a Mon Sep 17 00:00:00 2001 From: Sam Hartman Date: Wed, 9 Aug 1995 00:39:05 +0000 Subject: Changes to get telnet working on Alpha git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6471 dc483132-0cff-0310-8789-dd5450dbe970 --- src/util/pty/ChangeLog | 13 +++++++++++-- src/util/pty/cleanup.c | 14 +++++++------- src/util/pty/initialize_slave.c | 5 +++-- src/util/pty/open_slave.c | 23 ++++++++++++++++++++--- src/util/pty/pty_err.et | 2 +- 5 files changed, 42 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/util/pty/ChangeLog b/src/util/pty/ChangeLog index 4a276d3ae..5a4d41fe1 100644 --- a/src/util/pty/ChangeLog +++ b/src/util/pty/ChangeLog @@ -1,9 +1,18 @@ +Tue Aug 8 09:13:50 1995 Sam Hartman + + * open_slave.c (pty_open_slave): Dissociate from controlling + terminal before calling revoke. + (pty_open_slave): Don't ask for a controlling terminal unless we need it. +======= Tue Aug 8 20:32:08 1995 Tom Yu * update_utmp.c: flush preprocessor directive to left margin. + * pty_err.et: Fix typo in error description. + + * cleanup.c (pty_cleanup): Don't change slave before revoking it. Also return a value all the time, not just on systems without revoke. + -Tue Aug 8 17:24:27 EDT 1995 Paul Park (pjpark@mit.edu) - * update_utmp.c - getutmpx() requires address of utmpx structure. + * update_utmp.c (pty_update_utmp): Move #ifdef back to column 1. Mon Aug 7 17:41:39 1995 Sam Hartman diff --git a/src/util/pty/cleanup.c b/src/util/pty/cleanup.c index 50eecc56f..3352fa04e 100644 --- a/src/util/pty/cleanup.c +++ b/src/util/pty/cleanup.c @@ -32,11 +32,6 @@ long pty_cleanup (slave, pid, update_utmp) (void)chmod(slave, 0666); (void)chown(slave, 0, 0); -#ifndef HAVE_STREAMS - slave[strlen("/dev/")] = 'p'; - (void)chmod(slave, 0666); - (void)chown(slave, 0, 0); -#endif #ifdef HAVE_REVOKE revoke(slave); /* @@ -60,7 +55,12 @@ long pty_cleanup (slave, pid, update_utmp) if ( retval = ( pty_open_ctty( slave, &fd ))) return retval; ptyint_vhangup(); - return 0; -#endif +#endif /*VHANG_LAST*/ +#endif /* HAVE_REVOKE*/ +#ifndef HAVE_STREAMS + slave[strlen("/dev/")] = 'p'; + (void)chmod(slave, 0666); + (void)chown(slave, 0, 0); #endif + return 0; } diff --git a/src/util/pty/initialize_slave.c b/src/util/pty/initialize_slave.c index 851b8e5c7..861770407 100644 --- a/src/util/pty/initialize_slave.c +++ b/src/util/pty/initialize_slave.c @@ -38,15 +38,16 @@ long pty_initialize_slave (fd) #endif #ifdef HAVE_STREAMS - while (ioctl (fd, I_POP, 0) == 0); /*Clear out any old lined's*/ #ifdef HAVE_LINE_PUSH + while (ioctl (fd, I_POP, 0) == 0); /*Clear out any old lined's*/ + if (line_push(fd) < 0) { (void) close(fd); fd = -1; return PTY_OPEN_SLAVE_LINE_PUSHFAIL; } #else /*No line_push */ -#ifdef sun +#if 0 /* used to be SUN*/ if (ioctl(fd, I_PUSH, "ptem") < 0) return PTY_OPEN_SLAVE_PUSH_FAIL; if (ioctl(fd, I_PUSH, "ldterm") < 0) diff --git a/src/util/pty/open_slave.c b/src/util/pty/open_slave.c index bcd13779f..37d580d23 100644 --- a/src/util/pty/open_slave.c +++ b/src/util/pty/open_slave.c @@ -21,6 +21,7 @@ #include "libpty.h" #include "pty-int.h" + long pty_open_slave ( slave, fd) const char *slave; int *fd; @@ -36,9 +37,22 @@ long retval; #endif /* First, chmod and chown the slave*/ -if (( retval = pty_open_ctty ( slave, &vfd )) != 0 ) - return retval; - + /* + * If we have vhangup then we really need pty_open_ctty to make sure + * Our controlling terminal is the pty we're opening. However, if we + * are using revoke or nothing then we just need a file descriiptor + * for the pty. Considering some OSes in this category break on + * the second call to open_ctty (currently OSF but others may), + * we simply use a descriptor if we can. + */ +#ifdef VHANG_FIRST + if (( retval = pty_open_ctty ( slave, &vfd )) != 0 ) + return retval; +#else /*VHANG_FIRST*/ + if ( (vfd = open(slave, O_RDWR)) < 0 ) + return errno; +#endif + if (vfd < 0) return PTY_OPEN_SLAVE_OPENFAIL; @@ -61,6 +75,9 @@ return PTY_OPEN_SLAVE_CHMODFAIL; #endif (void) close(vfd); + if ( (retval = ptyint_void_association()) != 0) + return retval; + #ifdef HAVE_REVOKE if (revoke (slave) < 0 ) { return PTY_OPEN_SLAVE_REVOKEFAIL; diff --git a/src/util/pty/pty_err.et b/src/util/pty/pty_err.et index ac99a6df0..fd56d26ac 100644 --- a/src/util/pty/pty_err.et +++ b/src/util/pty/pty_err.et @@ -34,7 +34,7 @@ error_code PTY_OPEN_SLAVE_OPENFAIL, "Failed to open slave side of pty" error_code PTY_OPEN_SLAVE_CHMODFAIL, "Failed to chmod slave side of pty" error_code PTY_OPEN_SLAVE_NOCTTY, "Unable to set controlling terminal" -error_code PTY_OPEN_SLAVE_CHOWNFAIL, "Failed to chown d;slave side of pty" +error_code PTY_OPEN_SLAVE_CHOWNFAIL, "Failed to chown slave side of pty" error_code PTY_OPEN_SLAVE_LINE_PUSHFAIL, "Call to line_push failed to push streams on slave pty" error_code PTY_OPEN_SLAVE_PUSH_FAIL, "Failed to push stream on slave side of pty" -- cgit