From ghudson@MIT.EDU Tue Jun 9 13:59:07 1998
Received: from MIT.EDU (SOUTH-STATION-ANNEX.MIT.EDU [18.72.1.2]) by rt-11.MIT.EDU (8.7.5/8.7.3) with SMTP id NAA19040 for <bugs@RT-11.MIT.EDU>; Tue, 9 Jun 1998 13:59:06 -0400
Received: from SMALL-GODS.MIT.EDU by MIT.EDU with SMTP
id AA29098; Tue, 9 Jun 98 13:59:04 EDT
Received: by small-gods.mit.edu (SMI-8.6/4.7) id NAA01333; Tue, 9 Jun 1998 13:59:05 -0400
Message-Id: <199806091759.NAA01333@small-gods.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
Subject: login.krb5 parent process
X-Send-Pr-Version: 3.99
System: SunOS small-gods.mit.edu 5.6 Generic_105181-04 sun4u sparc SUNW,Ultra-1
Architecture: sun4
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.
terminal connection is closed.
===================================================================
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... */
From: Greg Hudson <ghudson@MIT.EDU>
To: ghudson@MIT.EDU
Cc: krb5-bugs@MIT.EDU
Subject: Re: krb5-appl/608: login.krb5 parent process
Date: Wed, 10 Jun 1998 15:30:47 -0400
I didn't read the current login code carefully enough; the
SIGALRM-setting code in my last patch turns out to be redundant.
However:
* The code to get rid of the controlling tty is probably still
misguided, and should probably go away.
* The cleanup code will not be properly invoked if a SIGHUP
arrives before the SIGHUP handler is installed.
Received: from MIT.EDU (SOUTH-STATION-ANNEX.MIT.EDU [18.72.1.2]) by rt-11.MIT.EDU (8.7.5/8.7.3) with SMTP id NAA19040 for <bugs@RT-11.MIT.EDU>; Tue, 9 Jun 1998 13:59:06 -0400
Received: from SMALL-GODS.MIT.EDU by MIT.EDU with SMTP
id AA29098; Tue, 9 Jun 98 13:59:04 EDT
Received: by small-gods.mit.edu (SMI-8.6/4.7) id NAA01333; Tue, 9 Jun 1998 13:59:05 -0400
Message-Id: <199806091759.NAA01333@small-gods.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
Subject: login.krb5 parent process
X-Send-Pr-Version: 3.99
Show quoted text
>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: Wed Jun 10 15:31:01 EDT 1998
>Originator: Greg Hudson
>Organization:
MIT>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: Wed Jun 10 15:31:01 EDT 1998
>Originator: Greg Hudson
>Organization:
Show quoted text
>Release: 1.0pl1
>Environment:
>Environment:
System: SunOS small-gods.mit.edu 5.6 Generic_105181-04 sun4u sparc SUNW,Ultra-1
Architecture: sun4
Show quoted text
>Description:
login.krb5 forks and leaves behind a parent process which cleans up afterthe 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.
Show quoted text
>How-To-Repeat:
Notice that login.krb5 doesn't properly clean up on, say, IRIX 6.x if theterminal connection is closed.
Show quoted text
>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... */
Show quoted text
>Audit-Trail:
From: Greg Hudson <ghudson@MIT.EDU>
To: ghudson@MIT.EDU
Cc: krb5-bugs@MIT.EDU
Subject: Re: krb5-appl/608: login.krb5 parent process
Date: Wed, 10 Jun 1998 15:30:47 -0400
I didn't read the current login code carefully enough; the
SIGALRM-setting code in my last patch turns out to be redundant.
However:
* The code to get rid of the controlling tty is probably still
misguided, and should probably go away.
* The cleanup code will not be properly invoked if a SIGHUP
arrives before the SIGHUP handler is installed.
Show quoted text
>Unformatted: