Set tty ownership on pty open (temporary until devfs is integrated)
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 15 Jun 2009 21:50:06 +0000 (14:50 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 15 Jun 2009 21:50:06 +0000 (14:50 -0700)
commitcd65363eb9593c640d85e4915d214051aa5bc5f2
tree410878d1cad72b8f55a44e4aeb9ade967b7ce286
parent8733fe6f9960d8e450a4c5ad71dd529990436c01
Set tty ownership on pty open (temporary until devfs is integrated)

Fix a very long standing issue when opening new pty's as non-root.  The
related tty could not be chowned/chmoded in that case, giving any user
in the system access to the pty.

This would not effect programs like sshd which set up the pty as root, but
it did effect programs like xterm which do not run suid-root.

This is strictly a temporary fix until devfs can be integrated into the
system.  Basically we allow the uid stored in the cdev_t structure to
override the uid returned by VOP_GETATTR for VCHR devices, and the chmod
helper function checks the uid stored in the cdev_t structure for
compatibility.

Reported-by: Hasso Tepper <hasso@estpak.ee>, Numerous others
sys/kern/kern_conf.c
sys/kern/tty_pty.c
sys/kern/vfs_helper.c
sys/sys/conf.h
sys/vfs/hammer/hammer_vnops.c
sys/vfs/specfs/spec_vnops.c
sys/vfs/ufs/ufs_vnops.c