Skip Menu |
 

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

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
Show quoted text
>Release: 1.0pl1
>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 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.
Show quoted text
>How-To-Repeat:
Notice that login.krb5 doesn't properly clean up on, say, IRIX 6.x if the
terminal 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:
Download (untitled) / with headers
text/plain 2.9KiB
From rbasch@MIT.EDU Mon May 4 16:48:45 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 QAA10403 for <bugs@RT-11.MIT.EDU>; Mon, 4 May 1998 16:48:44 -0400
Received: from AUPAIR.MIT.EDU by MIT.EDU with SMTP
id AA05724; Mon, 4 May 98 16:48:29 EDT
Received: by aupair.MIT.EDU (950413.SGI.8.6.12/4.7) id QAA02436; Mon, 4 May 1998 16:48:31 -0400
Message-Id: <199805042048.QAA02436@aupair.MIT.EDU>
Date: Mon, 4 May 1998 16:48:31 -0400
From: rbasch@MIT.EDU
Reply-To: rbasch@MIT.EDU
To: krb5-bugs@MIT.EDU
Subject: login.krb5: don't do both setsid() and setpgrp()
X-Send-Pr-Version: 3.99

Show quoted text
>Number: 588
>Category: krb5-appl
>Synopsis: login: don't do both setsid() and setpgrp()
>Confidential: yes
>Severity: serious
>Priority: medium
>Responsible: tlyu
>State: open
>Class: sw-bug
>Submitter-Id: unknown
>Arrival-Date: Mon May 04 16:49:01 EDT 1998
>Last-Modified: Thu Jul 23 17:39:24 EDT 1998
>Originator: Robert A Basch
>Organization:

MIT Information Systems
Show quoted text
>Release: 1.0pl1
>Environment:

System: IRIX burn 6.2 03131015 IP22
(Athena workstation)

Show quoted text
>Description:

This problem was seen on an SGI Indy Athena workstation running
Irix 6.2. When you exit the window system and do a console login,
any such login except the first fails to acquire the controlling tty
(/dev/tport), giving the error:

login.krb5: tcsetpgrp: Inappropriate I/O control operation

As a result, job control, command-line editing, etc., do not
work.

Show quoted text
>How-To-Repeat:

Do a console login on Irix 6.2. (Works fine, if the first one since
reboot). Logout. Do another console login -- the tcsetpgrp() fails.

Show quoted text
>Fix:


The setpgrp() in login.c/dofork() seems to trigger the problem; and,
since there should be no need to do both setsid() and setpgrp(), the
simple workaround/fix is not to perform the setpgrp() if setsid() is
available. The following patch against the krb5 in the athena source
tree demonstrates:

Index: login.c
===================================================================
RCS file: /afs/dev.mit.edu/source/repository/third/krb5/src/appl/bsd/login.c,v
retrieving revision 1.17
diff -c -r1.17 login.c
*** login.c 1998/04/29 13:50:33 1.17
--- login.c 1998/05/04 19:49:46
***************
*** 2484,2494 ****
#endif /* __linux__ */
#ifdef HAVE_SETSID
(void)setsid();
! #endif
#ifdef SETPGRP_TWOARG
(void)setpgrp(0, 0);
#else
(void)setpgrp();
#endif
}

--- 2484,2495 ----
#endif /* __linux__ */
#ifdef HAVE_SETSID
(void)setsid();
! #else
#ifdef SETPGRP_TWOARG
(void)setpgrp(0, 0);
#else
(void)setpgrp();
+ #endif
#endif
}

Show quoted text
>Audit-Trail:

Responsible-Changed-From-To: gnats-admin->tlyu
Responsible-Changed-By: tlyu
Responsible-Changed-When: Thu Jul 23 17:38:10 1998
Responsible-Changed-Why:

refiled

Show quoted text
>Unformatted:
no
login.krb5: don't do both setsid() and setpgrp()
non-critical
medium
krb5-appl
sw-bug
From: tlyu@mit.edu
Subject: CVS Commit
* login.c (dofork): Don't dissociate from controlling tty in the
parent, since the parent needs to remain the session leader so it
can tell when the tty gets hung up. Make the child wait for the
parent to set up a SIGHUP handler to ensure that cleanup happens
properly.


To generate a diff of this commit:



cvs diff -r5.371 -r5.372 krb5/src/appl/bsd/ChangeLog
cvs diff -r5.100 -r5.101 krb5/src/appl/bsd/login.c