From 933cc8fb9cd3e34b9b656f73ad8b661c08551875 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Mon, 10 Mar 2003 11:38:10 +1100 Subject: [PATCH] - (djm) Bug #245: TTY problems on Solaris. Fix by stevesk@ and dtucker@zip.com.au --- ChangeLog | 4 +++- acconfig.h | 5 ++++- configure.ac | 3 ++- sshd.c | 8 ++++++-- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index d060257e9..37a51edaa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,8 @@ fix memory leaks; from dlheine@suif.Stanford.EDU/CLOUSEAU; ok djm@ - (djm) One more portable-specific one from dlheine@suif.Stanford.EDU/ CLOUSEAU + - (djm) Bug #245: TTY problems on Solaris. Fix by stevesk@ and + dtucker@zip.com.au 20030225 - (djm) Fix some compile errors spotted by dtucker and his fabulous @@ -1200,4 +1202,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2624 2003/03/10 00:23:06 djm Exp $ +$Id: ChangeLog,v 1.2625 2003/03/10 00:38:10 djm Exp $ diff --git a/acconfig.h b/acconfig.h index b28966084..b6e4b37cc 100644 --- a/acconfig.h +++ b/acconfig.h @@ -1,4 +1,4 @@ -/* $Id: acconfig.h,v 1.148 2003/01/28 00:33:44 djm Exp $ */ +/* $Id: acconfig.h,v 1.149 2003/03/10 00:38:10 djm Exp $ */ #ifndef _CONFIG_H #define _CONFIG_H @@ -374,6 +374,9 @@ /* Some systems put this outside of libc */ #undef HAVE_NANOSLEEP +/* Pushing STREAMS modules incorrectly acquires a controlling TTY */ +#undef STREAMS_PUSH_ACQUIRES_CTTY + @BOTTOM@ /* ******************* Shouldn't need to edit below this line ************** */ diff --git a/configure.ac b/configure.ac index bdf80288e..3469af2f4 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.109 2003/02/24 04:45:43 djm Exp $ +# $Id: configure.ac,v 1.110 2003/03/10 00:38:10 djm Exp $ AC_INIT AC_CONFIG_SRCDIR([ssh.c]) @@ -216,6 +216,7 @@ mips-sony-bsd|mips-sony-newsos4) AC_DEFINE(LOGIN_NEEDS_UTMPX) AC_DEFINE(LOGIN_NEEDS_TERM) AC_DEFINE(PAM_TTY_KLUDGE) + AC_DEFINE(STREAMS_PUSH_ACQUIRES_CTTY) # hardwire lastlog location (can't detect it on some versions) conf_lastlog_location="/var/adm/lastlog" AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x) diff --git a/sshd.c b/sshd.c index 86441cff1..0f2b2a3ce 100644 --- a/sshd.c +++ b/sshd.c @@ -1400,8 +1400,12 @@ main(int ac, char **av) * setlogin() affects the entire process group. We don't * want the child to be able to affect the parent. */ -#if 0 - /* XXX: this breaks Solaris */ +#if !defined(STREAMS_PUSH_ACQUIRES_CTTY) + /* + * If setsid is called on Solaris, sshd will acquire the controlling + * terminal while pushing STREAMS modules. This will prevent the + * shell from acquiring it later. + */ if (!debug_flag && !inetd_flag && setsid() < 0) error("setsid: %.100s", strerror(errno)); #endif