Subject: bin/13614: Various fixes for telnetd/sys_term.c
To: None <gnats-bugs@gnats.netbsd.org>
From: None <ginsbach@cray.com>
List: netbsd-bugs
Date: 08/01/2001 12:31:38
>Number: 13614
>Category: bin
>Synopsis: Various fixes, typos, changed interfaces, etc.
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Aug 01 10:29:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Brian Ginsbach
>Release: NetBSD-1.5, NetBSD-1.5.1, NetBSD-current
>Organization:
Cray Inc.
>Environment:
n.a.
>Description:
Here are some various changes to sys_term.c that have been made
by Cray since the last archive was put together for
ftp.cray.com. Some of these are Cray specific but several are
more general. One corrects a mistake just introduced by the
most recent change to sys_term.c.
- remove the TCVHUP ioctl() call. This is obsolete on Cray
operating systems.
- move the close() in cleanopen(). This ensures that the
process connected to the psuedo terminal no longer has the
original /dev/ttyp* file open when the master side of the
tty goes away, thus eliminating the possibility that a new
user logging in may get connected to that process.
- back out recent change in login_tty(). This needs to
remain line not ttyline. ttyline is not a global and not
known to login_tty().
- correct signal handling for UNICOS/mk. This fixes a timing
problem that affected signal handlers which caused telnetd to
hang.
>How-To-Repeat:
n.a.
>Fix:
For 1.5.1
Index: sys_term.c
===================================================================
RCS file: /cvsroot/basesrc/libexec/telnetd/sys_term.c,v
retrieving revision 1.18.4.3
diff -u -r1.18.4.3 sys_term.c
--- sys_term.c 2001/07/29 04:13:05 1.18.4.3
+++ sys_term.c 2001/08/01 16:21:55
@@ -1313,13 +1313,8 @@
if (t < 0)
return(-1);
# endif
-# if defined(CRAY) && defined(TCVHUP)
{
register int i;
- (void) signal(SIGHUP, SIG_IGN);
- (void) ioctl(t, TCVHUP, (char *)0);
- (void) signal(SIGHUP, SIG_DFL);
-
#ifdef UNICOS7x
if (secflag) {
if (secstat(ttyline, &secbuf) < 0)
@@ -1342,12 +1337,11 @@
}
#endif /* UNICOS7x */
+ (void) close(t);
if (i < 0)
return(-1);
- (void) close(t);
t = i;
}
-# endif /* defined(CRAY) && defined(TCVHUP) */
return(t);
#endif /* OPENPTY_PTY */
}
@@ -1395,7 +1389,7 @@
# else
(void) setpgrp();
# endif
- close(open(ttyline, O_RDWR));
+ close(open(line, O_RDWR));
# endif
if (t != 0)
(void) dup2(t, 0);
@@ -1485,7 +1479,13 @@
(void) close(i);
}
#ifdef CRAY
- (void) signal(WJSIGNAL, sigjob);
+ {
+ struct sigaction act;
+ act.sa_handler = sigjob;
+ act.sa_mask = sigmask(SIGCHLD) | sigmask(WJSIGNAL);
+ act.sa_flags = 0;
+ (void) sigaction(WJSIGNAL, &act, 0);
+ }
#endif
utmp_sig_notify(pid);
# endif /* PARENT_DOES_UTMP */
For Current
Index: sys_term.c
===================================================================
RCS file: /cvsroot/basesrc/libexec/telnetd/sys_term.c,v
retrieving revision 1.23
diff -u -r1.23 sys_term.c
--- sys_term.c 2001/07/19 04:57:50 1.23
+++ sys_term.c 2001/08/01 17:29:31
@@ -1313,13 +1313,8 @@
if (t < 0)
return(-1);
# endif
-# if defined(CRAY) && defined(TCVHUP)
{
register int i;
- (void) signal(SIGHUP, SIG_IGN);
- (void) ioctl(t, TCVHUP, (char *)0);
- (void) signal(SIGHUP, SIG_DFL);
-
#ifdef UNICOS7x
if (secflag) {
if (secstat(ttyline, &secbuf) < 0)
@@ -1342,12 +1337,11 @@
}
#endif /* UNICOS7x */
+ (void) close(t);
if (i < 0)
return(-1);
- (void) close(t);
t = i;
}
-# endif /* defined(CRAY) && defined(TCVHUP) */
return(t);
#endif /* OPENPTY_PTY */
}
@@ -1395,7 +1389,7 @@
# else
(void) setpgrp();
# endif
- close(open(ttyline, O_RDWR));
+ close(open(line, O_RDWR));
# endif
if (t != 0)
(void) dup2(t, 0);
@@ -1485,7 +1479,13 @@
(void) close(i);
}
#ifdef CRAY
- (void) signal(WJSIGNAL, sigjob);
+ {
+ struct sigaction act;
+ act.sa_handler = sigjob;
+ act.sa_mask = sigmask(SIGCHLD) | sigmask(WJSIGNAL);
+ act.sa_flags = 0;
+ (void) sigaction(WJSIGNAL, &act, 0);
+ }
#endif
utmp_sig_notify(pid);
# endif /* PARENT_DOES_UTMP */
>Release-Note:
>Audit-Trail:
>Unformatted: