diff options
author | phk <phk@FreeBSD.org> | 1999-01-30 12:17:38 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1999-01-30 12:17:38 +0000 |
commit | 67f187760e45386080ca97c6bc73608f9fe52ae5 (patch) | |
tree | 640104e6ae29a9d3ec3b379eab1297863b5d84c5 | |
parent | 6c80ae4325fb5d1cab94603607c94d646aee0d8e (diff) | |
download | FreeBSD-src-67f187760e45386080ca97c6bc73608f9fe52ae5.zip FreeBSD-src-67f187760e45386080ca97c6bc73608f9fe52ae5.tar.gz |
Use suser() to check for super user rather than examining cr_uid directly.
Use TTYDEF_SPEED rather than 9600 a couple of places.
Reviewed by: bde, with a few grumbles.
-rw-r--r-- | sys/alpha/alpha/promcons.c | 7 | ||||
-rw-r--r-- | sys/alpha/tlsb/zs_tlsb.c | 7 | ||||
-rw-r--r-- | sys/dev/cy/cy.c | 5 | ||||
-rw-r--r-- | sys/dev/cy/cy_isa.c | 5 | ||||
-rw-r--r-- | sys/dev/dgb/dgb.c | 5 | ||||
-rw-r--r-- | sys/dev/dgb/dgm.c | 5 | ||||
-rw-r--r-- | sys/dev/rc/rc.c | 3 | ||||
-rw-r--r-- | sys/dev/rp/rp.c | 3 | ||||
-rw-r--r-- | sys/dev/si/si.c | 5 | ||||
-rw-r--r-- | sys/dev/sio/sio.c | 5 | ||||
-rw-r--r-- | sys/dev/syscons/syscons.c | 4 | ||||
-rw-r--r-- | sys/gnu/i386/isa/dgb.c | 5 | ||||
-rw-r--r-- | sys/gnu/i386/isa/dgm.c | 5 | ||||
-rw-r--r-- | sys/i386/isa/cx.c | 2 | ||||
-rw-r--r-- | sys/i386/isa/cy.c | 5 | ||||
-rw-r--r-- | sys/i386/isa/istallion.c | 7 | ||||
-rw-r--r-- | sys/i386/isa/pcvt/pcvt_drv.c | 2 | ||||
-rw-r--r-- | sys/i386/isa/rc.c | 3 | ||||
-rw-r--r-- | sys/i386/isa/rp.c | 3 | ||||
-rw-r--r-- | sys/i386/isa/si.c | 5 | ||||
-rw-r--r-- | sys/i386/isa/sio.c | 5 | ||||
-rw-r--r-- | sys/i386/isa/stallion.c | 7 | ||||
-rw-r--r-- | sys/isa/sio.c | 5 | ||||
-rw-r--r-- | sys/kern/tty.c | 6 | ||||
-rw-r--r-- | sys/kern/tty_pty.c | 4 | ||||
-rw-r--r-- | sys/pc98/cbus/sio.c | 5 | ||||
-rw-r--r-- | sys/pc98/pc98/sio.c | 5 | ||||
-rw-r--r-- | sys/pc98/pc98/syscons.c | 4 |
28 files changed, 77 insertions, 55 deletions
diff --git a/sys/alpha/alpha/promcons.c b/sys/alpha/alpha/promcons.c index 9759a26..2a18646 100644 --- a/sys/alpha/alpha/promcons.c +++ b/sys/alpha/alpha/promcons.c @@ -1,4 +1,4 @@ -/* $Id: promcons.c,v 1.2 1998/07/05 11:59:44 dfr Exp $ */ +/* $Id: promcons.c,v 1.3 1998/07/12 16:15:02 dfr Exp $ */ /* $NetBSD: promcons.c,v 1.13 1998/03/21 22:52:59 mycroft Exp $ */ /* @@ -112,11 +112,12 @@ promopen(dev, flag, mode, p) tp->t_oflag = TTYDEF_OFLAG; tp->t_cflag = TTYDEF_CFLAG|CLOCAL; tp->t_lflag = TTYDEF_LFLAG; - tp->t_ispeed = tp->t_ospeed = 9600; + tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED; ttsetwater(tp); setuptimeout = 1; - } else if (tp->t_state&TS_XCLUDE && p->p_ucred->cr_uid != 0) { + } else if (tp->t_state & TS_XCLUDE && + suser(p->p_ucred, &p->p_acflag)) { splx(s); return EBUSY; } diff --git a/sys/alpha/tlsb/zs_tlsb.c b/sys/alpha/tlsb/zs_tlsb.c index e88b8b1..0bfa15d 100644 --- a/sys/alpha/tlsb/zs_tlsb.c +++ b/sys/alpha/tlsb/zs_tlsb.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: zs_tlsb.c,v 1.5 1998/07/31 09:20:01 dfr Exp $ + * $Id: zs_tlsb.c,v 1.6 1998/11/15 18:25:16 dfr Exp $ */ /* * This driver is a hopeless hack to get the SimOS console working. A real @@ -266,9 +266,10 @@ zsopen(dev_t dev, int flag, int mode, struct proc *p) tp->t_oflag = TTYDEF_OFLAG; tp->t_cflag = TTYDEF_CFLAG|CLOCAL; tp->t_lflag = TTYDEF_LFLAG; - tp->t_ispeed = tp->t_ospeed = 9600; + tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED; ttsetwater(tp); - } else if (tp->t_state&TS_XCLUDE && p->p_ucred->cr_uid != 0) { + } else if (tp->t_state & TS_XCLUDE && + suser(p->p_ucred, &p->p_acflag)) { splx(s); return EBUSY; } diff --git a/sys/dev/cy/cy.c b/sys/dev/cy/cy.c index e95d7e6..42f6794 100644 --- a/sys/dev/cy/cy.c +++ b/sys/dev/cy/cy.c @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cy.c,v 1.83 1999/01/08 19:17:46 bde Exp $ + * $Id: cy.c,v 1.84 1999/01/28 01:59:53 dillon Exp $ */ #include "opt_compat.h" @@ -728,7 +728,8 @@ open_top: goto open_top; } } - if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + if (tp->t_state & TS_XCLUDE && + suser(p->p_ucred, &p->p_acflag)) { error = EBUSY; goto out; } diff --git a/sys/dev/cy/cy_isa.c b/sys/dev/cy/cy_isa.c index e95d7e6..42f6794 100644 --- a/sys/dev/cy/cy_isa.c +++ b/sys/dev/cy/cy_isa.c @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cy.c,v 1.83 1999/01/08 19:17:46 bde Exp $ + * $Id: cy.c,v 1.84 1999/01/28 01:59:53 dillon Exp $ */ #include "opt_compat.h" @@ -728,7 +728,8 @@ open_top: goto open_top; } } - if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + if (tp->t_state & TS_XCLUDE && + suser(p->p_ucred, &p->p_acflag)) { error = EBUSY; goto out; } diff --git a/sys/dev/dgb/dgb.c b/sys/dev/dgb/dgb.c index 7aeb258..14211bc 100644 --- a/sys/dev/dgb/dgb.c +++ b/sys/dev/dgb/dgb.c @@ -1,5 +1,5 @@ /*- - * dgb.c $Id: dgb.c,v 1.40 1998/08/23 08:26:39 bde Exp $ + * dgb.c $Id: dgb.c,v 1.41 1998/12/07 21:58:17 archie Exp $ * * Digiboard driver. * @@ -1032,7 +1032,8 @@ open_top: goto open_top; } } - if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + if (tp->t_state & TS_XCLUDE && + suser(p->p_ucred, &p->p_acflag)) { error = EBUSY; goto out; } diff --git a/sys/dev/dgb/dgm.c b/sys/dev/dgb/dgm.c index 8b0ca1f..9321bb9 100644 --- a/sys/dev/dgb/dgm.c +++ b/sys/dev/dgb/dgm.c @@ -1,5 +1,5 @@ /*- - * $Id: dgm.c,v 1.5 1998/08/23 08:26:40 bde Exp $ + * $Id: dgm.c,v 1.6 1998/12/07 21:58:18 archie Exp $ * * This driver and the associated header files support the ISA PC/Xem * Digiboards. Its evolutionary roots are described below. @@ -833,7 +833,8 @@ open_top: goto open_top; } } - if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + if (tp->t_state & TS_XCLUDE && + suser(p->p_ucred, &p->p_acflag)) { error = EBUSY; goto out; } diff --git a/sys/dev/rc/rc.c b/sys/dev/rc/rc.c index ae1108a..a5d96ec 100644 --- a/sys/dev/rc/rc.c +++ b/sys/dev/rc/rc.c @@ -766,7 +766,8 @@ again: goto again; } } - if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + if (tp->t_state & TS_XCLUDE && + suser(p->p_ucred, &p->p_acflag)) { error = EBUSY; goto out; } diff --git a/sys/dev/rp/rp.c b/sys/dev/rp/rp.c index 28acaee..3ac4ee9 100644 --- a/sys/dev/rp/rp.c +++ b/sys/dev/rp/rp.c @@ -1346,7 +1346,8 @@ open_top: goto open_top; } } - if(tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + if(tp->t_state & TS_XCLUDE && + suser(p->p_ucred, &p->p_acflag)) { splx(oldspl); return(EBUSY); } diff --git a/sys/dev/si/si.c b/sys/dev/si/si.c index 230e387..95a4e049 100644 --- a/sys/dev/si/si.c +++ b/sys/dev/si/si.c @@ -30,7 +30,7 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN * NO EVENT SHALL THE AUTHORS BE LIABLE. * - * $Id: si.c,v 1.77 1998/08/23 10:12:12 bde Exp $ + * $Id: si.c,v 1.78 1999/01/12 00:36:35 eivind Exp $ */ #ifndef lint @@ -1205,7 +1205,8 @@ open_top: goto open_top; } } - if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + if (tp->t_state & TS_XCLUDE && + suser(p->p_ucred, &p->p_acflag)) { DPRINT((pp, DBG_OPEN|DBG_FAIL, "already open and EXCLUSIVE set\n")); error = EBUSY; diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 6a2084e..ee031b4 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sio.c,v 1.219 1998/12/13 23:12:54 steve Exp $ + * $Id: sio.c,v 1.220 1999/01/19 00:21:47 peter Exp $ * from: @(#)com.c 7.5 (Berkeley) 5/16/91 * from: i386/isa sio.c,v 1.215 */ @@ -1205,7 +1205,8 @@ open_top: goto open_top; } } - if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + if (tp->t_state & TS_XCLUDE && + suser(p->p_ucred, &p->p_acflag)) { error = EBUSY; goto out; } diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index 18d376c..ebe15a0 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.295 1999/01/28 01:59:48 dillon Exp $ + * $Id: syscons.c,v 1.296 1999/01/28 17:31:58 dillon Exp $ */ #include "sc.h" @@ -707,7 +707,7 @@ scopen(dev_t dev, int flag, int mode, struct proc *p) mouse_level = 0; /* XXX */ } else - if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) + if (tp->t_state & TS_XCLUDE && suser(p->p_ucred, &p->p_acflag)) return(EBUSY); if (minor(dev) < MAXCONS && !console[minor(dev)]) { console[minor(dev)] = alloc_scp(); diff --git a/sys/gnu/i386/isa/dgb.c b/sys/gnu/i386/isa/dgb.c index 7aeb258..14211bc 100644 --- a/sys/gnu/i386/isa/dgb.c +++ b/sys/gnu/i386/isa/dgb.c @@ -1,5 +1,5 @@ /*- - * dgb.c $Id: dgb.c,v 1.40 1998/08/23 08:26:39 bde Exp $ + * dgb.c $Id: dgb.c,v 1.41 1998/12/07 21:58:17 archie Exp $ * * Digiboard driver. * @@ -1032,7 +1032,8 @@ open_top: goto open_top; } } - if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + if (tp->t_state & TS_XCLUDE && + suser(p->p_ucred, &p->p_acflag)) { error = EBUSY; goto out; } diff --git a/sys/gnu/i386/isa/dgm.c b/sys/gnu/i386/isa/dgm.c index 8b0ca1f..9321bb9 100644 --- a/sys/gnu/i386/isa/dgm.c +++ b/sys/gnu/i386/isa/dgm.c @@ -1,5 +1,5 @@ /*- - * $Id: dgm.c,v 1.5 1998/08/23 08:26:40 bde Exp $ + * $Id: dgm.c,v 1.6 1998/12/07 21:58:18 archie Exp $ * * This driver and the associated header files support the ISA PC/Xem * Digiboards. Its evolutionary roots are described below. @@ -833,7 +833,8 @@ open_top: goto open_top; } } - if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + if (tp->t_state & TS_XCLUDE && + suser(p->p_ucred, &p->p_acflag)) { error = EBUSY; goto out; } diff --git a/sys/i386/isa/cx.c b/sys/i386/isa/cx.c index 9b00dab..4efdb50 100644 --- a/sys/i386/isa/cx.c +++ b/sys/i386/isa/cx.c @@ -153,7 +153,7 @@ int cxopen (dev_t dev, int flag, int mode, struct proc *p) tp = c->ttyp; tp->t_dev = dev; if ((tp->t_state & TS_ISOPEN) && (tp->t_state & TS_XCLUDE) && - p->p_ucred->cr_uid != 0) + suser(p->p_ucred, &p->p_acflag)) return (EBUSY); if (! (tp->t_state & TS_ISOPEN)) { ttychars (tp); diff --git a/sys/i386/isa/cy.c b/sys/i386/isa/cy.c index e95d7e6..42f6794 100644 --- a/sys/i386/isa/cy.c +++ b/sys/i386/isa/cy.c @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cy.c,v 1.83 1999/01/08 19:17:46 bde Exp $ + * $Id: cy.c,v 1.84 1999/01/28 01:59:53 dillon Exp $ */ #include "opt_compat.h" @@ -728,7 +728,8 @@ open_top: goto open_top; } } - if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + if (tp->t_state & TS_XCLUDE && + suser(p->p_ucred, &p->p_acflag)) { error = EBUSY; goto out; } diff --git a/sys/i386/isa/istallion.c b/sys/i386/isa/istallion.c index 51db908..e4040f7 100644 --- a/sys/i386/isa/istallion.c +++ b/sys/i386/isa/istallion.c @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: istallion.c,v 1.22 1998/08/23 09:57:09 bde Exp $ + * $Id: istallion.c,v 1.23 1999/01/12 01:17:01 eivind Exp $ */ /*****************************************************************************/ @@ -129,7 +129,7 @@ #define STL_MEMDEV 0x07000000 -#define STL_DEFSPEED 9600 +#define STL_DEFSPEED TTYDEF_SPEED #define STL_DEFCFLAG (CS8 | CREAD | HUPCL) /*****************************************************************************/ @@ -1009,7 +1009,8 @@ stliopen_restart: goto stliopen_restart; } } - if ((tp->t_state & TS_XCLUDE) && (p->p_ucred->cr_uid != 0)) { + if ((tp->t_state & TS_XCLUDE) && + suser(p->p_ucred, &p->p_acflag)) { error = EBUSY; goto stliopen_end; } diff --git a/sys/i386/isa/pcvt/pcvt_drv.c b/sys/i386/isa/pcvt/pcvt_drv.c index cb557e1..affe955 100644 --- a/sys/i386/isa/pcvt/pcvt_drv.c +++ b/sys/i386/isa/pcvt/pcvt_drv.c @@ -517,7 +517,7 @@ pcopen(Dev_t dev, int flag, int mode, struct proc *p) (*linesw[tp->t_line].l_modem)(tp, 1); /* fake connection */ winsz = 1; /* set winsize later */ } - else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) + else if (tp->t_state & TS_XCLUDE && suser(p->p_ucred, &p->p_acflag)) return (EBUSY); #if PCVT_NETBSD || (PCVT_FREEBSD >= 200) diff --git a/sys/i386/isa/rc.c b/sys/i386/isa/rc.c index ae1108a..a5d96ec 100644 --- a/sys/i386/isa/rc.c +++ b/sys/i386/isa/rc.c @@ -766,7 +766,8 @@ again: goto again; } } - if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + if (tp->t_state & TS_XCLUDE && + suser(p->p_ucred, &p->p_acflag)) { error = EBUSY; goto out; } diff --git a/sys/i386/isa/rp.c b/sys/i386/isa/rp.c index 28acaee..3ac4ee9 100644 --- a/sys/i386/isa/rp.c +++ b/sys/i386/isa/rp.c @@ -1346,7 +1346,8 @@ open_top: goto open_top; } } - if(tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + if(tp->t_state & TS_XCLUDE && + suser(p->p_ucred, &p->p_acflag)) { splx(oldspl); return(EBUSY); } diff --git a/sys/i386/isa/si.c b/sys/i386/isa/si.c index 230e387..95a4e049 100644 --- a/sys/i386/isa/si.c +++ b/sys/i386/isa/si.c @@ -30,7 +30,7 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN * NO EVENT SHALL THE AUTHORS BE LIABLE. * - * $Id: si.c,v 1.77 1998/08/23 10:12:12 bde Exp $ + * $Id: si.c,v 1.78 1999/01/12 00:36:35 eivind Exp $ */ #ifndef lint @@ -1205,7 +1205,8 @@ open_top: goto open_top; } } - if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + if (tp->t_state & TS_XCLUDE && + suser(p->p_ucred, &p->p_acflag)) { DPRINT((pp, DBG_OPEN|DBG_FAIL, "already open and EXCLUSIVE set\n")); error = EBUSY; diff --git a/sys/i386/isa/sio.c b/sys/i386/isa/sio.c index 995d8a8..0738e41 100644 --- a/sys/i386/isa/sio.c +++ b/sys/i386/isa/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.224 1999/01/19 00:21:41 peter Exp $ + * $Id: sio.c,v 1.225 1999/01/26 04:02:54 steve Exp $ */ #include "opt_comconsole.h" @@ -1154,7 +1154,8 @@ open_top: goto open_top; } } - if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + if (tp->t_state & TS_XCLUDE && + suser(p->p_ucred, &p->p_acflag)) { error = EBUSY; goto out; } diff --git a/sys/i386/isa/stallion.c b/sys/i386/isa/stallion.c index e6697a1..cb55866 100644 --- a/sys/i386/isa/stallion.c +++ b/sys/i386/isa/stallion.c @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: stallion.c,v 1.23 1998/10/22 05:58:40 bde Exp $ + * $Id: stallion.c,v 1.24 1999/01/12 00:36:36 eivind Exp $ */ /*****************************************************************************/ @@ -119,7 +119,7 @@ static unsigned int stl_irqshared = 0; #define STL_MEMDEV 0x07000000 -#define STL_DEFSPEED 9600 +#define STL_DEFSPEED TTYDEF_SPEED #define STL_DEFCFLAG (CS8 | CREAD | HUPCL) /* @@ -825,7 +825,8 @@ stlopen_restart: goto stlopen_restart; } } - if ((tp->t_state & TS_XCLUDE) && (p->p_ucred->cr_uid != 0)) { + if ((tp->t_state & TS_XCLUDE) && + suser(p->p_ucred, &p->p_acflag)) { error = EBUSY; goto stlopen_end; } diff --git a/sys/isa/sio.c b/sys/isa/sio.c index 6a2084e..ee031b4 100644 --- a/sys/isa/sio.c +++ b/sys/isa/sio.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sio.c,v 1.219 1998/12/13 23:12:54 steve Exp $ + * $Id: sio.c,v 1.220 1999/01/19 00:21:47 peter Exp $ * from: @(#)com.c 7.5 (Berkeley) 5/16/91 * from: i386/isa sio.c,v 1.215 */ @@ -1205,7 +1205,8 @@ open_top: goto open_top; } } - if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + if (tp->t_state & TS_XCLUDE && + suser(p->p_ucred, &p->p_acflag)) { error = EBUSY; goto out; } diff --git a/sys/kern/tty.c b/sys/kern/tty.c index faa675e..592da5d 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)tty.c 8.8 (Berkeley) 1/21/94 - * $Id: tty.c,v 1.111 1999/01/08 17:31:12 eivind Exp $ + * $Id: tty.c,v 1.112 1999/01/28 17:32:00 dillon Exp $ */ /*- @@ -981,9 +981,9 @@ ttioctl(tp, cmd, data, flag) splx(s); break; case TIOCSTI: /* simulate terminal input */ - if (p->p_ucred->cr_uid && (flag & FREAD) == 0) + if ((flag & FREAD) == 0 && suser(p->p_ucred, &p->p_acflag)) return (EPERM); - if (p->p_ucred->cr_uid && !isctty(p, tp)) + if (!isctty(p, tp) && suser(p->p_ucred, &p->p_acflag)) return (EACCES); s = spltty(); (*linesw[tp->t_line].l_rint)(*(u_char *)data, tp); diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index 214f103..36afd3b 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)tty_pty.c 8.4 (Berkeley) 2/20/95 - * $Id: tty_pty.c,v 1.53 1998/07/15 12:18:30 bde Exp $ + * $Id: tty_pty.c,v 1.54 1998/08/23 08:26:42 bde Exp $ */ /* @@ -183,7 +183,7 @@ ptsopen(dev, flag, devtype, p) tp->t_lflag = TTYDEF_LFLAG; tp->t_cflag = TTYDEF_CFLAG; tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED; - } else if (tp->t_state&TS_XCLUDE && p->p_ucred->cr_uid != 0) + } else if (tp->t_state & TS_XCLUDE && suser(p->p_ucred, &p->p_acflag)) return (EBUSY); if (tp->t_oproc) /* Ctrlr still around. */ (void)(*linesw[tp->t_line].l_modem)(tp, 1); diff --git a/sys/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c index f271239..7c4ba4f 100644 --- a/sys/pc98/cbus/sio.c +++ b/sys/pc98/cbus/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.77 1999/01/27 08:26:16 kato Exp $ + * $Id: sio.c,v 1.78 1999/01/28 11:24:36 kato Exp $ */ #include "opt_comconsole.h" @@ -1912,7 +1912,8 @@ open_top: goto open_top; } } - if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + if (tp->t_state & TS_XCLUDE && + suser(p->p_ucred, &p->p_acflag)) { error = EBUSY; goto out; } diff --git a/sys/pc98/pc98/sio.c b/sys/pc98/pc98/sio.c index f271239..7c4ba4f 100644 --- a/sys/pc98/pc98/sio.c +++ b/sys/pc98/pc98/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.77 1999/01/27 08:26:16 kato Exp $ + * $Id: sio.c,v 1.78 1999/01/28 11:24:36 kato Exp $ */ #include "opt_comconsole.h" @@ -1912,7 +1912,8 @@ open_top: goto open_top; } } - if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + if (tp->t_state & TS_XCLUDE && + suser(p->p_ucred, &p->p_acflag)) { error = EBUSY; goto out; } diff --git a/sys/pc98/pc98/syscons.c b/sys/pc98/pc98/syscons.c index 97ac44c..4355e74 100644 --- a/sys/pc98/pc98/syscons.c +++ b/sys/pc98/pc98/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.109 1999/01/19 12:41:26 kato Exp $ + * $Id: syscons.c,v 1.110 1999/01/27 08:22:08 kato Exp $ */ #include "sc.h" @@ -753,7 +753,7 @@ scopen(dev_t dev, int flag, int mode, struct proc *p) } } else - if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) + if (tp->t_state & TS_XCLUDE && suser(p->p_ucred, &p->p_acflag)) return(EBUSY); if (minor(dev) < MAXCONS && !console[minor(dev)]) { console[minor(dev)] = alloc_scp(); |