From bd33f7e0f21f90956c686d1a0d7d4cee1afad7bd Mon Sep 17 00:00:00 2001 From: Sam Hartman Date: Sun, 24 Mar 1996 20:31:55 +0000 Subject: [PATCH] Implement _getpty handling for the SGI git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7707 dc483132-0cff-0310-8789-dd5450dbe970 --- src/util/pty/ChangeLog | 12 ++++++++++++ src/util/pty/configure.in | 20 ++------------------ src/util/pty/getpty.c | 33 ++++++++++++++++++++++++++++----- src/util/pty/pty-int.h | 1 - 4 files changed, 42 insertions(+), 24 deletions(-) diff --git a/src/util/pty/ChangeLog b/src/util/pty/ChangeLog index 78e8c8f6d..fb88e790b 100644 --- a/src/util/pty/ChangeLog +++ b/src/util/pty/ChangeLog @@ -1,3 +1,15 @@ +Sat Mar 23 15:24:38 1996 Sam Hartman + + * configure.in : Remove shadow passwords check because nothing in + libpty cares about the result; remove use of libkrb5, libkrb4, + libkadm; Check for _getpty + + * getpty.c (pty_getpty): Support _getpty for Irix; Irix has + /dev/ptmx, but it doesn't work correctly at all. Also, Irix, + tends to create device nodes on the fly. + + * pty-int.h: No need to include sys/socket.h + Sat Feb 24 21:34:58 1996 Theodore Y. Ts'o * vhangup.c (ptyint_vhangup): Don't do call vhangup() if system diff --git a/src/util/pty/configure.in b/src/util/pty/configure.in index 32fae2552..3d5a649aa 100644 --- a/src/util/pty/configure.in +++ b/src/util/pty/configure.in @@ -6,8 +6,8 @@ LinkFileDir([$](TOPLIBD)/libpty.a,libpty.a,../util/pty) AC_PROG_INSTALL AC_PROG_ARCHIVE AC_PROG_RANLIB -AC_CHECK_FUNCS(fchmod fchown revoke vhangup killpg) -dnl dbm libs for use of an_to_ln +AC_CHECK_FUNCS(fchmod fchown revoke vhangup killpg _getpty) +dnl LOGINLIBS= dnl dnl Make our operating system-specific security checks and definitions for @@ -125,25 +125,9 @@ AC_DEFINE(SETPGRP_TWOARG) fi dnl dnl -AC_MSG_CHECKING([shadow password support]) -AC_CACHE_VAL(krb5_cv_shadow_pwd, -[AC_TRY_LINK( -[#include -#include -#include ], -[struct spwd *sp = getspnam("root")], -krb5_cv_shadow_pwd=yes, krb5_cv_shadow_pwd=no)]) -AC_MSG_RESULT($krb5_cv_shadow_pwd) -if test $krb5_cv_shadow_pwd = yes; then -AC_DEFINE(HAVE_SHADOW) -fi -dnl dnl ADD_DEF(-DKERBEROS) AC_CONST -USE_KADM_LIBRARY -USE_KRB4_LIBRARY -KRB5_LIBRARIES V5_USE_SHARED_LIB SubdirLibraryRule([$(LIBOBJS)]) V5_AC_OUTPUT_MAKEFILE diff --git a/src/util/pty/getpty.c b/src/util/pty/getpty.c index 867cbdf7f..dd86aa6cf 100644 --- a/src/util/pty/getpty.c +++ b/src/util/pty/getpty.c @@ -1,7 +1,7 @@ /* * pty_getpty: open a PTY master. * - * Copyright 1995 by the Massachusetts Institute of Technology. + * Copyright 1995, 1996 by the Massachusetts Institute of Technology. * * * Permission to use, copy, modify, and distribute this software and @@ -30,7 +30,9 @@ long pty_getpty (fd, slave, slavelength) int i,ptynum; struct stat stb; char slavebuf[1024]; - +#ifdef HAVE__GETPTY +char *slaveret; /*Temporary to hold pointer to slave*/ +#endif /*HAVE__GETPTY*/ #ifdef HAVE_OPENPTY int slavefd; @@ -39,9 +41,29 @@ char slavebuf[1024]; (struct winsize *) 0)) return 1; close(slavefd); return 0; -#else - - *fd = open("/dev/ptmx", O_RDWR|O_NDELAY); /* Solaris, IRIX */ +#else /*HAVE_OPENPTY*/ +#ifdef HAVE__GETPTY + /* This code is included for Irix; as of version 5.3, Irix has /dev/ptmx, + * but it fails to work properly; even cafter calling unlockpt, + * root gets permission denied opening the pty. + * The code to support _getpty should be removed if Irix gets working + * streams ptys in favor of maintaining the least needed code + * paths. + */ + if ((slaveret = _getpty(fd, O_RDWR|O_NDELAY, 0600, 0)) == 0) { + *fd = -1; + return PTY_GETPTY_NOPTY; + } + if (strlen(slaveret) > slavelength) { + close(*fd); + *fd = -1; + return PTY_GETPTY_SLAVE_TOOLONG; + } + else strcpy(slave, slaveret); + return 0; +#else /*HAVE__GETPTY*/ + + *fd = open("/dev/ptmx", O_RDWR|O_NDELAY); /* Solaris*/ if (*fd < 0) *fd = open("/dev/ptc", O_RDWR|O_NDELAY); /* AIX */ if (*fd < 0) *fd = open("/dev/pty", O_RDWR|O_NDELAY); /* sysvimp */ @@ -113,6 +135,7 @@ return PTY_GETPTY_SLAVE_TOOLONG; } return PTY_GETPTY_NOPTY; } +#endif /*HAVE__GETPTY*/ #endif /* HAVE_OPENPTY */ } diff --git a/src/util/pty/pty-int.h b/src/util/pty/pty-int.h index 489072654..4b6d1570d 100644 --- a/src/util/pty/pty-int.h +++ b/src/util/pty/pty-int.h @@ -22,7 +22,6 @@ #include #include -#include #include #include #include -- 2.26.2