From b69407dd7ada7f0c254fc538da8357e36a1edb7a Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Wed, 21 Mar 2001 16:13:03 +1100 Subject: [PATCH] - (djm) Correctly handle SIA and AIX when no tty present. Spotted and suggested fix from Mike Battersby --- ChangeLog | 4 +++- session.c | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0dd9f7bca..6e9ace6aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,8 @@ - (djm) Don't loop forever when changing password via PAM. Patch from Solar Designer - (djm) Generate config files before build + - (djm) Correctly handle SIA and AIX when no tty present. Spotted and + suggested fix from Mike Battersby 20010320 - (bal) glob.c update to added GLOB_LIMITS (OpenBSD CVS). @@ -4654,4 +4656,4 @@ - Wrote replacements for strlcpy and mkdtemp - Released 1.0pre1 -$Id: ChangeLog,v 1.997 2001/03/21 02:13:40 djm Exp $ +$Id: ChangeLog,v 1.998 2001/03/21 05:13:03 djm Exp $ diff --git a/session.c b/session.c index 31a16dc7c..bed03c746 100644 --- a/session.c +++ b/session.c @@ -1053,7 +1053,7 @@ do_child(Session *s, const char *command) switch, so we let login(1) to this for us. */ if (!options.use_login) { #ifdef HAVE_OSF_SIA - session_setup_sia(pw->pw_name, s->tty); + session_setup_sia(pw->pw_name, s->ttyfd == -1 ? NULL : s->tty); #else /* HAVE_OSF_SIA */ #ifdef HAVE_CYGWIN if (is_winnt) { @@ -1137,7 +1137,8 @@ do_child(Session *s, const char *command) cp = xmalloc(22 + strlen(s->tty) + 2 * strlen(pw->pw_name)); i = sprintf(cp, "LOGNAME=%s%cNAME=%s%cTTY=%s%c%c", - pw->pw_name, 0, pw->pw_name, 0, s->tty, 0,0); + pw->pw_name, 0, pw->pw_name, 0, + s->ttyfd == -1 ? "" : s->tty, 0,0); if (usrinfo(SETUINFO, cp, i) == -1) fatal("Couldn't set usrinfo: %s", strerror(errno));