+Sun Mar 24 19:59:14 1996 Sam Hartman <hartmans@tertius.mit.edu>
+
+ * configure.in : Do streams handling by deciding what modules to
+ push for each system.
+
+ * init_slave.c (pty_initialize_slave): Better abstraction for
+ dealing with what modules get pushed on what streams system.
+ There is a list of modules controlled on a module-by-module basis
+ by configure.in, and the modules included in that list are pushed.
+
+ * void_assoc.c: Duplicate comment from open_ctty.c explaining that
+ it's OK to call void_association twice, and giving the caviats
+ about setsid.
+
+ * open_ctty.c (pty_open_ctty): Remove test to make sure /dev/tty
+ worked, so we can push the streams for the HP.
+
+ * open_slave.c (pty_open_slave): Test to see if /dev/tty works
+ only after calling pty_initialize_slave.
+
Sat Mar 23 15:24:38 1996 Sam Hartman <hartmans@tertius.mit.edu>
* configure.in : Remove shadow passwords check because nothing in
dnl
dnl Make our operating system-specific security checks and definitions for
dnl login.
+dnl In addition, the following code decides what streams modules will
+dnl be pushed onto a pty.In particular, if HAVE_STREAMS is defined and
+dnl HAVE_LINE_PUSH is not defined, modules may be pushed by inserting
+dnl An appropriate generic ifdef for each module in init_slave.c and
+dnl AC_DEFINES for the operating systems that need the modules.
+dnl Each OS that supports streams has a different idea of what you want to
+dnl push.
dnl
case $krb5_cv_host in
*-*-ultrix*)
LOGINLIBS="$LOGINLIBS -lsecurity"
)
;;
+*-*-solaris*)
+ AC_DEFINE(PUSH_PTEM)
+ AC_DEFINE(PUSH_LDTERM)
+ AC_DEFINE(PUSH_TTCOMPAT)
+ ;;
+*-*-hpux*)
+ AC_DEFINE(PUSH_PTEM)
+ AC_DEFINE(PUSH_LDTERM)
+ ;;
esac
dnl
AC_SUBST(LOGINLIBS)
/*
* pty_open_slave: open slave side of terminal, clearing for use.
*
- * 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
* its documentation for any purpose and without fee is hereby
#include "libpty.h"
#include "pty-int.h"
+/* * The following is an array of modules that should be pushed on the
+ * stream. See configure.in for caviats and notes about when this
+ * array is used and not used.
+ */
+#if defined(HAVE_STREAMS)&&(!defined(HAVE_LINE_PUSH))
+static char *push_list[] = {
+#ifdef PUSH_PTEM
+ "ptem",
+#endif
+#ifdef PUSH_LDTERM
+ "ldterm",
+#endif
+#ifdef PUSH_TTCOMPAT
+"ttcompat",
+#endif
+ 0};
+#endif /*HAVE_STREAMS but not HAVE_LINE_PUSH*/
+
+
+
long pty_initialize_slave (fd)
int fd;
{
return PTY_OPEN_SLAVE_LINE_PUSHFAIL;
}
#else /*No line_push */
-#ifdef sun
- if (ioctl(fd, I_PUSH, "ptem") < 0)
- return PTY_OPEN_SLAVE_PUSH_FAIL;
- if (ioctl(fd, I_PUSH, "ldterm") < 0)
- return PTY_OPEN_SLAVE_PUSH_FAIL;
- if (ioctl(fd, I_PUSH, "ttcompat") < 0)
- return PTY_OPEN_SLAVE_PUSH_FAIL;
+ {
+ char **module = &push_list[0];
+ while (*module)
+ if (ioctl(fd, I_PUSH, *(module++)) < 0)
+ return PTY_OPEN_SLAVE_PUSH_FAIL;
+ }
-#endif /*SUN*/
#endif /*LINE_PUSH*/
#endif /*HAVE_STREAMS*/
/*
* pty_open_ctty: Open and establish controlling terminal.
*
- * 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
* its documentation for any purpose and without fee is hereby
const char * slave;
int *fd;
{
- int testfd, retval;
+ int retval;
/* First, dissociate from previous terminal */
if ( (retval = ptyint_void_association()) != 0 )
#ifdef ultrix
setpgrp(0, getpid());
#endif
-#ifdef ultrix
- setpgrp(0, getpid());
-#endif
#ifdef TIOCSCTTY
ioctl(*fd, TIOCSCTTY, 0); /* Don't check return.*/
#endif /* TIOCSTTY */
-
- testfd = open("/dev/tty", O_RDWR|O_NDELAY);
- if ( testfd < 0 )
- {
- close(*fd);
- *fd = -1;
- return PTY_OPEN_SLAVE_NOCTTY;
- }
- close(testfd);
return 0;
}
/*
* pty_open_slave: open slave side of terminal, clearing for use.
*
- * 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
const char *slave;
int *fd;
{
- int vfd;
+ int vfd, testfd;
long retval;
#ifdef POSIX_SIGNALS
struct sigaction sa;
if (( retval = pty_open_ctty ( slave, fd)) != 0 ) {
return PTY_OPEN_SLAVE_OPENFAIL;
}
- return pty_initialize_slave (*fd);
-}
-
+ retval = pty_initialize_slave (*fd);
+ if (retval)
+ return retval;
+ testfd = open("/dev/tty", O_RDWR|O_NDELAY);
+ if ( testfd < 0 )
+ {
+ close(*fd);
+ *fd = -1;
+ return PTY_OPEN_SLAVE_NOCTTY;
+ }
+ close(testfd);
+ return 0;
+}
/*
* ptyint_void_association(): Void association with controlling terminal
*
- * 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
#include <com_err.h>
#include "libpty.h"
#include "pty-int.h"
+/*
+ * This routine will be called twice. It's not particularly important
+ * that the setsid() or TIOCSTTY ioctls succeed (they may not the
+ * second time), but rather that we have a controlling terminal at the
+ * end. It is assumed that vhangup doesn't exist and confuse the
+ * process's notion of controlling terminal on any system without
+ * TIOCNOTTY. That is, either vhangup() leaves the controlling
+ * terminal in tact, breaks the association completely, or the system
+ * provides TIOCNOTTY to get things back into a reasonable state. In
+ * practice, vhangup() either breaks the association completely or
+ * doesn't effect controlling terminals, so this condition is met.
+ */
long ptyint_void_association()
{