[1032] in Kerberos_V5_Development

home help back first fref pref prev next nref lref last post

Re: SGIs: ptys, telnetd and other cruft

daemon@ATHENA.MIT.EDU (Sam Hartman)
Sun Mar 24 01:08:16 1996

To: reiburn@cygnus.com, eichin@cygnus.com
Cc: krbdev@MIT.EDU
From: hartmans@MIT.EDU (Sam Hartman)
Date: 24 Mar 1996 01:08:02 -0500
In-Reply-To: Sam Hartman's message of Sat, 23 Mar 1996 17:51:16 -0500

>>>>> "Sam" == Sam Hartman <hartmans@MIT.EDU> writes:


    Sam>   AC_FUNC_CHECK(gettosbyname,AC_DEFINE(HAS_GETTOS))
    Sam> --- 25,44 ----
    Sam>   AC_CHECK_HEADERS(string.h arpa/nameser.h)
    Sam>   AC_CHECK_HEADERS(sys/time.h sys/tty.h)
    Sam>   AC_HAVE_FUNCS(vhangup)
    Sam> ! dnl Make our operating system-specific security checks and definitions for
    Sam> ! dnl login.
    Sam> ! dnl
    Sam> ! case $krb5_cv_host in
    Sam> ! *-*-irix*)
    Sam> !      # Irix doesn't have a working granpt, and more over
    Sam> !      # you can't push anything onto a pty, so telnetd really
    Sam> !      # Really wants to treat it as if it doesn't have streams
    Sam> !     broken_streams = yes
    Sam> ! ;;
    Sam> ! esac
    Sam> ! if test -z "$broken_streams" ; then
    Sam> !     AC_FUNC_CHECK(grantpt,AC_DEFINE(STREAMSPTY))
    Sam> ! fi
    Sam>   AC_HEADER_CHECK(sac.h,AC_DEFINE(HAS_SAC))
    Sam>   AC_HEADER_CHECK(sys/ptyvar.h,AC_DEFINE(HAS_PTYVAR))
    Sam>   AC_FUNC_CHECK(gettosbyname,AC_DEFINE(HAS_GETTOS))
    Sam> Index: src/appl/telnet/telnetd/defs.h
    Sam> ===================================================================
    Sam> RCS file: /mit/krbdev/.cvsroot/src/appl/telnet/telnetd/defs.h,v
    Sam> retrieving revision 5.4
    Sam> diff -c -r5.4 defs.h
    Sam> *** defs.h	1995/06/20 19:08:04	5.4
    Sam> --- defs.h	1996/03/23 02:58:05
    Sam> ***************
    Sam> *** 309,311 ****
    Sam> --- 309,326 ----
  
    Sam>   #define his_will_wont_is_changing	my_do_dont_is_changing
    Sam>   #define his_do_dont_is_changing		my_will_wont_is_changing
    Sam> + 
    Sam> + extern char	*line;
    Sam> + 
    Sam> + #ifndef	P
    Sam> + # ifdef	__STDC__
    Sam> + #  define P(x)	x
    Sam> + # else
    Sam> + #  define P(x)	()
    Sam> + # endif
    Sam> + #endif
    Sam> + 
    Sam> + #ifdef	ENCRYPTION
    Sam> + extern void	(*encrypt_output) P((unsigned char *, int));
    Sam> + extern int	(*decrypt_input) P((int));
    Sam> + #endif	/* ENCRYPTION */
    Sam> Index: src/appl/telnet/telnetd/ext.h
    Sam> ===================================================================
    Sam> RCS file: /mit/krbdev/.cvsroot/src/appl/telnet/telnetd/ext.h,v
    Sam> retrieving revision 5.2
    Sam> diff -c -r5.2 ext.h
    Sam> *** ext.h	1996/02/24 14:32:02	5.2
    Sam> --- ext.h	1996/03/23 02:58:06
    Sam> ***************
    Sam> *** 66,72 ****
  
    Sam>   extern slcfun	slctab[NSLC + 1];	/* slc mapping table */
  
    Sam> ! char	*terminaltype;
  
    Sam>   /*
    Sam>    * I/O data buffers, pointers, and counters.
    Sam> --- 66,72 ----
  
    Sam>   extern slcfun	slctab[NSLC + 1];	/* slc mapping table */
  
    Sam> ! extern char	*terminaltype;
  
    Sam>   /*
    Sam>    * I/O data buffers, pointers, and counters.
    Sam> ***************
    Sam> *** 86,92 ****
    Sam>   #endif
  
    Sam>   extern int	pty, net;
    Sam> - extern char	*line;
    Sam>   extern int	SYNCHing;		/* we are in TELNET SYNCH mode */
  
    Sam>   #ifndef	P
    Sam> --- 86,91 ----
    Sam> ***************
    Sam> *** 192,199 ****
    Sam>   	writenet P((unsigned char *, int));
  
    Sam>   #ifdef	ENCRYPTION
    Sam> - extern void	(*encrypt_output) P((unsigned char *, int));
    Sam> - extern int	(*decrypt_input) P((int));
    Sam>   extern char	*nclearto;
    Sam>   #endif	/* ENCRYPTION */
  
    Sam> --- 191,196 ----
    Sam> Index: src/appl/telnet/telnetd/sys_term.c
    Sam> ===================================================================
    Sam> RCS file: /mit/krbdev/.cvsroot/src/appl/telnet/telnetd/sys_term.c,v
    Sam> retrieving revision 5.24
    Sam> diff -c -r5.24 sys_term.c
    Sam> *** sys_term.c	1996/01/19 01:32:14	5.24
    Sam> --- sys_term.c	1996/03/23 21:42:37
    Sam> ***************
    Sam> *** 64,72 ****
    Sam>   # include <utmpx.h>
    Sam>   struct	utmpx wtmp;
    Sam>   # else
    Sam> ! # include <utmp.h>
    Sam>   struct	utmp wtmp;
    Sam> ! # endif /* UTMPX */
  
    Sam>   int	utmp_len = sizeof(wtmp.ut_host);
    Sam>   # ifndef PARENT_DOES_UTMP
    Sam> --- 64,72 ----
    Sam>   # include <utmpx.h>
    Sam>   struct	utmpx wtmp;
    Sam>   # else
    Sam> ! #include<utmp.h>
    Sam>   struct	utmp wtmp;
    Sam> ! #endif /*UTMPX*/
  
    Sam>   int	utmp_len = sizeof(wtmp.ut_host);
    Sam>   # ifndef PARENT_DOES_UTMP
    Sam> ***************
    Sam> *** 1244,1276 ****
    Sam>   	register char **argv;
    Sam>   	char **addarg();
    Sam>   	extern char *getenv();
    Sam> - #ifdef	UTMPX
    Sam>   	register int pid = getpid();
    Sam> ! 	struct utmpx utmpx;
    Sam> ! #endif
    Sam>   #ifdef SOLARIS
    Sam>   	char *term;
    Sam>   	char termbuf[64];
    Sam>   #endif
  
    Sam> - #ifdef	UTMPX
    Sam> - 	/*
    Sam> - 	 * Create utmp entry for child
    Sam> - 	 */
    Sam> - 
    Sam> - 	memset(&utmpx, 0, sizeof(utmpx));
    Sam> - 	SCPYN(utmpx.ut_user, ".telnet");
    Sam> - 	SCPYN(utmpx.ut_line, line + sizeof("/dev/") - 1);
    Sam> - 	utmpx.ut_pid = pid;
    Sam> - 	utmpx.ut_id[0] = 't';
    Sam> - 	utmpx.ut_id[1] = 'n';
    Sam> - 	utmpx.ut_id[2] = SC_WILDC;
    Sam> - 	utmpx.ut_id[3] = SC_WILDC;
    Sam> - 	utmpx.ut_type = LOGIN_PROCESS;
    Sam> - 	(void) time(&utmpx.ut_tv.tv_sec);
    Sam> - 	if (makeutx(&utmpx) == NULL)
    Sam> - 		fatal(net, "makeutx failed");
    Sam> - #endif
  
    Sam>   	/*
    Sam>   	 * -h : pass on name of host.
    Sam> --- 1244,1256 ----
    Sam>   	register char **argv;
    Sam>   	char **addarg();
    Sam>   	extern char *getenv();
    Sam>   	register int pid = getpid();
    Sam> ! 
    Sam>   #ifdef SOLARIS
    Sam>   	char *term;
    Sam>   	char termbuf[64];
    Sam>   #endif
  
  
    Sam>   	/*
    Sam>   	 * -h : pass on name of host.
    Sam> ***************
    Sam> *** 1685,1815 ****
    Sam>   # endif /* CRAY */
    Sam>   #endif	/* defined(PARENT_DOES_UTMP) && !defined(NEWINIT) */
  
    Sam> - /*
    Sam> -  * rmut()
    Sam> -  *
    Sam> -  * This is the function called by cleanup() to
    Sam> -  * remove the utmp entry for this person.
    Sam> -  */
    Sam> - 
    Sam> - #ifdef	UTMPX
    Sam> - 	void
    Sam> - rmut()
    Sam> - {
    Sam> - 	register f;
    Sam> - 	int found = 0;
    Sam> - 	struct utmp *u, *utmp;
    Sam> - 	int nutmp;
    Sam> - 	struct stat statbf;
    Sam> - 
    Sam> - 	struct utmpx *utxp, utmpx;
    Sam> - 
    Sam> - 	/*
    Sam> - 	 * This updates the utmpx and utmp entries and make a wtmp/x entry
    Sam> - 	 */
  
    Sam> - 	SCPYN(utmpx.ut_line, line + sizeof("/dev/") - 1);
    Sam> - 	utxp = getutxline(&utmpx);
    Sam> - 	if (utxp) {
    Sam> - 		utxp->ut_type = DEAD_PROCESS;
    Sam> - 		utxp->ut_exit.e_termination = 0;
    Sam> - 		utxp->ut_exit.e_exit = 0;
    Sam> - 		(void) time(&utmpx.ut_tv.tv_sec);
    Sam> - 		utmpx.ut_tv.tv_usec = 0;
    Sam> - 		modutx(utxp);
    Sam> - 	}
    Sam> - 	endutxent();
    Sam> - }  /* end of rmut */
    Sam> - #endif
    Sam> - 
    Sam> - #if	!defined(UTMPX) && !(defined(CRAY) || defined(__hpux)) && BSD <= 43
    Sam> - 	void
    Sam> - rmut()
    Sam> - {
    Sam> - 	register f;
    Sam> - 	int found = 0;
    Sam> - 	struct utmp *u, *utmp;
    Sam> - 	int nutmp;
    Sam> - 	struct stat statbf;
    Sam> - 
    Sam> - 	f = open(utmpf, O_RDWR);
    Sam> - 	if (f >= 0) {
    Sam> - 		(void) fstat(f, &statbf);
    Sam> - 		utmp = (struct utmp *)malloc((unsigned)statbf.st_size);
    Sam> - 		if (!utmp)
    Sam> - 			syslog(LOG_ERR, "utmp malloc failed");
    Sam> - 		if (statbf.st_size && utmp) {
    Sam> - 			nutmp = read(f, (char *)utmp, (int)statbf.st_size);
    Sam> - 			nutmp /= sizeof(struct utmp);
    Sam> - 		
    Sam> - 			for (u = utmp ; u < &utmp[nutmp] ; u++) {
    Sam> - 				if (SCMPN(u->ut_line, line+5) ||
    Sam> - 				    u->ut_name[0]==0)
    Sam> - 					continue;
    Sam> - 				(void) lseek(f, ((long)u)-((long)utmp), L_SET);
    Sam> - 				SCPYN(u->ut_name, "");
    Sam> - 				SCPYN(u->ut_host, "");
    Sam> - 				(void) time(&u->ut_time);
    Sam> - 				(void) write(f, (char *)u, sizeof(wtmp));
    Sam> - 				found++;
    Sam> - 			}
    Sam> - 		}
    Sam> - 		(void) close(f);
    Sam> - 	}
    Sam> - 	if (found) {
    Sam> - 		f = open(wtmpf, O_WRONLY|O_APPEND);
    Sam> - 		if (f >= 0) {
    Sam> - 			SCPYN(wtmp.ut_line, line+5);
    Sam> - 			SCPYN(wtmp.ut_name, "");
    Sam> - 			SCPYN(wtmp.ut_host, "");
    Sam> - 			(void) time(&wtmp.ut_time);
    Sam> - 			(void) write(f, (char *)&wtmp, sizeof(wtmp));
    Sam> - 			(void) close(f);
    Sam> - 		}
    Sam> - 	}
    Sam> - 	(void) chmod(line, 0666);
    Sam> - 	(void) chown(line, 0, 0);
    Sam> - 	line[strlen("/dev/")] = 'p';
    Sam> - 	(void) chmod(line, 0666);
    Sam> - 	(void) chown(line, 0, 0);
    Sam> - }  /* end of rmut */
    Sam> - #endif	/* CRAY */
    Sam> - 
    Sam> - #ifdef __hpux
    Sam> - rmut (line)
    Sam> - char *line;
    Sam> - {
    Sam> - 	struct utmp utmp;
    Sam> - 	struct utmp *utptr;
    Sam> - 	int fd;			/* for /etc/wtmp */
    Sam> - 
    Sam> - 	utmp.ut_type = USER_PROCESS;
    Sam> - 	(void) strncpy(utmp.ut_id, line+12, sizeof(utmp.ut_id));
    Sam> - 	(void) setutent();
    Sam> - 	utptr = getutid(&utmp);
    Sam> - 	/* write it out only if it exists */
    Sam> - 	if (utptr) {
    Sam> - 		utptr->ut_type = DEAD_PROCESS;
    Sam> - 		utptr->ut_time = time((long *) 0);
    Sam> - 		(void) pututline(utptr);
    Sam> - 		/* set wtmp entry if wtmp file exists */
    Sam> - 		if ((fd = open(wtmpf, O_WRONLY | O_APPEND)) >= 0) {
    Sam> - 			(void) write(fd, utptr, sizeof(utmp));
    Sam> - 			(void) close(fd);
    Sam> - 		}
    Sam> - 	}
    Sam> - 	(void) endutent();
    Sam> - 
    Sam> - 	(void) chmod(line, 0666);
    Sam> - 	(void) chown(line, 0, 0);
    Sam> - 	line[14] = line[13];
    Sam> - 	line[13] = line[12];
    Sam> - 	line[8] = 'm';
    Sam> - 	line[9] = '/';
    Sam> - 	line[10] = 'p';
    Sam> - 	line[11] = 't';
    Sam> - 	line[12] = 'y';
    Sam> - 	(void) chmod(line, 0666);
    Sam> - 	(void) chown(line, 0, 0);
    Sam> - }
    Sam> - #endif
    Sam> --- 1665,1668 ----
    Sam> Index: src/appl/telnet/telnetd/telnetd.c
    Sam> ===================================================================
    Sam> RCS file: /mit/krbdev/.cvsroot/src/appl/telnet/telnetd/telnetd.c,v
    Sam> retrieving revision 5.15
    Sam> diff -c -r5.15 telnetd.c
    Sam> *** telnetd.c	1996/03/19 02:39:45	5.15
    Sam> --- telnetd.c	1996/03/23 06:48:58
    Sam> ***************
    Sam> *** 82,91 ****
    Sam>   #if	defined(AUTHENTICATION)
    Sam>   #include <libtelnet/auth.h>
    Sam>   #include <libtelnet/auth-proto.h>
    Sam> - int	auth_level = 0;
    Sam> - #endif
    Sam> - #if	defined(SecurID)
    Sam> - int	require_SecurID = 0;
    Sam>   #endif
    Sam>   #ifdef ENCRYPTION
    Sam>   #include <libtelnet/encrypt.h>
    Sam> --- 82,87 ----
    Sam> ***************
    Sam> *** 107,113 ****
    Sam>   # include <sys/ptyvar.h>
    Sam>   #endif
  
    Sam> - void doit P((struct sockaddr_in *));
  
    Sam>   /*
    Sam>    * Because of the way ptyibuf is used with streams messages, we need
    Sam> --- 103,108 ----
    Sam> ***************
    Sam> *** 133,138 ****
    Sam> --- 128,135 ----
    Sam>   char	ptyibuf2[BUFSIZ];
  
    Sam>   #endif /* ! STREAMPTY */
    Sam> + 
    Sam> + void doit P((struct sockaddr_in *));
  
    Sam>   int	hostinfo = 1;			/* do we print login banner? */
  
    Sam> Index: src/appl/src/appl/bsd/ChangeLog
    Sam> ===================================================================
    Sam> RCS file: /mit/krbdev/.cvsroot/src/appl/bsd/ChangeLog,v
    Sam> retrieving revision 5.185
    Sam> diff -c -r5.185 ChangeLog
    Sam> *** ChangeLog	1996/03/22 04:49:55	5.185
    Sam> --- ChangeLog	1996/03/23 22:22:18
    Sam> ***************
    Sam> *** 1,3 ****
    Sam> --- 1,12 ----
    Sam> + Sat Mar 23 17:20:00 1996  Sam Hartman  <hartmans@tertius.mit.edu>
    Sam> + 
    Sam> + 	* krcp.c (des_write): Use krb5_net_write instead of write, because
    Sam> +  	most parts of rcp that call this code ignore the return value and
    Sam> +  	we want to reblock properly.
    Sam> + 
    Sam> + 	* krshd.c (doit): Don't use non-blocking IO; it is unnecessary and
    Sam> +  	may cause problems.
    Sam> + 
    Sam>   Wed Mar 20 19:36:21 1996  Richard Basch  <basch@lehman.com>
  
    Sam>   	* krlogind.c (recvauth): use the library routines to do v4 to v5
    Sam> Index: src/appl/src/appl/bsd/krcp.c
    Sam> ===================================================================
    Sam> RCS file: /mit/krbdev/.cvsroot/src/appl/bsd/krcp.c,v
    Sam> retrieving revision 5.46
    Sam> diff -c -r5.46 krcp.c
    Sam> *** krcp.c	1996/02/26 02:31:03	5.46
    Sam> --- krcp.c	1996/03/23 03:31:37
    Sam> ***************
    Sam> *** 1130,1136 ****
    Sam>   #else
    Sam>       size = roundup(stb.st_blksize, blksize);
    Sam>   #endif
    Sam> !     if (size == 0)
    Sam>         size = blksize;
    Sam>       if (bp->cnt < size) {
    Sam>   	if (bp->buf != 0)
    Sam> --- 1130,1136 ----
    Sam>   #else
    Sam>       size = roundup(stb.st_blksize, blksize);
    Sam>   #endif
    Sam> ! 
    Sam>         size = blksize;
    Sam>       if (bp->cnt < size) {
    Sam>   	if (bp->buf != 0)
    Sam> ***************
    Sam> *** 1433,1439 ****
    Sam>       if (fd == 0)
    Sam>   	fd = 1;
    Sam>       if (!encryptflag)
    Sam> !       return(write(fd, buf, len));
      
    Sam>       desoutbuf.length = krb5_encrypt_size(len,eblock.crypto_entry);
    Sam>       if (desoutbuf.length > sizeof(des_outbuf)){
    Sam> --- 1433,1439 ----
    Sam>       if (fd == 0)
    Sam>   	fd = 1;
    Sam>       if (!encryptflag)
    Sam> !       return(krb5_net_write(bsd_context, fd, buf, len));
      
    Sam>       desoutbuf.length = krb5_encrypt_size(len,eblock.crypto_entry);
    Sam>       if (desoutbuf.length > sizeof(des_outbuf)){
    Sam> Index: src/appl/src/appl/bsd/krshd.c
    Sam> ===================================================================
    Sam> RCS file: /mit/krbdev/.cvsroot/src/appl/bsd/krshd.c,v
    Sam> retrieving revision 5.48
    Sam> diff -c -r5.48 krshd.c
    Sam> *** krshd.c	1996/03/12 23:03:58	5.48
    Sam> --- krshd.c	1996/03/23 22:44:57
    Sam> ***************
    Sam> *** 1134,1144 ****
    Sam>   	    (void) close(pw[1]);
    Sam>   	    (void) close(px[0]);
  	    
    Sam> ! if(port)
    Sam> !     ioctl(pv[0], FIONBIO, (char *)&one);
    Sam> ! 	    ioctl(pw[0], FIONBIO, (char *)&one);
    Sam> ! 	    /* should set s nbio! */
    Sam> ! 
  	    
    Sam>   	    FD_ZERO(&readfrom);
    Sam>   	    FD_SET(f, &readfrom);
    Sam> --- 1134,1140 ----
    Sam>   	    (void) close(pw[1]);
    Sam>   	    (void) close(px[0]);
  	    
    Sam> ! 	    
  	    
    Sam>   	    FD_ZERO(&readfrom);
    Sam>   	    FD_SET(f, &readfrom);
    Sam> Index: src/appl/src/appl/src/util/pty/ChangeLog
    Sam> ===================================================================
    Sam> RCS file: /mit/krbdev/.cvsroot/src/util/pty/ChangeLog,v
    Sam> retrieving revision 1.34
    Sam> diff -c -r1.34 ChangeLog
    Sam> *** ChangeLog	1996/03/11 21:59:39	1.34
    Sam> --- ChangeLog	1996/03/23 20:47:28
    Sam> ***************
    Sam> *** 1,3 ****
    Sam> --- 1,15 ----
    Sam> + Sat Mar 23 15:24:38 1996  Sam Hartman  <hartmans@tertius.mit.edu>
    Sam> + 
    Sam> + 	* configure.in : Remove shadow passwords check because nothing in
    Sam> +  	libpty cares about the result; remove use of libkrb5, libkrb4,
    Sam> +  	libkadm; Check for _getpty
    Sam> + 
    Sam> + 	* getpty.c (pty_getpty): Support _getpty for Irix; Irix has
    Sam> +  	/dev/ptmx, but it doesn't work correctly at all.  Also, Irix,
    Sam> +  	tends to create device nodes on the fly.
    Sam> + 
    Sam> + 	* pty-int.h: No need to include sys/socket.h
    Sam> + 
    Sam>   Sat Feb 24 21:34:58 1996  Theodore Y. Ts'o  <tytso@dcl>
  
    Sam>   	* vhangup.c (ptyint_vhangup): Don't do call vhangup() if system
    Sam> Index: src/appl/src/appl/src/util/pty/configure.in
    Sam> ===================================================================
    Sam> RCS file: /mit/krbdev/.cvsroot/src/util/pty/configure.in,v
    Sam> retrieving revision 1.6
    Sam> diff -c -r1.6 configure.in
    Sam> *** configure.in	1995/09/29 18:22:40	1.6
    Sam> --- configure.in	1996/03/23 20:47:30
    Sam> ***************
    Sam> *** 6,13 ****
    Sam>   AC_PROG_INSTALL
    Sam>   AC_PROG_ARCHIVE
    Sam>   AC_PROG_RANLIB
    Sam> ! AC_CHECK_FUNCS(fchmod fchown revoke vhangup killpg)
    Sam> ! dnl dbm libs for use of an_to_ln
    Sam>   LOGINLIBS=
    Sam>   dnl
    Sam>   dnl Make our operating system-specific security checks and definitions for
    Sam> --- 6,13 ----
    Sam>   AC_PROG_INSTALL
    Sam>   AC_PROG_ARCHIVE
    Sam>   AC_PROG_RANLIB
    Sam> ! AC_CHECK_FUNCS(fchmod fchown revoke vhangup killpg _getpty)
    Sam> ! dnl
    Sam>   LOGINLIBS=
    Sam>   dnl
    Sam>   dnl Make our operating system-specific security checks and definitions for
    Sam> ***************
    Sam> *** 125,149 ****
    Sam>   fi
    Sam>   dnl
    Sam>   dnl
    Sam> - AC_MSG_CHECKING([shadow password support])
    Sam> - AC_CACHE_VAL(krb5_cv_shadow_pwd,
    Sam> - [AC_TRY_LINK(
    Sam> - [#include <sys/types.h>
    Sam> - #include <pwd.h>
    Sam> - #include <shadow.h>],
    Sam> - [struct spwd *sp = getspnam("root")],
    Sam> - krb5_cv_shadow_pwd=yes, krb5_cv_shadow_pwd=no)])
    Sam> - AC_MSG_RESULT($krb5_cv_shadow_pwd)
    Sam> - if test $krb5_cv_shadow_pwd = yes; then
    Sam> - AC_DEFINE(HAVE_SHADOW)
    Sam> - fi
    Sam> - dnl
    Sam>   dnl
    Sam>   ADD_DEF(-DKERBEROS)
    Sam>   AC_CONST
    Sam> - USE_KADM_LIBRARY
    Sam> - USE_KRB4_LIBRARY
    Sam> - KRB5_LIBRARIES
    Sam>   V5_USE_SHARED_LIB
    Sam>   SubdirLibraryRule([$(LIBOBJS)])
    Sam>   V5_AC_OUTPUT_MAKEFILE
    Sam> --- 125,133 ----
    Sam> Index: src/appl/src/appl/src/util/pty/getpty.c
    Sam> ===================================================================
    Sam> RCS file: /mit/krbdev/.cvsroot/src/util/pty/getpty.c,v
    Sam> retrieving revision 1.5
    Sam> diff -c -r1.5 getpty.c
    Sam> *** getpty.c	1995/08/09 04:20:41	1.5
    Sam> --- getpty.c	1996/03/23 20:54:00
    Sam> ***************
    Sam> *** 1,7 ****
    Sam>   /*
    Sam>    * pty_getpty: open a PTY master.
    Sam>    *
    Sam> !  * Copyright 1995 by the Massachusetts Institute of Technology.
    Sam>    *
    Sam>    * 
    Sam>    * Permission to use, copy, modify, and distribute this software and
    Sam> --- 1,7 ----
    Sam>   /*
    Sam>    * pty_getpty: open a PTY master.
    Sam>    *
    Sam> !  * Copyright 1995, 1996 by the Massachusetts Institute of Technology.
    Sam>    *
    Sam>    * 
    Sam>    * Permission to use, copy, modify, and distribute this software and
    Sam> ***************
    Sam> *** 30,36 ****
    Sam>       int i,ptynum;
    Sam>       struct stat stb;
    Sam>   char slavebuf[1024];
    Sam> ! 
  
    Sam>   #ifdef HAVE_OPENPTY
    Sam>       int slavefd;
    Sam> --- 30,38 ----
    Sam>       int i,ptynum;
    Sam>       struct stat stb;
    Sam>   char slavebuf[1024];
    Sam> ! #ifdef HAVE__GETPTY
    Sam> ! char *slaveret; /*Temporary to hold pointer to slave*/
    Sam> ! #endif /*HAVE__GETPTY*/
  
    Sam>   #ifdef HAVE_OPENPTY
    Sam>       int slavefd;
    Sam> ***************
    Sam> *** 39,47 ****
    Sam>            (struct winsize *) 0)) return 1;
    Sam>   close(slavefd);
    Sam>       return 0;
    Sam> ! #else
    Sam> ! 
    Sam> !     *fd = open("/dev/ptmx", O_RDWR|O_NDELAY);	/* Solaris, IRIX */
    Sam>       if (*fd < 0) *fd = open("/dev/ptc", O_RDWR|O_NDELAY); /* AIX */
    Sam>       if (*fd < 0) *fd = open("/dev/pty", O_RDWR|O_NDELAY); /* sysvimp */
  
    Sam> --- 41,69 ----
    Sam>            (struct winsize *) 0)) return 1;
    Sam>   close(slavefd);
    Sam>       return 0;
    Sam> ! #else /*HAVE_OPENPTY*/
    Sam> ! #ifdef HAVE__GETPTY
    Sam> !     /* This code is included for Irix; as of version 5.3, Irix has /dev/ptmx,
    Sam> !      * but it fails to work properly; even cafter calling unlockpt,
    Sam> !      * root gets permission denied opening the pty.
    Sam> !      * The code to support _getpty should be removed if Irix gets working
    Sam> !      * streams ptys in favor of maintaining the least needed code
    Sam> !      * paths.
    Sam> !      */
    Sam> !     if ((slaveret = _getpty(fd, O_RDWR|O_NDELAY, 0600, 0)) == 0) {
    Sam> !       *fd = -1;
    Sam> !       return PTY_GETPTY_NOPTY;
    Sam> !     }
    Sam> !     if (strlen(slaveret) > slavelength) {
    Sam> !       close(*fd);
    Sam> !       *fd = -1;
    Sam> !       return PTY_GETPTY_SLAVE_TOOLONG;
    Sam> !     }
    Sam> !     else strcpy(slave, slaveret);
    Sam> !     return 0;
    Sam> ! #else /*HAVE__GETPTY*/
    Sam> !     
    Sam> !     *fd = open("/dev/ptmx", O_RDWR|O_NDELAY);	/* Solaris*/
    Sam>       if (*fd < 0) *fd = open("/dev/ptc", O_RDWR|O_NDELAY); /* AIX */
    Sam>       if (*fd < 0) *fd = open("/dev/pty", O_RDWR|O_NDELAY); /* sysvimp */
  
    Sam> ***************
    Sam> *** 113,118 ****
    Sam> --- 135,141 ----
    Sam>   	}
    Sam>   	return PTY_GETPTY_NOPTY;
    Sam>       }
    Sam> + #endif /*HAVE__GETPTY*/
    Sam>   #endif /* HAVE_OPENPTY */
    Sam>   }
  
    Sam> Index: src/appl/src/appl/src/util/pty/pty-int.h
    Sam> ===================================================================
    Sam> RCS file: /mit/krbdev/.cvsroot/src/util/pty/pty-int.h,v
    Sam> retrieving revision 1.7
    Sam> diff -c -r1.7 pty-int.h
    Sam> *** pty-int.h	1996/01/16 19:40:55	1.7
    Sam> --- pty-int.h	1996/03/23 20:47:30
    Sam> ***************
    Sam> *** 22,28 ****
    Sam>   #include <stdio.h>
  
    Sam>   #include <sys/stat.h>
    Sam> - #include <sys/socket.h>
    Sam>   #include <sys/ioctl.h>
    Sam>   #include <sys/wait.h>
    Sam>   #include <sys/file.h>
    Sam> --- 22,27 ----


	You really wanted broken_streams=yes (remove space).  It's
kind of complicated explaining why it worked for me; I was doing some
config.cache hacking to try things, and it ended up having a side
effect of fixing the SGI problem by setting have_grantpt to no, even
though the 
broken_streams test was broken.

--Sam

home help back first fref pref prev next nref lref last post