[2940] in Kerberos-V5-bugs
krb5-appl/608: login.krb5 parent process
daemon@ATHENA.MIT.EDU (ghudson@MIT.EDU)
Tue Jun 9 14:07:12 1998
Resent-From: gnats@rt-11.MIT.EDU (GNATS Management)
Resent-To: krb5-unassigned@RT-11.MIT.EDU
Resent-Reply-To: krb5-bugs@MIT.EDU, ghudson@MIT.EDU
Date: Tue, 9 Jun 1998 13:59:05 -0400
From: ghudson@MIT.EDU
Reply-To: ghudson@MIT.EDU
To: krb5-bugs@MIT.EDU
>Number: 608
>Category: krb5-appl
>Synopsis: login parent process should ignore SIGHUP
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: krb5-unassigned
>State: open
>Class: sw-bug
>Submitter-Id: unknown
>Arrival-Date: Tue Jun 09 14:00:00 EDT 1998
>Last-Modified:
>Originator: Greg Hudson
>Organization:
MIT
>Release: 1.0pl1
>Environment:
System: SunOS small-gods.mit.edu 5.6 Generic_105181-04 sun4u sparc SUNW,Ultra-1
Architecture: sun4
>Description:
login.krb5 forks and leaves behind a parent process which cleans up after
the child exits. The first thing this parent process does right now is
try to get rid of its controlling tty. But this is a bad idea; login is
typically the session leader, and having the session leader throw away
the controlling tty leads to a messed-up session (thus the weird behavior
under Linux and such). Instead, it should just ignore the SIGHUP it gets
when the terminal connection closes.
>How-To-Repeat:
Notice that login.krb5 doesn't properly clean up on, say, IRIX 6.x if the
terminal connection is closed.
>Fix:
Index: login.c
===================================================================
RCS file: /cvs/krbdev/krb5/src/appl/bsd/login.c,v
retrieving revision 5.71
diff -c -r5.71 login.c
*** login.c 1998/05/27 19:12:45 5.71
--- login.c 1998/06/09 17:56:44
***************
*** 2444,2449 ****
--- 2444,2450 ----
{
int child,pid;
handler sa;
+ struct sigaction action;
#ifdef _IBMR2
update_ref_count(1);
***************
*** 2453,2481 ****
/* The parent continues here */
! { /* Try and get rid of our controlling tty. On SunOS, this may or may
! not work depending on if our parent did a setsid before exec-ing us. */
! #ifndef __linux__
! /* On linux, TIOCNOTTY causes us to die on a
! SIGHUP, so don't even try it. */
! #ifdef TIOCNOTTY
! { int fd;
! if ((fd = open("/dev/tty", O_RDWR)) >= 0) {
! ioctl(fd, TIOCNOTTY, 0);
! close(fd);
! }
! }
! #endif
! #endif /* __linux__ */
! #ifdef HAVE_SETSID
! (void)setsid();
! #endif
! #ifdef SETPGRP_TWOARG
! (void)setpgrp(0, 0);
! #else
! (void)setpgrp();
! #endif
! }
/* Setup stuff? This would be things we could do in parallel with login */
(void) chdir("/"); /* Let's not keep the fs busy... */
--- 2454,2465 ----
/* The parent continues here */
! /* We'll get a SIGHUP if the connection is closed, since we're the
! * session leader. Ignore it. */
! sigemptyset(&action.sa_mask);
! action.sa_flags = 0;
! action.sa_handler = SIG_IGN;
! sigaction(SIGHUP, &action, NULL);
/* Setup stuff? This would be things we could do in parallel with login */
(void) chdir("/"); /* Let's not keep the fs busy... */
>Audit-Trail:
>Unformatted: