diff options
Diffstat (limited to 'sys')
44 files changed, 91 insertions, 91 deletions
diff --git a/sys/arch/alpha/alpha/promcons.c b/sys/arch/alpha/alpha/promcons.c index 279cc3e0235..31a893c8775 100644 --- a/sys/arch/alpha/alpha/promcons.c +++ b/sys/arch/alpha/alpha/promcons.c @@ -1,4 +1,4 @@ -/* $OpenBSD: promcons.c,v 1.10 2009/10/31 06:40:14 deraadt Exp $ */ +/* $OpenBSD: promcons.c,v 1.11 2009/10/31 12:00:05 fgsch Exp $ */ /* $NetBSD: promcons.c,v 1.5 1996/11/13 22:20:55 cgd Exp $ */ /* @@ -93,7 +93,7 @@ promopen(dev, flag, mode, p) 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, 0) != 0) { splx(s); return EBUSY; } diff --git a/sys/arch/alpha/tc/scc.c b/sys/arch/alpha/tc/scc.c index 7ef8289c2a5..6977c5fb7f4 100644 --- a/sys/arch/alpha/tc/scc.c +++ b/sys/arch/alpha/tc/scc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scc.c,v 1.23 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: scc.c,v 1.24 2009/10/31 12:00:05 fgsch Exp $ */ /* $NetBSD: scc.c,v 1.58 2002/03/17 19:40:27 atatat Exp $ */ /* @@ -482,7 +482,7 @@ sccopen(dev, flag, mode, p) #endif (void) sccparam(tp, &tp->t_termios); ttsetwater(tp); - } else if ((tp->t_state & TS_XCLUDE) && curproc->p_ucred->cr_uid != 0) + } else if ((tp->t_state & TS_XCLUDE) && suser(curproc, 0) != 0) return (EBUSY); (void) sccmctl(sc, SCCLINE(dev), DML_DTR, DMSET); s = spltty(); diff --git a/sys/arch/aviion/dev/dart.c b/sys/arch/aviion/dev/dart.c index c30f7a712bc..6f8d3e275b5 100644 --- a/sys/arch/aviion/dev/dart.c +++ b/sys/arch/aviion/dev/dart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dart.c,v 1.5 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: dart.c,v 1.6 2009/10/31 12:00:05 fgsch Exp $ */ /* * Mach Operating System @@ -640,7 +640,7 @@ dartopen(dev_t dev, int flag, int mode, struct proc *p) (void)dartmctl(sc, port, TIOCM_DTR | TIOCM_RTS, DMSET); tp->t_state |= TS_CARR_ON; - } else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + } else if (tp->t_state & TS_XCLUDE && suser(p, 0) != 0) { splx(s); return (EBUSY); } diff --git a/sys/arch/hp300/dev/apci.c b/sys/arch/hp300/dev/apci.c index e565492500b..3f20e998d3b 100644 --- a/sys/arch/hp300/dev/apci.c +++ b/sys/arch/hp300/dev/apci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apci.c,v 1.34 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: apci.c,v 1.35 2009/10/31 12:00:05 fgsch Exp $ */ /* $NetBSD: apci.c,v 1.9 2000/11/02 00:35:05 eeh Exp $ */ /*- @@ -316,7 +316,7 @@ apciopen(dev, flag, mode, p) /* Flush any pending I/O. */ while ((apci->ap_iir & IIR_IMASK) == IIR_RXRDY) code = apci->ap_data; - } else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) + } else if (tp->t_state & TS_XCLUDE && suser(p, 0) != 0) return (EBUSY); else s = spltty(); diff --git a/sys/arch/hp300/dev/dca.c b/sys/arch/hp300/dev/dca.c index 235cd401ef2..5e32b238f8d 100644 --- a/sys/arch/hp300/dev/dca.c +++ b/sys/arch/hp300/dev/dca.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dca.c,v 1.35 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: dca.c,v 1.36 2009/10/31 12:00:05 fgsch Exp $ */ /* $NetBSD: dca.c,v 1.35 1997/05/05 20:58:18 thorpej Exp $ */ /* @@ -349,7 +349,7 @@ dcaopen(dev, flag, mode, p) while ((dca->dca_iir & IIR_IMASK) == IIR_RXRDY) code = dca->dca_data; - } else if (tp->t_state&TS_XCLUDE && p->p_ucred->cr_uid != 0) + } else if (tp->t_state&TS_XCLUDE && suser(p, 0) != 0) return (EBUSY); else s = spltty(); diff --git a/sys/arch/hp300/dev/dcm.c b/sys/arch/hp300/dev/dcm.c index 07f1c5c836c..faecb73e73e 100644 --- a/sys/arch/hp300/dev/dcm.c +++ b/sys/arch/hp300/dev/dcm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dcm.c,v 1.30 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: dcm.c,v 1.31 2009/10/31 12:00:05 fgsch Exp $ */ /* $NetBSD: dcm.c,v 1.41 1997/05/05 20:59:16 thorpej Exp $ */ /* @@ -482,7 +482,7 @@ dcmopen(dev, flag, mode, p) (void) dcmparam(tp, &tp->t_termios); ttsetwater(tp); - } else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) + } else if (tp->t_state & TS_XCLUDE && suser(p, 0) != 0) return (EBUSY); else s = spltty(); diff --git a/sys/arch/hppa/dev/pdc.c b/sys/arch/hppa/dev/pdc.c index 4e6a25d13ad..9daed05a401 100644 --- a/sys/arch/hppa/dev/pdc.c +++ b/sys/arch/hppa/dev/pdc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pdc.c,v 1.32 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: pdc.c,v 1.33 2009/10/31 12:00:05 fgsch Exp $ */ /* * Copyright (c) 1998-2003 Michael Shalayeff @@ -224,7 +224,7 @@ pdcopen(dev, flag, mode, p) 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, 0) != 0) { splx(s); return (EBUSY); } diff --git a/sys/arch/hppa64/dev/pdc.c b/sys/arch/hppa64/dev/pdc.c index 5efb3d65068..8c10c580742 100644 --- a/sys/arch/hppa64/dev/pdc.c +++ b/sys/arch/hppa64/dev/pdc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pdc.c,v 1.4 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: pdc.c,v 1.5 2009/10/31 12:00:05 fgsch Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -214,7 +214,7 @@ pdcopen(dev, flag, mode, p) 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, 0) != 0) { splx(s); return (EBUSY); } diff --git a/sys/arch/luna88k/dev/siotty.c b/sys/arch/luna88k/dev/siotty.c index 69c593b884a..7880b7f5466 100644 --- a/sys/arch/luna88k/dev/siotty.c +++ b/sys/arch/luna88k/dev/siotty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: siotty.c,v 1.8 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: siotty.c,v 1.9 2009/10/31 12:00:05 fgsch Exp $ */ /* $NetBSD: siotty.c,v 1.9 2002/03/17 19:40:43 atatat Exp $ */ /*- @@ -363,7 +363,7 @@ sioopen(dev, flag, mode, p) tp = sc->sc_tty = ttymalloc(); } else if ((tp->t_state & TS_ISOPEN) && (tp->t_state & TS_XCLUDE) - && p->p_ucred->cr_uid != 0) + && suser(p, 0) != 0) return EBUSY; tp->t_oproc = siostart; diff --git a/sys/arch/mac68k/dev/z8530tty.c b/sys/arch/mac68k/dev/z8530tty.c index 5dd8a005625..aaeae9f1adf 100644 --- a/sys/arch/mac68k/dev/z8530tty.c +++ b/sys/arch/mac68k/dev/z8530tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: z8530tty.c,v 1.19 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: z8530tty.c,v 1.20 2009/10/31 12:00:05 fgsch Exp $ */ /* $NetBSD: z8530tty.c,v 1.14 1996/12/17 20:42:43 gwr Exp $ */ /* @@ -346,7 +346,7 @@ zsopen(dev, flags, mode, p) /* It's simpler to do this up here. */ if (((tp->t_state & (TS_ISOPEN | TS_XCLUDE)) == (TS_ISOPEN | TS_XCLUDE)) - && (p->p_ucred->cr_uid != 0) ) + && (suser(p, 0) != 0) ) { return (EBUSY); } diff --git a/sys/arch/macppc/dev/z8530tty.c b/sys/arch/macppc/dev/z8530tty.c index 69ef381bcd5..ba510eed0ef 100644 --- a/sys/arch/macppc/dev/z8530tty.c +++ b/sys/arch/macppc/dev/z8530tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: z8530tty.c,v 1.9 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: z8530tty.c,v 1.10 2009/10/31 12:00:06 fgsch Exp $ */ /* $NetBSD: z8530tty.c,v 1.13 1996/10/16 20:42:14 gwr Exp $ */ /*- @@ -506,7 +506,7 @@ zsopen(dev_t dev, int flags, int mode, struct proc *p) if (ISSET(tp->t_state, TS_ISOPEN) && ISSET(tp->t_state, TS_XCLUDE) && - p->p_ucred->cr_uid != 0) + suser(p, 0) != 0) return (EBUSY); s = spltty(); diff --git a/sys/arch/mvme68k/dev/cl.c b/sys/arch/mvme68k/dev/cl.c index 4c53576b10f..015e1d454b9 100644 --- a/sys/arch/mvme68k/dev/cl.c +++ b/sys/arch/mvme68k/dev/cl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cl.c,v 1.48 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: cl.c,v 1.49 2009/10/31 12:00:06 fgsch Exp $ */ /* * Copyright (c) 1995 Dale Rahn. All rights reserved. @@ -650,7 +650,7 @@ if (channel == 2) { /* test one channel now */ #endif /* CL_DMA_WORKS */ sc->cl_reg->cl_car = save; } - } else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + } else if (tp->t_state & TS_XCLUDE && suser(p, 0) != 0) { splx(s); return(EBUSY); } diff --git a/sys/arch/mvme68k/dev/dart.c b/sys/arch/mvme68k/dev/dart.c index 73e33a83450..ef1bf842934 100644 --- a/sys/arch/mvme68k/dev/dart.c +++ b/sys/arch/mvme68k/dev/dart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dart.c,v 1.3 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: dart.c,v 1.4 2009/10/31 12:00:07 fgsch Exp $ */ /* * Mach Operating System @@ -655,7 +655,7 @@ dartopen(dev_t dev, int flag, int mode, struct proc *p) (void)dartmctl(sc, port, TIOCM_DTR | TIOCM_RTS, DMSET); tp->t_state |= TS_CARR_ON; - } else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + } else if (tp->t_state & TS_XCLUDE && suser(p, 0) != 0) { splx(s); return (EBUSY); } diff --git a/sys/arch/mvme68k/dev/wl.c b/sys/arch/mvme68k/dev/wl.c index 7a000e827b1..684f2416541 100644 --- a/sys/arch/mvme68k/dev/wl.c +++ b/sys/arch/mvme68k/dev/wl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wl.c,v 1.19 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: wl.c,v 1.20 2009/10/31 12:00:07 fgsch Exp $ */ /* * Copyright (c) 1995 Dale Rahn. All rights reserved. @@ -558,7 +558,7 @@ wlopen(dev, flag, mode, p) sc->cl_reg->cl_ier = IER_MDM | IER_RXD; sc->cl_reg->cl_car = save; } - } else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + } else if (tp->t_state & TS_XCLUDE && suser(p, 0) != 0) { splx(s); return(EBUSY); } diff --git a/sys/arch/mvme68k/dev/zs.c b/sys/arch/mvme68k/dev/zs.c index 3d37b2e98d7..25dd8368c64 100644 --- a/sys/arch/mvme68k/dev/zs.c +++ b/sys/arch/mvme68k/dev/zs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zs.c,v 1.28 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: zs.c,v 1.29 2009/10/31 12:00:07 fgsch Exp $ */ /* * Copyright (c) 2000 Steve Murphree, Jr. @@ -365,7 +365,7 @@ zsopen(dev, flag, mode, p) zs_init(zp); if ((zp->modem_state & SCC_DCD) != 0) tp->t_state |= TS_CARR_ON; - } else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) + } else if (tp->t_state & TS_XCLUDE && suser(p, 0) != 0) return (EBUSY); error = ((*linesw[tp->t_line].l_open) (dev, tp)); diff --git a/sys/arch/mvme88k/dev/cl.c b/sys/arch/mvme88k/dev/cl.c index 5b7a1c0adc0..d20edb82fa1 100644 --- a/sys/arch/mvme88k/dev/cl.c +++ b/sys/arch/mvme88k/dev/cl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cl.c,v 1.55 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: cl.c,v 1.56 2009/10/31 12:00:07 fgsch Exp $ */ /* * Copyright (c) 1995 Dale Rahn. All rights reserved. @@ -600,7 +600,7 @@ clopen(dev, flag, mode, p) bus_space_write_1(sc->sc_iot, sc->sc_ioh, CL_CAR, save); } - } else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + } else if (tp->t_state & TS_XCLUDE && suser(p, 0) != 0) { splx(s); return EBUSY; } diff --git a/sys/arch/mvme88k/dev/dart.c b/sys/arch/mvme88k/dev/dart.c index 32a3f6e3d42..ac4cc5e03b7 100644 --- a/sys/arch/mvme88k/dev/dart.c +++ b/sys/arch/mvme88k/dev/dart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dart.c,v 1.52 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: dart.c,v 1.53 2009/10/31 12:00:07 fgsch Exp $ */ /* * Mach Operating System @@ -665,7 +665,7 @@ dartopen(dev_t dev, int flag, int mode, struct proc *p) ttsetwater(tp); (void)dartmctl(dev, TIOCM_DTR | TIOCM_RTS, DMSET); tp->t_state |= TS_CARR_ON; - } else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + } else if (tp->t_state & TS_XCLUDE && suser(p, 0) != 0) { splx(s); return (EBUSY); } diff --git a/sys/arch/mvme88k/dev/vx.c b/sys/arch/mvme88k/dev/vx.c index c39b0717d30..b63546b3697 100644 --- a/sys/arch/mvme88k/dev/vx.c +++ b/sys/arch/mvme88k/dev/vx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vx.c,v 1.39 2008/09/23 04:44:31 miod Exp $ */ +/* $OpenBSD: vx.c,v 1.40 2009/10/31 12:00:07 fgsch Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. * All rights reserved. @@ -463,7 +463,7 @@ vxopen(dev_t dev, int flag, int mode, struct proc *p) (void)vx_mctl(dev, TIOCM_DTR | TIOCM_RTS, DMSET); tp->t_state |= TS_CARR_ON; - } else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + } else if (tp->t_state & TS_XCLUDE && suser(p, 0) != 0) { splx(s); return (EBUSY); } diff --git a/sys/arch/mvmeppc/dev/bugtty.c b/sys/arch/mvmeppc/dev/bugtty.c index a66233cd135..2a6c5ffc7b1 100644 --- a/sys/arch/mvmeppc/dev/bugtty.c +++ b/sys/arch/mvmeppc/dev/bugtty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bugtty.c,v 1.11 2008/01/23 16:37:57 jsing Exp $ */ +/* $OpenBSD: bugtty.c,v 1.12 2009/10/31 12:00:07 fgsch Exp $ */ /* Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1995 Dale Rahn. @@ -207,7 +207,7 @@ bugttyopen(dev, flag, mode, p) tp->t_state &= ~TS_CARR_ON; */ tp->t_state |= TS_CARR_ON; - } else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + } else if (tp->t_state & TS_XCLUDE && suser(p, 0) != 0) { splx(s); return (EBUSY); } diff --git a/sys/arch/sh/dev/scif.c b/sys/arch/sh/dev/scif.c index c2037d934d4..942f5918d0a 100644 --- a/sys/arch/sh/dev/scif.c +++ b/sys/arch/sh/dev/scif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scif.c,v 1.8 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: scif.c,v 1.9 2009/10/31 12:00:07 fgsch Exp $ */ /* $NetBSD: scif.c,v 1.47 2006/07/23 22:06:06 ad Exp $ */ /*- @@ -698,7 +698,7 @@ scifopen(dev_t dev, int flag, int mode, struct proc *p) if (ISSET(tp->t_state, TS_ISOPEN) && ISSET(tp->t_state, TS_XCLUDE) && - p->p_ucred->cr_uid != 0) + suser(p, 0) != 0) return (EBUSY); s = spltty(); diff --git a/sys/arch/sparc/dev/magma.c b/sys/arch/sparc/dev/magma.c index 18dbf2179fd..2936c0a6c75 100644 --- a/sys/arch/sparc/dev/magma.c +++ b/sys/arch/sparc/dev/magma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: magma.c,v 1.22 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: magma.c,v 1.23 2009/10/31 12:00:07 fgsch Exp $ */ /*- * Copyright (c) 1998 Iain Hibbert @@ -953,7 +953,7 @@ mttyopen(dev, flags, mode, p) SET(tp->t_state, TS_CARR_ON); else CLR(tp->t_state, TS_CARR_ON); - } else if (ISSET(tp->t_state, TS_XCLUDE) && p->p_ucred->cr_uid != 0) { + } else if (ISSET(tp->t_state, TS_XCLUDE) && suser(p, 0) != 0) { return (EBUSY); /* superuser can break exclusive access */ } else { s = spltty(); diff --git a/sys/arch/sparc/dev/spif.c b/sys/arch/sparc/dev/spif.c index 2df4e24a932..bbbb914ef1d 100644 --- a/sys/arch/sparc/dev/spif.c +++ b/sys/arch/sparc/dev/spif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spif.c,v 1.22 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: spif.c,v 1.23 2009/10/31 12:00:07 fgsch Exp $ */ /* * Copyright (c) 1999 Jason L. Wright (jason@thought.net) @@ -321,7 +321,7 @@ sttyopen(dev, flags, mode, p) else CLR(tp->t_state, TS_CARR_ON); } - else if (ISSET(tp->t_state, TS_XCLUDE) && p->p_ucred->cr_uid != 0) { + else if (ISSET(tp->t_state, TS_XCLUDE) && suser(p, 0) != 0) { return (EBUSY); } else { s = spltty(); diff --git a/sys/arch/sparc/dev/z8530tty.c b/sys/arch/sparc/dev/z8530tty.c index 7ab3048b71e..e247826b368 100644 --- a/sys/arch/sparc/dev/z8530tty.c +++ b/sys/arch/sparc/dev/z8530tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: z8530tty.c,v 1.11 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: z8530tty.c,v 1.12 2009/10/31 12:00:07 fgsch Exp $ */ /* $NetBSD: z8530tty.c,v 1.13 1996/10/16 20:42:14 gwr Exp $ */ /*- @@ -511,7 +511,7 @@ zsopen(dev, flags, mode, p) if (ISSET(tp->t_state, TS_ISOPEN) && ISSET(tp->t_state, TS_XCLUDE) && - p->p_ucred->cr_uid != 0) + suser(p, 0) != 0) return (EBUSY); s = spltty(); diff --git a/sys/arch/sparc64/dev/z8530tty.c b/sys/arch/sparc64/dev/z8530tty.c index c1312a6b23b..bb64f14c480 100644 --- a/sys/arch/sparc64/dev/z8530tty.c +++ b/sys/arch/sparc64/dev/z8530tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: z8530tty.c,v 1.16 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: z8530tty.c,v 1.17 2009/10/31 12:00:07 fgsch Exp $ */ /* $NetBSD: z8530tty.c,v 1.77 2001/05/30 15:24:24 lukem Exp $ */ /*- @@ -500,7 +500,7 @@ zsopen(dev, flags, mode, p) if (ISSET(tp->t_state, TS_ISOPEN) && ISSET(tp->t_state, TS_XCLUDE) && - p->p_ucred->cr_uid != 0) + suser(p, 0) != 0) return (EBUSY); s = spltty(); diff --git a/sys/arch/vax/qbus/dhu.c b/sys/arch/vax/qbus/dhu.c index cbd8c52e7ef..afa56c64ae6 100644 --- a/sys/arch/vax/qbus/dhu.c +++ b/sys/arch/vax/qbus/dhu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhu.c,v 1.13 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: dhu.c,v 1.14 2009/10/31 12:00:07 fgsch Exp $ */ /* $NetBSD: dhu.c,v 1.19 2000/06/04 06:17:01 matt Exp $ */ /* * Copyright (c) 2003, Hugh Graham. @@ -438,7 +438,7 @@ dhuopen(dev, flag, mode, p) } (void) dhuparam(tp, &tp->t_termios); ttsetwater(tp); - } else if ((tp->t_state & TS_XCLUDE) && curproc->p_ucred->cr_uid != 0) + } else if ((tp->t_state & TS_XCLUDE) && suser(curproc, 0) != 0) return (EBUSY); /* Use DMBIS and *not* DMSET or else we clobber incoming bits */ if (dhumctl(sc, line, DML_DTR|DML_RTS, DMBIS) & DML_DCD) diff --git a/sys/arch/vax/qbus/dl.c b/sys/arch/vax/qbus/dl.c index 483fe9559af..32b1eeff260 100644 --- a/sys/arch/vax/qbus/dl.c +++ b/sys/arch/vax/qbus/dl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dl.c,v 1.7 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: dl.c,v 1.8 2009/10/31 12:00:07 fgsch Exp $ */ /* $NetBSD: dl.c,v 1.11 2000/01/24 02:40:29 matt Exp $ */ /*- @@ -309,7 +309,7 @@ dlopen(dev, flag, mode, p) dlparam(tp, &tp->t_termios); ttsetwater(tp); - } else if ((tp->t_state & TS_XCLUDE) && p->p_ucred->cr_uid != 0) + } else if ((tp->t_state & TS_XCLUDE) && suser(p, 0) != 0) return EBUSY; return ((*linesw[tp->t_line].l_open)(dev, tp)); diff --git a/sys/arch/vax/qbus/dz.c b/sys/arch/vax/qbus/dz.c index ba42e67dab8..25afdf55945 100644 --- a/sys/arch/vax/qbus/dz.c +++ b/sys/arch/vax/qbus/dz.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dz.c,v 1.18 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: dz.c,v 1.19 2009/10/31 12:00:07 fgsch Exp $ */ /* $NetBSD: dz.c,v 1.23 2000/06/04 02:14:12 matt Exp $ */ /* * Copyright (c) 1996 Ken C. Wellsch. All rights reserved. @@ -300,7 +300,7 @@ dzopen(dev_t dev, int flag, int mode, struct proc *p) } (void) dzparam(tp, &tp->t_termios); ttsetwater(tp); - } else if ((tp->t_state & TS_XCLUDE) && p->p_ucred->cr_uid != 0) + } else if ((tp->t_state & TS_XCLUDE) && suser(p, 0) != 0) return (EBUSY); /* Use DMBIS and *not* DMSET or else we clobber incoming bits */ if (dzmctl(sc, line, DML_DTR, DMBIS) & DML_DCD) diff --git a/sys/arch/vax/vax/gencons.c b/sys/arch/vax/vax/gencons.c index a66f7740049..16406236692 100644 --- a/sys/arch/vax/vax/gencons.c +++ b/sys/arch/vax/vax/gencons.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gencons.c,v 1.19 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: gencons.c,v 1.20 2009/10/31 12:00:07 fgsch Exp $ */ /* $NetBSD: gencons.c,v 1.22 2000/01/24 02:40:33 matt Exp $ */ /* @@ -102,7 +102,7 @@ gencnopen(dev, flag, mode, p) tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED; gencnparam(tp, &tp->t_termios); ttsetwater(tp); - } else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) + } else if (tp->t_state & TS_XCLUDE && suser(p, 0) != 0) return EBUSY; tp->t_state |= TS_CARR_ON; if (unit == 0) diff --git a/sys/arch/vax/vxt/qsc.c b/sys/arch/vax/vxt/qsc.c index 3d932229682..4ee20efa57b 100644 --- a/sys/arch/vax/vxt/qsc.c +++ b/sys/arch/vax/vxt/qsc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qsc.c,v 1.3 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: qsc.c,v 1.4 2009/10/31 12:00:07 fgsch Exp $ */ /* * Copyright (c) 2006 Miodrag Vallat. * @@ -603,7 +603,7 @@ qscopen(dev_t dev, int flag, int mode, struct proc *p) ttsetwater(tp); tp->t_state |= TS_CARR_ON; - } else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + } else if (tp->t_state & TS_XCLUDE && suser(p, 0) != 0) { splx(s); return (EBUSY); } diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c index a247d866226..32fc4d2d8e7 100644 --- a/sys/dev/ic/com.c +++ b/sys/dev/ic/com.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com.c,v 1.133 2009/10/31 06:40:16 deraadt Exp $ */ +/* $OpenBSD: com.c,v 1.134 2009/10/31 12:00:07 fgsch Exp $ */ /* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */ /* @@ -431,7 +431,7 @@ comopen(dev_t dev, int flag, int mode, struct proc *p) #endif } #endif - } else if (ISSET(tp->t_state, TS_XCLUDE) && p->p_ucred->cr_uid != 0) + } else if (ISSET(tp->t_state, TS_XCLUDE) && suser(p, 0) != 0) return EBUSY; else s = spltty(); diff --git a/sys/dev/ic/cy.c b/sys/dev/ic/cy.c index 500019dc850..f4d331fae48 100644 --- a/sys/dev/ic/cy.c +++ b/sys/dev/ic/cy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cy.c,v 1.26 2009/10/31 06:40:17 deraadt Exp $ */ +/* $OpenBSD: cy.c,v 1.27 2009/10/31 12:00:07 fgsch Exp $ */ /* * Copyright (c) 1996 Timo Rossi. * All rights reserved. @@ -377,7 +377,7 @@ cyopen(dev, flag, mode, p) SET(tp->t_state, TS_CARR_ON); else CLR(tp->t_state, TS_CARR_ON); - } else if (ISSET(tp->t_state, TS_XCLUDE) && p->p_ucred->cr_uid != 0) { + } else if (ISSET(tp->t_state, TS_XCLUDE) && suser(p, 0) != 0) { return (EBUSY); } else { s = spltty(); diff --git a/sys/dev/ic/z8530tty.c b/sys/dev/ic/z8530tty.c index 9a516f1e43c..e2fbb2e9480 100644 --- a/sys/dev/ic/z8530tty.c +++ b/sys/dev/ic/z8530tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: z8530tty.c,v 1.18 2009/10/31 06:40:17 deraadt Exp $ */ +/* $OpenBSD: z8530tty.c,v 1.19 2009/10/31 12:00:08 fgsch Exp $ */ /* $NetBSD: z8530tty.c,v 1.13 1996/10/16 20:42:14 gwr Exp $ */ /* @@ -348,7 +348,7 @@ zsopen(dev, flags, mode, p) /* It's simpler to do this up here. */ if (((tp->t_state & (TS_ISOPEN | TS_XCLUDE)) == (TS_ISOPEN | TS_XCLUDE)) - && (p->p_ucred->cr_uid != 0) ) + && (suser(p, 0) != 0) ) { return (EBUSY); } diff --git a/sys/dev/pci/cz.c b/sys/dev/pci/cz.c index 91b151f68fb..63e01781cbf 100644 --- a/sys/dev/pci/cz.c +++ b/sys/dev/pci/cz.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cz.c,v 1.12 2009/10/31 06:40:17 deraadt Exp $ */ +/* $OpenBSD: cz.c,v 1.13 2009/10/31 12:00:08 fgsch Exp $ */ /* $NetBSD: cz.c,v 1.15 2001/01/20 19:10:36 thorpej Exp $ */ /*- @@ -964,7 +964,7 @@ czttyopen(dev_t dev, int flags, int mode, struct proc *p) if (ISSET(tp->t_state, TS_ISOPEN) && ISSET(tp->t_state, TS_XCLUDE) && - p->p_ucred->cr_uid != 0) + suser(p, 0) != 0) return (EBUSY); s = spltty(); diff --git a/sys/dev/sbus/magma.c b/sys/dev/sbus/magma.c index f79c7f8413d..50336f51d09 100644 --- a/sys/dev/sbus/magma.c +++ b/sys/dev/sbus/magma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: magma.c,v 1.18 2009/10/31 06:40:17 deraadt Exp $ */ +/* $OpenBSD: magma.c,v 1.19 2009/10/31 12:00:08 fgsch Exp $ */ /*- * Copyright (c) 1998 Iain Hibbert @@ -892,7 +892,7 @@ mttyopen(dev_t dev, int flags, int mode, struct proc *p) SET(tp->t_state, TS_CARR_ON); else CLR(tp->t_state, TS_CARR_ON); - } else if (ISSET(tp->t_state, TS_XCLUDE) && p->p_ucred->cr_uid != 0) { + } else if (ISSET(tp->t_state, TS_XCLUDE) && suser(p, 0) != 0) { return (EBUSY); /* superuser can break exclusive access */ } else { s = spltty(); diff --git a/sys/dev/sbus/spif.c b/sys/dev/sbus/spif.c index febec144e0c..8a90e089025 100644 --- a/sys/dev/sbus/spif.c +++ b/sys/dev/sbus/spif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spif.c,v 1.14 2009/10/31 06:40:17 deraadt Exp $ */ +/* $OpenBSD: spif.c,v 1.15 2009/10/31 12:00:08 fgsch Exp $ */ /* * Copyright (c) 1999-2002 Jason L. Wright (jason@thought.net) @@ -390,7 +390,7 @@ sttyopen(dev, flags, mode, p) else CLR(tp->t_state, TS_CARR_ON); } - else if (ISSET(tp->t_state, TS_XCLUDE) && p->p_ucred->cr_uid != 0) { + else if (ISSET(tp->t_state, TS_XCLUDE) && suser(p, 0) != 0) { return (EBUSY); } else { s = spltty(); diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c index a0e1b28c731..41581e084fa 100644 --- a/sys/dev/usb/ucom.c +++ b/sys/dev/usb/ucom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ucom.c,v 1.44 2009/10/31 06:40:17 deraadt Exp $ */ +/* $OpenBSD: ucom.c,v 1.45 2009/10/31 12:00:08 fgsch Exp $ */ /* $NetBSD: ucom.c,v 1.49 2003/01/01 00:10:25 thorpej Exp $ */ /* @@ -462,7 +462,7 @@ ucomopen(dev_t dev, int flag, int mode, struct proc *p) SET(tp->t_state, TS_CARR_ON); else CLR(tp->t_state, TS_CARR_ON); - } else if (ISSET(tp->t_state, TS_XCLUDE) && p->p_ucred->cr_uid != 0) { + } else if (ISSET(tp->t_state, TS_XCLUDE) && suser(p, 0) != 0) { error = EBUSY; goto bad; } else diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c index ae76e78c419..7754f197c96 100644 --- a/sys/dev/wscons/wsdisplay.c +++ b/sys/dev/wscons/wsdisplay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsdisplay.c,v 1.94 2009/09/14 04:10:42 miod Exp $ */ +/* $OpenBSD: wsdisplay.c,v 1.95 2009/10/31 12:00:08 fgsch Exp $ */ /* $NetBSD: wsdisplay.c,v 1.82 2005/02/27 00:27:52 perry Exp $ */ /* @@ -849,7 +849,7 @@ wsdisplayopen(dev_t dev, int flag, int mode, struct proc *p) wsdisplayparam(tp, &tp->t_termios); ttsetwater(tp); } else if ((tp->t_state & TS_XCLUDE) != 0 && - p->p_ucred->cr_uid != 0) + suser(p, 0) != 0) return (EBUSY); tp->t_state |= TS_CARR_ON; diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c index 62a67c8e750..856cf5f868f 100644 --- a/sys/isofs/cd9660/cd9660_vfsops.c +++ b/sys/isofs/cd9660/cd9660_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd9660_vfsops.c,v 1.50 2009/07/09 22:29:55 thib Exp $ */ +/* $OpenBSD: cd9660_vfsops.c,v 1.51 2009/10/31 12:00:08 fgsch Exp $ */ /* $NetBSD: cd9660_vfsops.c,v 1.26 1997/06/13 15:38:58 pk Exp $ */ /*- @@ -178,7 +178,7 @@ cd9660_mount(mp, path, data, ndp, p) * If mount by non-root, then verify that user has necessary * permissions on the device. */ - if (p->p_ucred->cr_uid != 0) { + if (suser(p, 0) != 0) { vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); error = VOP_ACCESS(devvp, VREAD, p->p_ucred, p); if (error) { diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index 828cf614d14..f0f8d6da6f8 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_ktrace.c,v 1.47 2009/07/09 22:29:56 thib Exp $ */ +/* $OpenBSD: kern_ktrace.c,v 1.48 2009/10/31 12:00:08 fgsch Exp $ */ /* $NetBSD: kern_ktrace.c,v 1.23 1996/02/09 18:59:36 christos Exp $ */ /* @@ -390,7 +390,7 @@ ktrops(struct proc *curp, struct proc *p, int ops, int facs, struct vnode *vp) if (ops == KTROP_SET) { ktrsettracevnode(p, vp); p->p_traceflag |= facs; - if (curp->p_ucred->cr_uid == 0) + if (suser(curp, 0) == 0) p->p_traceflag |= KTRFAC_ROOT; } else { /* KTROP_CLEAR */ diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index e08db5a9c60..0d727c550eb 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_pty.c,v 1.41 2009/10/30 16:41:10 nicm Exp $ */ +/* $OpenBSD: tty_pty.c,v 1.42 2009/10/31 12:00:08 fgsch Exp $ */ /* $NetBSD: tty_pty.c,v 1.33.4.1 1996/06/02 09:08:11 mrg Exp $ */ /* @@ -252,7 +252,7 @@ ptsopen(dev_t dev, int flag, int devtype, struct proc *p) tp->t_cflag = TTYDEF_CFLAG; tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED; ttsetwater(tp); /* would be done in xxparam() */ - } else if (tp->t_state&TS_XCLUDE && p->p_ucred->cr_uid != 0) + } else if (tp->t_state&TS_XCLUDE && suser(p, 0) != 0) return (EBUSY); if (tp->t_oproc) /* Ctrlr still around. */ tp->t_state |= TS_CARR_ON; diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 9998ccae763..375e633a060 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.78 2009/08/10 16:49:38 thib Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.79 2009/10/31 12:00:08 fgsch Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -108,7 +108,7 @@ socreate(int dom, struct socket **aso, int type, int proto) TAILQ_INIT(&so->so_q0); TAILQ_INIT(&so->so_q); so->so_type = type; - if (p->p_ucred->cr_uid == 0) + if (suser(p, 0) == 0) so->so_state = SS_PRIV; so->so_ruid = p->p_cred->p_ruid; so->so_euid = p->p_ucred->cr_uid; diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index c62696f00ab..7ff15ffa10c 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_syscalls.c,v 1.158 2009/09/08 17:41:20 miod Exp $ */ +/* $OpenBSD: vfs_syscalls.c,v 1.159 2009/10/31 12:00:08 fgsch Exp $ */ /* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */ /* @@ -145,7 +145,7 @@ sys_mount(struct proc *p, void *v, register_t *retval) * enforce MNT_NOSUID and MNT_NODEV for non-root users, and * inherit MNT_NOEXEC from the mount point. */ - if (p->p_ucred->cr_uid != 0) { + if (suser(p, 0) != 0) { if (SCARG(uap, flags) & MNT_EXPORTED) { vput(vp); return (EPERM); @@ -176,7 +176,7 @@ sys_mount(struct proc *p, void *v, register_t *retval) * enforce MNT_NOSUID and MNT_NODEV for non-root users, and inherit * MNT_NOEXEC from the mount point. */ - if (p->p_ucred->cr_uid != 0) { + if (suser(p, 0) != 0) { if (SCARG(uap, flags) & MNT_EXPORTED) { vput(vp); return (EPERM); diff --git a/sys/msdosfs/msdosfs_vfsops.c b/sys/msdosfs/msdosfs_vfsops.c index 61e97ae68c5..3e828b33f2f 100644 --- a/sys/msdosfs/msdosfs_vfsops.c +++ b/sys/msdosfs/msdosfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfs_vfsops.c,v 1.54 2009/08/30 15:31:24 thib Exp $ */ +/* $OpenBSD: msdosfs_vfsops.c,v 1.55 2009/10/31 12:00:08 fgsch Exp $ */ /* $NetBSD: msdosfs_vfsops.c,v 1.48 1997/10/18 02:54:57 briggs Exp $ */ /*- @@ -130,7 +130,7 @@ msdosfs_mount(struct mount *mp, const char *path, void *data, * If upgrade to read-write by non-root, then verify * that user has necessary permissions on the device. */ - if (p->p_ucred->cr_uid != 0) { + if (suser(p, 0) != 0) { devvp = pmp->pm_devvp; vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); error = VOP_ACCESS(devvp, VREAD | VWRITE, @@ -180,7 +180,7 @@ msdosfs_mount(struct mount *mp, const char *path, void *data, * If mount by non-root, then verify that user has necessary * permissions on the device. */ - if (p->p_ucred->cr_uid != 0) { + if (suser(p, 0) != 0) { accessmode = VREAD; if ((mp->mnt_flag & MNT_RDONLY) == 0) accessmode |= VWRITE; diff --git a/sys/ufs/ext2fs/ext2fs_vfsops.c b/sys/ufs/ext2fs/ext2fs_vfsops.c index 2e2ce764eaf..f75ad09be2c 100644 --- a/sys/ufs/ext2fs/ext2fs_vfsops.c +++ b/sys/ufs/ext2fs/ext2fs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_vfsops.c,v 1.53 2009/07/09 22:29:56 thib Exp $ */ +/* $OpenBSD: ext2fs_vfsops.c,v 1.54 2009/10/31 12:00:08 fgsch Exp $ */ /* $NetBSD: ext2fs_vfsops.c,v 1.1 1997/06/11 09:34:07 bouyer Exp $ */ /* @@ -220,7 +220,7 @@ ext2fs_mount(struct mount *mp, const char *path, void *data, * If upgrade to read-write by non-root, then verify * that user has necessary permissions on the device. */ - if (p->p_ucred->cr_uid != 0) { + if (suser(p, 0) != 0) { devvp = ump->um_devvp; vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); error = VOP_ACCESS(devvp, VREAD | VWRITE, @@ -267,7 +267,7 @@ ext2fs_mount(struct mount *mp, const char *path, void *data, * If mount by non-root, then verify that user has necessary * permissions on the device. */ - if (p->p_ucred->cr_uid != 0) { + if (suser(p, 0) != 0) { accessmode = VREAD; if ((mp->mnt_flag & MNT_RDONLY) == 0) accessmode |= VWRITE; |