Subject: Re: tty allocation
To: None <tech-kern@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 04/26/2002 17:47:43
On Fri, Apr 26, 2002 at 11:35:21AM -0400, Thor Lancelot Simon wrote:
> 
> Indeed, the standard requires that you call grantpt(), which has a
> totally broken and stupid interface: because most systems have grantpt()
> actually fork and exec a setuid program that does a chown, and some bozo
> doing some commercial implementation long ago didn't know how to handle
> child processes without using SIGCHLD, the standard explicitly allows
> grantpt() to not work if your program happens to have a SIGCHLD handler.

I suspect that this was done (like many other things) to ensure
that their current system didn't violate the standard....

One problem that affects pty (and more seriously streams based
protocol stacks that convert the network device into a tty
device by pushing modules) is that the permissions are not
reset when the tty is closed.

(This allows users to add data to innapropriate network
connections, or - as actually happened - wall(1) to do so
since the utmp file locking was also broken!)

One solution is to use dynamic permissions for ALL tty devices.
- on SVR4/Solaris fattach will do this...
(a useful function missing from netBSD)

	David

-- 
David Laight: david@l8s.co.uk