From: mpi Date: Mon, 19 Feb 2018 08:59:52 +0000 (+0000) Subject: Remove almost unused `flags' argument of suser(). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=3e6763994aeb80a553b07ba51b1db2c4725c5c88;p=openbsd Remove almost unused `flags' argument of suser(). The account flag `ASU' will no longer be set but that makes suser() mpsafe since it no longer mess with a per-process field. No objection from millert@, ok tedu@, bluhm@ --- diff --git a/sys/arch/alpha/alpha/mem.c b/sys/arch/alpha/alpha/mem.c index ec29894dff9..290ff9cccd8 100644 --- a/sys/arch/alpha/alpha/mem.c +++ b/sys/arch/alpha/alpha/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.33 2017/12/14 03:30:43 guenther Exp $ */ +/* $OpenBSD: mem.c,v 1.34 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: mem.c,v 1.26 2000/03/29 03:48:20 simonb Exp $ */ /* @@ -84,7 +84,7 @@ mmopen(dev_t dev, int flag, int mode, struct proc *p) break; #ifdef APERTURE case 4: - if (suser(p, 0) != 0 || !allowaperture) + if (suser(p) != 0 || !allowaperture) return (EPERM); /* authorize only one simultaneous open() unless diff --git a/sys/arch/alpha/alpha/promcons.c b/sys/arch/alpha/alpha/promcons.c index fff80b84125..9efabd3bf1c 100644 --- a/sys/arch/alpha/alpha/promcons.c +++ b/sys/arch/alpha/alpha/promcons.c @@ -1,4 +1,4 @@ -/* $OpenBSD: promcons.c,v 1.18 2017/12/30 20:46:59 guenther Exp $ */ +/* $OpenBSD: promcons.c,v 1.19 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: promcons.c,v 1.5 1996/11/13 22:20:55 cgd Exp $ */ /* @@ -90,7 +90,7 @@ promopen(dev, flag, mode, p) ttsetwater(tp); setuptimeout = 1; - } else if (tp->t_state&TS_XCLUDE && suser(p, 0) != 0) { + } else if (tp->t_state&TS_XCLUDE && suser(p) != 0) { splx(s); return EBUSY; } diff --git a/sys/arch/amd64/amd64/mem.c b/sys/arch/amd64/amd64/mem.c index 7fc09e1fb4a..da186df1f09 100644 --- a/sys/arch/amd64/amd64/mem.c +++ b/sys/arch/amd64/amd64/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.33 2017/12/14 03:30:43 guenther Exp $ */ +/* $OpenBSD: mem.c,v 1.34 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1982, 1986, 1990, 1993 @@ -92,7 +92,7 @@ mmopen(dev_t dev, int flag, int mode, struct proc *p) break; #ifdef APERTURE case 4: - if (suser(p, 0) != 0 || !allowaperture) + if (suser(p) != 0 || !allowaperture) return (EPERM); /* authorize only one simultaneous open() unless @@ -198,7 +198,7 @@ mmmmap(dev_t dev, off_t off, int prot) switch (minor(dev)) { /* minor device 0 is physical memory */ case 0: - if (suser(p, 0) != 0 && amd64_pa_used(off)) + if (suser(p) != 0 && amd64_pa_used(off)) return -1; return off; diff --git a/sys/arch/amd64/amd64/sys_machdep.c b/sys/arch/amd64/amd64/sys_machdep.c index aa28fba509c..7189a6e7722 100644 --- a/sys/arch/amd64/amd64/sys_machdep.c +++ b/sys/arch/amd64/amd64/sys_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_machdep.c,v 1.19 2018/01/07 18:54:44 guenther Exp $ */ +/* $OpenBSD: sys_machdep.c,v 1.20 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: sys_machdep.c,v 1.1 2003/04/26 18:39:32 fvdl Exp $ */ /*- @@ -55,7 +55,7 @@ amd64_iopl(struct proc *p, void *args, register_t *retval) struct trapframe *tf = p->p_md.md_regs; struct amd64_iopl_args ua; - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return error; #ifdef APERTURE diff --git a/sys/arch/arm/arm/mem.c b/sys/arch/arm/arm/mem.c index ec82d414342..e37b44deaaa 100644 --- a/sys/arch/arm/arm/mem.c +++ b/sys/arch/arm/arm/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.20 2017/12/14 03:30:43 guenther Exp $ */ +/* $OpenBSD: mem.c,v 1.21 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: mem.c,v 1.11 2003/10/16 12:02:58 jdolecek Exp $ */ /* @@ -115,7 +115,7 @@ mmopen(dev_t dev, int flag, int mode, struct proc *p) break; #ifdef APERTURE case 4: - if (suser(p, 0) != 0 || !allowaperture) + if (suser(p) != 0 || !allowaperture) return (EPERM); /* authorize only one simultaneous open() unless @@ -239,7 +239,7 @@ mmmmap(dev_t dev, off_t off, int prot) /* minor device 0 is physical memory */ if ((paddr_t)off >= ptoa((paddr_t)physmem) && - suser(p, 0) != 0) + suser(p) != 0) return -1; return off; } diff --git a/sys/arch/arm64/arm64/mem.c b/sys/arch/arm64/arm64/mem.c index a64e9f1ab69..0b82310539d 100644 --- a/sys/arch/arm64/arm64/mem.c +++ b/sys/arch/arm64/arm64/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.4 2018/02/17 22:33:00 kettenis Exp $ */ +/* $OpenBSD: mem.c,v 1.5 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: mem.c,v 1.11 2003/10/16 12:02:58 jdolecek Exp $ */ /* @@ -114,7 +114,7 @@ mmopen(dev_t dev, int flag, int mode, struct proc *p) break; #ifdef APERTURE case 4: - if (suser(p, 0) != 0 || !allowaperture) + if (suser(p) != 0 || !allowaperture) return (EPERM); /* authorize only one simultaneous open() unless @@ -238,7 +238,7 @@ mmmmap(dev_t dev, off_t off, int prot) /* minor device 0 is physical memory */ if ((paddr_t)off >= ptoa((paddr_t)physmem) && - suser(p, 0) != 0) + suser(p) != 0) return -1; return off; } diff --git a/sys/arch/arm64/dev/pluart.c b/sys/arch/arm64/dev/pluart.c index 4c29f481ada..33090a7f21a 100644 --- a/sys/arch/arm64/dev/pluart.c +++ b/sys/arch/arm64/dev/pluart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pluart.c,v 1.6 2017/08/29 13:33:03 jsg Exp $ */ +/* $OpenBSD: pluart.c,v 1.7 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 2014 Patrick Wildt @@ -792,7 +792,7 @@ pluartioctl( dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) case TIOCGFLAGS: break; case TIOCSFLAGS: - error = suser(p, 0); + error = suser(p); if (error != 0) return(EPERM); break; diff --git a/sys/arch/armv7/dev/pluart.c b/sys/arch/armv7/dev/pluart.c index b5af7b643b2..400fa891af8 100644 --- a/sys/arch/armv7/dev/pluart.c +++ b/sys/arch/armv7/dev/pluart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pluart.c,v 1.6 2017/10/27 11:23:28 kevlo Exp $ */ +/* $OpenBSD: pluart.c,v 1.7 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 2014 Patrick Wildt @@ -794,7 +794,7 @@ pluartioctl( dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) case TIOCGFLAGS: break; case TIOCSFLAGS: - error = suser(p, 0); + error = suser(p); if (error != 0) return(EPERM); break; diff --git a/sys/arch/armv7/exynos/exuart.c b/sys/arch/armv7/exynos/exuart.c index fc7a216a63a..020cc91c127 100644 --- a/sys/arch/armv7/exynos/exuart.c +++ b/sys/arch/armv7/exynos/exuart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exuart.c,v 1.13 2017/10/27 11:23:28 kevlo Exp $ */ +/* $OpenBSD: exuart.c,v 1.14 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 2005 Dale Rahn * @@ -645,7 +645,7 @@ exuartopen(dev_t dev, int flag, int mode, struct proc *p) SET(tp->t_state, TS_CARR_ON); /* XXX */ - } else if (ISSET(tp->t_state, TS_XCLUDE) && suser(p, 0) != 0) + } else if (ISSET(tp->t_state, TS_XCLUDE) && suser(p) != 0) return EBUSY; else s = spltty(); @@ -825,7 +825,7 @@ exuartioctl( dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) break; case TIOCSFLAGS: - error = suser(p, 0); + error = suser(p); if (error != 0) return(EPERM); diff --git a/sys/arch/armv7/imx/imxuart.c b/sys/arch/armv7/imx/imxuart.c index 5f2e686511b..cbdefd76c2b 100644 --- a/sys/arch/armv7/imx/imxuart.c +++ b/sys/arch/armv7/imx/imxuart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imxuart.c,v 1.17 2017/12/30 13:34:56 kettenis Exp $ */ +/* $OpenBSD: imxuart.c,v 1.18 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 2005 Dale Rahn * @@ -742,7 +742,7 @@ imxuartioctl( dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) break; case TIOCSFLAGS: - error = suser(p, 0); + error = suser(p); if (error != 0) return(EPERM); diff --git a/sys/arch/hppa/dev/pdc.c b/sys/arch/hppa/dev/pdc.c index 4ec046c820f..7835c64cc68 100644 --- a/sys/arch/hppa/dev/pdc.c +++ b/sys/arch/hppa/dev/pdc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pdc.c,v 1.39 2011/08/16 17:26:04 kettenis Exp $ */ +/* $OpenBSD: pdc.c,v 1.40 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 1998-2003 Michael Shalayeff @@ -223,7 +223,7 @@ pdcopen(dev, flag, mode, p) ttsetwater(tp); setuptimeout = 1; - } else if (tp->t_state&TS_XCLUDE && suser(p, 0) != 0) { + } else if (tp->t_state&TS_XCLUDE && suser(p) != 0) { splx(s); return (EBUSY); } diff --git a/sys/arch/i386/i386/amdmsr.c b/sys/arch/i386/i386/amdmsr.c index 77eeca48d35..c096ceb5d38 100644 --- a/sys/arch/i386/i386/amdmsr.c +++ b/sys/arch/i386/i386/amdmsr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: amdmsr.c,v 1.9 2010/04/20 22:05:41 tedu Exp $ */ +/* $OpenBSD: amdmsr.c,v 1.10 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 2008 Marc Balmer @@ -107,7 +107,7 @@ amdmsropen(dev_t dev, int flags, int devtype, struct proc *p) if (amdmsr_cd.cd_ndevs == 0 || minor(dev) != 0) return ENXIO; - if (suser(p, 0) != 0 || !allowaperture) + if (suser(p) != 0 || !allowaperture) return EPERM; /* allow only one simultaneous open() */ if (amdmsr_open_cnt > 0) diff --git a/sys/arch/i386/i386/mem.c b/sys/arch/i386/i386/mem.c index e9af7eb43fa..903b3add790 100644 --- a/sys/arch/i386/i386/mem.c +++ b/sys/arch/i386/i386/mem.c @@ -1,5 +1,5 @@ /* $NetBSD: mem.c,v 1.31 1996/05/03 19:42:19 christos Exp $ */ -/* $OpenBSD: mem.c,v 1.53 2017/12/14 03:30:43 guenther Exp $ */ +/* $OpenBSD: mem.c,v 1.54 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1982, 1986, 1990, 1993 @@ -90,7 +90,7 @@ mmopen(dev_t dev, int flag, int mode, struct proc *p) break; #ifdef APERTURE case 4: - if (suser(p, 0) != 0 || !allowaperture) + if (suser(p) != 0 || !allowaperture) return (EPERM); /* authorize only one simultaneous open() unless @@ -210,7 +210,7 @@ mmmmap(dev_t dev, off_t off, int prot) switch (minor(dev)) { /* minor device 0 is physical memory */ case 0: - if ((u_int)off > ptoa(physmem) && suser(p, 0) != 0) + if ((u_int)off > ptoa(physmem) && suser(p) != 0) return -1; return off; diff --git a/sys/arch/i386/i386/sys_machdep.c b/sys/arch/i386/i386/sys_machdep.c index 5011af82168..a9b0b4643d2 100644 --- a/sys/arch/i386/i386/sys_machdep.c +++ b/sys/arch/i386/i386/sys_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_machdep.c,v 1.38 2017/12/30 20:46:59 guenther Exp $ */ +/* $OpenBSD: sys_machdep.c,v 1.39 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: sys_machdep.c,v 1.28 1996/05/03 19:42:29 christos Exp $ */ /*- @@ -81,7 +81,7 @@ i386_iopl(struct proc *p, void *args, register_t *retval) struct trapframe *tf = p->p_md.md_regs; struct i386_iopl_args ua; - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return error; #ifdef APERTURE if (!allowaperture && securelevel > 0) diff --git a/sys/arch/luna88k/dev/siotty.c b/sys/arch/luna88k/dev/siotty.c index fd75f8b71bc..d0d519af816 100644 --- a/sys/arch/luna88k/dev/siotty.c +++ b/sys/arch/luna88k/dev/siotty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: siotty.c,v 1.21 2017/11/03 06:54:06 aoyama Exp $ */ +/* $OpenBSD: siotty.c,v 1.22 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: siotty.c,v 1.9 2002/03/17 19:40:43 atatat Exp $ */ /*- @@ -469,7 +469,7 @@ sioopen(dev_t dev, int flag, int mode, struct proc *p) tp = sc->sc_tty; if ((tp->t_state & TS_ISOPEN) && (tp->t_state & TS_XCLUDE) - && suser(p, 0) != 0) + && suser(p) != 0) return EBUSY; if ((tp->t_state & TS_ISOPEN) == 0) { @@ -592,7 +592,7 @@ sioioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) siomctl(sc, *(int *)data, DMBIC); break; case TIOCSFLAGS: /* Instruct how serial port behaves */ - error = suser(p, 0); + error = suser(p); if (error != 0) return EPERM; sc->sc_flags = *(int *)data; diff --git a/sys/arch/macppc/macppc/mem.c b/sys/arch/macppc/macppc/mem.c index 0ea44c381ac..4c233eda122 100644 --- a/sys/arch/macppc/macppc/mem.c +++ b/sys/arch/macppc/macppc/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.26 2017/12/14 03:30:43 guenther Exp $ */ +/* $OpenBSD: mem.c,v 1.27 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: mem.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */ /* @@ -204,7 +204,7 @@ mmopen(dev_t dev, int flag, int mode, struct proc *p) break; #ifdef APERTURE case 4: - if (suser(p, 0) != 0 || !allowaperture) + if (suser(p) != 0 || !allowaperture) return (EPERM); /* authorize only one simultaneous open() unless diff --git a/sys/arch/sh/dev/scif.c b/sys/arch/sh/dev/scif.c index b035fc320a6..5cf0039201d 100644 --- a/sys/arch/sh/dev/scif.c +++ b/sys/arch/sh/dev/scif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scif.c,v 1.18 2017/12/30 20:46:59 guenther Exp $ */ +/* $OpenBSD: scif.c,v 1.19 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: scif.c,v 1.47 2006/07/23 22:06:06 ad Exp $ */ /*- @@ -686,7 +686,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) && - suser(p, 0) != 0) + suser(p) != 0) return (EBUSY); s = spltty(); @@ -859,7 +859,7 @@ scifioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) break; case TIOCSFLAGS: - error = suser(p, 0); + error = suser(p); if (error) break; sc->sc_swflags = *(int *)data; diff --git a/sys/arch/sh/sh/mem.c b/sys/arch/sh/sh/mem.c index a42e0cd3782..51c3b036441 100644 --- a/sys/arch/sh/sh/mem.c +++ b/sys/arch/sh/sh/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.10 2017/12/14 03:30:43 guenther Exp $ */ +/* $OpenBSD: mem.c,v 1.11 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: mem.c,v 1.21 2006/07/23 22:06:07 ad Exp $ */ /* @@ -214,7 +214,7 @@ mmmmap(dev_t dev, off_t off, int prot) if (minor(dev) != 0) return (-1); - if (__mm_mem_addr((paddr_t)off) == FALSE && suser(p, 0) != 0) + if (__mm_mem_addr((paddr_t)off) == FALSE && suser(p) != 0) return (-1); return ((paddr_t)off); } diff --git a/sys/arch/socppc/socppc/mem.c b/sys/arch/socppc/socppc/mem.c index 109790ae753..90abc1d6a0c 100644 --- a/sys/arch/socppc/socppc/mem.c +++ b/sys/arch/socppc/socppc/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.8 2017/12/14 03:30:43 guenther Exp $ */ +/* $OpenBSD: mem.c,v 1.9 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: mem.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */ /* @@ -71,7 +71,7 @@ mmopen(dev_t dev, int flag, int mode, struct proc *p) break; #ifdef xAPERTURE case 4: - if (suser(p, 0) != 0 || !allowaperture) + if (suser(p) != 0 || !allowaperture) return (EPERM); /* authorize only one simultaneous open() */ diff --git a/sys/arch/sparc64/dev/pcons.c b/sys/arch/sparc64/dev/pcons.c index 81ee4155b8f..5f33896ba8f 100644 --- a/sys/arch/sparc64/dev/pcons.c +++ b/sys/arch/sparc64/dev/pcons.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcons.c,v 1.23 2017/12/30 20:46:59 guenther Exp $ */ +/* $OpenBSD: pcons.c,v 1.24 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: pcons.c,v 1.7 2001/05/02 10:32:20 scw Exp $ */ /*- @@ -240,7 +240,7 @@ pconsopen(dev, flag, mode, p) tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED; pconsparam(tp, &tp->t_termios); ttsetwater(tp); - } else if ((tp->t_state & TS_XCLUDE) && suser(p, 0)) + } else if ((tp->t_state & TS_XCLUDE) && suser(p)) return EBUSY; tp->t_state |= TS_CARR_ON; diff --git a/sys/arch/sparc64/dev/sab.c b/sys/arch/sparc64/dev/sab.c index 9d9915a90b0..d518f2c28ef 100644 --- a/sys/arch/sparc64/dev/sab.c +++ b/sys/arch/sparc64/dev/sab.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sab.c,v 1.34 2017/12/30 23:08:29 guenther Exp $ */ +/* $OpenBSD: sab.c,v 1.35 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 2001 Jason L. Wright (jason@thought.net) @@ -719,7 +719,7 @@ sabttyopen(dev, flags, mode, p) else tp->t_state &= ~TS_CARR_ON; } else if ((tp->t_state & TS_XCLUDE) && - (!suser(p, 0))) { + (!suser(p))) { return (EBUSY); } else { s = spltty(); @@ -885,7 +885,7 @@ sabttyioctl(dev, cmd, data, flags, p) *((int *)data) = sc->sc_openflags; break; case TIOCSFLAGS: - if (suser(p, 0)) + if (suser(p)) error = EPERM; else sc->sc_openflags = *((int *)data) & diff --git a/sys/arch/sparc64/dev/sbbc.c b/sys/arch/sparc64/dev/sbbc.c index eb4b2bd8444..66ba35467d7 100644 --- a/sys/arch/sparc64/dev/sbbc.c +++ b/sys/arch/sparc64/dev/sbbc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sbbc.c,v 1.12 2017/04/30 16:45:45 mpi Exp $ */ +/* $OpenBSD: sbbc.c,v 1.13 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 2008 Mark Kettenis * @@ -528,7 +528,7 @@ sbbcopen(dev_t dev, int flag, int mode, struct proc *p) tp->t_lflag = TTYDEF_LFLAG; tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED; ttsetwater(tp); - } else if ((tp->t_state & TS_XCLUDE) && suser(p, 0)) + } else if ((tp->t_state & TS_XCLUDE) && suser(p)) return (EBUSY); tp->t_state |= TS_CARR_ON; diff --git a/sys/arch/sparc64/dev/vcctty.c b/sys/arch/sparc64/dev/vcctty.c index 8486b1284fc..a837811839f 100644 --- a/sys/arch/sparc64/dev/vcctty.c +++ b/sys/arch/sparc64/dev/vcctty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vcctty.c,v 1.13 2018/01/17 15:52:33 stsp Exp $ */ +/* $OpenBSD: vcctty.c,v 1.14 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 2009 Mark Kettenis * @@ -333,7 +333,7 @@ vccttyopen(dev_t dev, int flag, int mode, struct proc *p) tp->t_lflag = TTYDEF_LFLAG; tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED; ttsetwater(tp); - } else if ((tp->t_state & TS_XCLUDE) && suser(p, 0)) + } else if ((tp->t_state & TS_XCLUDE) && suser(p)) return (EBUSY); tp->t_state |= TS_CARR_ON; diff --git a/sys/arch/sparc64/dev/vcons.c b/sys/arch/sparc64/dev/vcons.c index 213a134cc1c..3e138ed2734 100644 --- a/sys/arch/sparc64/dev/vcons.c +++ b/sys/arch/sparc64/dev/vcons.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vcons.c,v 1.15 2017/04/30 16:45:45 mpi Exp $ */ +/* $OpenBSD: vcons.c,v 1.16 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 2008 Mark Kettenis * @@ -195,7 +195,7 @@ vconsopen(dev_t dev, int flag, int mode, struct proc *p) tp->t_lflag = TTYDEF_LFLAG; tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED; ttsetwater(tp); - } else if ((tp->t_state & TS_XCLUDE) && suser(p, 0)) + } else if ((tp->t_state & TS_XCLUDE) && suser(p)) return (EBUSY); tp->t_state |= TS_CARR_ON; diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index 4e5fc3f7aa8..e2428a31320 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.339 2018/02/10 05:24:23 deraadt Exp $ */ +/* $OpenBSD: acpi.c,v 1.340 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -3182,7 +3182,7 @@ acpiioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) break; #ifdef HIBERNATE case APM_IOC_HIBERNATE: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) break; if ((flag & FWRITE) == 0) { error = EBADF; diff --git a/sys/dev/cons.c b/sys/dev/cons.c index 38faa30fe09..c2837e1b394 100644 --- a/sys/dev/cons.c +++ b/sys/dev/cons.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cons.c,v 1.27 2017/12/30 20:46:59 guenther Exp $ */ +/* $OpenBSD: cons.c,v 1.28 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: cons.c,v 1.30 1996/04/08 19:57:30 jonathan Exp $ */ /* @@ -157,7 +157,7 @@ cnioctl(dev_t dev, u_long cmd, caddr_t data, int flag, * output from the "virtual" console. */ if (cmd == TIOCCONS && constty != NULL) { - error = suser(p, SUSER_NOACCT); + error = suser(p); if (error) return (error); constty = NULL; diff --git a/sys/dev/ic/an.c b/sys/dev/ic/an.c index ee4c17d3ec6..d3b9ada242c 100644 --- a/sys/dev/ic/an.c +++ b/sys/dev/ic/an.c @@ -1,4 +1,4 @@ -/* $OpenBSD: an.c,v 1.72 2017/01/22 10:17:37 dlg Exp $ */ +/* $OpenBSD: an.c,v 1.73 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: an.c,v 1.34 2005/06/20 02:49:18 atatat Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -1534,7 +1534,7 @@ an_get_nwkey(struct an_softc *sc, struct ieee80211_nwkey *nwkey) if (nwkey->i_key[i].i_keydat == NULL) continue; /* do not show any keys to non-root user */ - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; nwkey->i_key[i].i_keylen = sc->sc_wepkeys[i].an_wep_keylen; if (nwkey->i_key[i].i_keylen < 0) { diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c index e0b1087265c..2484a65b91e 100644 --- a/sys/dev/ic/com.c +++ b/sys/dev/ic/com.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com.c,v 1.164 2017/12/30 23:08:29 guenther Exp $ */ +/* $OpenBSD: com.c,v 1.165 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */ /* @@ -375,7 +375,7 @@ comopen(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) && suser(p, 0) != 0) + } else if (ISSET(tp->t_state, TS_XCLUDE) && suser(p) != 0) return EBUSY; else s = spltty(); @@ -741,7 +741,7 @@ comioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) case TIOCSFLAGS: { int userbits, driverbits = 0; - error = suser(p, 0); + error = suser(p); if (error != 0) return(EPERM); diff --git a/sys/dev/ic/cy.c b/sys/dev/ic/cy.c index dacd33b96e5..515fc23aaed 100644 --- a/sys/dev/ic/cy.c +++ b/sys/dev/ic/cy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cy.c,v 1.37 2017/09/08 05:36:52 deraadt Exp $ */ +/* $OpenBSD: cy.c,v 1.38 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 1996 Timo Rossi. * All rights reserved. @@ -360,7 +360,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) && suser(p, 0) != 0) { + } else if (ISSET(tp->t_state, TS_XCLUDE) && suser(p) != 0) { return (EBUSY); } else { s = spltty(); @@ -565,7 +565,7 @@ cyioctl(dev, cmd, data, flag, p) break; case TIOCSFLAGS: - error = suser(p, 0); + error = suser(p); if (error != 0) return (EPERM); diff --git a/sys/dev/ic/if_wi.c b/sys/dev/ic/if_wi.c index df0ac264b10..5451345b767 100644 --- a/sys/dev/ic/if_wi.c +++ b/sys/dev/ic/if_wi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wi.c,v 1.167 2017/01/22 10:17:38 dlg Exp $ */ +/* $OpenBSD: if_wi.c,v 1.168 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -1599,7 +1599,7 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data) break; case WI_RID_DEFLT_CRYPT_KEYS: /* For non-root user, return all-zeroes keys */ - if (suser(p, 0)) + if (suser(p)) bzero(wreq, sizeof(struct wi_ltv_keys)); else bcopy(&sc->wi_keys, wreq, @@ -1637,7 +1637,7 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data) error = copyout(wreq, ifr->ifr_data, sizeof(*wreq)); break; case SIOCSWAVELAN: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; wreq = malloc(sizeof *wreq, M_DEVBUF, M_WAITOK | M_ZERO); error = copyin(ifr->ifr_data, wreq, sizeof(*wreq)); @@ -1720,7 +1720,7 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data) error = copyout(wreq, ifr->ifr_data, sizeof(*wreq)); break; case SIOCSPRISM2DEBUG: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; wreq = malloc(sizeof *wreq, M_DEVBUF, M_WAITOK | M_ZERO); error = copyin(ifr->ifr_data, wreq, sizeof(*wreq)); @@ -1751,7 +1751,7 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } break; case SIOCS80211NWID: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; nwidp = malloc(sizeof *nwidp, M_DEVBUF, M_WAITOK); error = copyin(ifr->ifr_data, nwidp, sizeof(*nwidp)); @@ -1771,7 +1771,7 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data) wi_init(sc); break; case SIOCS80211NWKEY: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; error = wi_set_nwkey(sc, (struct ieee80211_nwkey *)data); break; @@ -1779,7 +1779,7 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data) error = wi_get_nwkey(sc, (struct ieee80211_nwkey *)data); break; case SIOCS80211POWER: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; error = wi_set_pm(sc, (struct ieee80211_power *)data); break; @@ -1787,7 +1787,7 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data) error = wi_get_pm(sc, (struct ieee80211_power *)data); break; case SIOCS80211TXPOWER: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; error = wi_set_txpower(sc, (struct ieee80211_txpower *)data); break; @@ -1795,7 +1795,7 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data) error = wi_get_txpower(sc, (struct ieee80211_txpower *)data); break; case SIOCS80211CHANNEL: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; if (((struct ieee80211chanreq *)data)->i_channel > 14) { error = EINVAL; @@ -1832,7 +1832,7 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data) IEEE80211_ADDR_COPY(bssid->i_bssid, wreq->wi_val); break; case SIOCS80211SCAN: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; if (sc->wi_ptype == WI_PORTTYPE_HOSTAP) break; @@ -1872,7 +1872,7 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct ieee80211_nodereq *nr = NULL; - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; na = (struct ieee80211_nodereq_all *)data; if (sc->wi_ptype == WI_PORTTYPE_HOSTAP) { @@ -1968,7 +1968,7 @@ wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } break; case SIOCS80211FLAGS: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; if (sc->wi_ptype != WI_PORTTYPE_HOSTAP) { error = EINVAL; @@ -2916,7 +2916,7 @@ wi_get_nwkey(struct wi_softc *sc, struct ieee80211_nwkey *nwkey) nwkey->i_defkid = sc->wi_tx_key + 1; /* do not show any keys to non-root user */ - error = suser(curproc, 0); + error = suser(curproc); for (i = 0; i < IEEE80211_WEP_NKID; i++) { if (nwkey->i_key[i].i_keydat == NULL) continue; diff --git a/sys/dev/ic/if_wi_hostap.c b/sys/dev/ic/if_wi_hostap.c index 353a78aa737..64e3c10f3f5 100644 --- a/sys/dev/ic/if_wi_hostap.c +++ b/sys/dev/ic/if_wi_hostap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wi_hostap.c,v 1.51 2015/11/24 17:11:39 mpi Exp $ */ +/* $OpenBSD: if_wi_hostap.c,v 1.52 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 2002 @@ -1191,7 +1191,7 @@ wihap_ioctl(struct wi_softc *sc, u_long command, caddr_t data) switch (command) { case SIOCHOSTAP_DEL: - if ((error = suser(p, 0))) + if ((error = suser(p))) break; if ((error = copyin(ifr->ifr_data, &reqsta, sizeof(reqsta)))) break; @@ -1235,7 +1235,7 @@ wihap_ioctl(struct wi_softc *sc, u_long command, caddr_t data) break; case SIOCHOSTAP_ADD: - if ((error = suser(p, 0))) + if ((error = suser(p))) break; if ((error = copyin(ifr->ifr_data, &reqsta, sizeof(reqsta)))) break; @@ -1258,7 +1258,7 @@ wihap_ioctl(struct wi_softc *sc, u_long command, caddr_t data) break; case SIOCHOSTAP_SFLAGS: - if ((error = suser(p, 0))) + if ((error = suser(p))) break; if ((error = copyin(ifr->ifr_data, &flag, sizeof(int)))) break; diff --git a/sys/dev/ic/z8530tty.c b/sys/dev/ic/z8530tty.c index 08d513637f3..10fa788a885 100644 --- a/sys/dev/ic/z8530tty.c +++ b/sys/dev/ic/z8530tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: z8530tty.c,v 1.29 2017/12/30 23:08:29 guenther Exp $ */ +/* $OpenBSD: z8530tty.c,v 1.30 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: z8530tty.c,v 1.77 2001/05/30 15:24:24 lukem Exp $ */ /*- @@ -479,7 +479,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) && - suser(p, 0) != 0) + suser(p) != 0) return (EBUSY); s = spltty(); @@ -775,7 +775,7 @@ zsioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) break; case TIOCSFLAGS: - error = suser(p, 0); + error = suser(p); if (error) break; zst->zst_swflags = *(int *)data; diff --git a/sys/dev/pci/cz.c b/sys/dev/pci/cz.c index 3703e6aabff..a9fb72c8c71 100644 --- a/sys/dev/pci/cz.c +++ b/sys/dev/pci/cz.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cz.c,v 1.20 2014/07/13 23:10:23 deraadt Exp $ */ +/* $OpenBSD: cz.c,v 1.21 2018/02/19 08:59:52 mpi 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) && - suser(p, 0) != 0) + suser(p) != 0) return (EBUSY); s = spltty(); @@ -1171,7 +1171,7 @@ czttyioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) break; case TIOCSFLAGS: - error = suser(p, 0); + error = suser(p); if (error) break; sc->sc_swflags = *(int *)data; diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h index 78e9f97bc26..8ed45e3a470 100644 --- a/sys/dev/pci/drm/drmP.h +++ b/sys/dev/pci/drm/drmP.h @@ -1,4 +1,4 @@ -/* $OpenBSD: drmP.h,v 1.216 2018/01/13 13:03:42 robert Exp $ */ +/* $OpenBSD: drmP.h,v 1.217 2018/02/19 08:59:52 mpi Exp $ */ /* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*- * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com */ @@ -117,7 +117,7 @@ struct fb_image; #define DRM_MAXUNITS 8 /* DRM_SUSER returns true if the user is superuser */ -#define DRM_SUSER(p) (suser(p, 0) == 0) +#define DRM_SUSER(p) (suser(p) == 0) #define DRM_MTRR_WC MDF_WRITECOMBINE #define DRM_WAKEUP(x) wakeup(x) diff --git a/sys/dev/pci/drm/drm_linux.h b/sys/dev/pci/drm/drm_linux.h index 4953842f3ac..89749ddb2c6 100644 --- a/sys/dev/pci/drm/drm_linux.h +++ b/sys/dev/pci/drm/drm_linux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_linux.h,v 1.83 2018/01/31 10:17:22 jsg Exp $ */ +/* $OpenBSD: drm_linux.h,v 1.84 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 2013, 2014, 2015 Mark Kettenis * Copyright (c) 2017 Martin Pieuchot @@ -1773,7 +1773,7 @@ static inline int capable(int cap) { KASSERT(cap == CAP_SYS_ADMIN); - return suser(curproc, 0); + return suser(curproc); } typedef int pgprot_t; diff --git a/sys/dev/pv/viocon.c b/sys/dev/pv/viocon.c index bc1eb93c0b7..1ff2b847d2d 100644 --- a/sys/dev/pv/viocon.c +++ b/sys/dev/pv/viocon.c @@ -1,4 +1,4 @@ -/* $OpenBSD: viocon.c,v 1.2 2017/05/30 17:47:11 krw Exp $ */ +/* $OpenBSD: viocon.c,v 1.3 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 2013-2015 Stefan Fritsch @@ -528,7 +528,7 @@ vioconopen(dev_t dev, int flag, int mode, struct proc *p) ttsetwater(tp); splx(s); } - else if (ISSET(tp->t_state, TS_XCLUDE) && suser(p, 0) != 0) { + else if (ISSET(tp->t_state, TS_XCLUDE) && suser(p) != 0) { return (EBUSY); } diff --git a/sys/dev/sbus/magma.c b/sys/dev/sbus/magma.c index 22f9fe69683..0ecd08fef15 100644 --- a/sys/dev/sbus/magma.c +++ b/sys/dev/sbus/magma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: magma.c,v 1.27 2017/12/30 23:08:29 guenther Exp $ */ +/* $OpenBSD: magma.c,v 1.28 2018/02/19 08:59:52 mpi 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) && suser(p, 0) != 0) { + } else if (ISSET(tp->t_state, TS_XCLUDE) && suser(p) != 0) { return (EBUSY); /* superuser can break exclusive access */ } else { s = spltty(); @@ -1054,7 +1054,7 @@ mttyioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p) break; case TIOCSFLAGS: - if (suser(p, 0)) + if (suser(p)) error = EPERM; else mp->mp_openflags = *((int *)data) & diff --git a/sys/dev/sbus/spif.c b/sys/dev/sbus/spif.c index 8f6c242f09e..2c2f0115070 100644 --- a/sys/dev/sbus/spif.c +++ b/sys/dev/sbus/spif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spif.c,v 1.20 2017/12/30 23:08:29 guenther Exp $ */ +/* $OpenBSD: spif.c,v 1.21 2018/02/19 08:59:52 mpi 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) && suser(p, 0) != 0) { + else if (ISSET(tp->t_state, TS_XCLUDE) && suser(p) != 0) { return (EBUSY); } else { s = spltty(); @@ -505,7 +505,7 @@ sttyioctl(dev, cmd, data, flags, p) *((int *)data) = sp->sp_openflags; break; case TIOCSFLAGS: - if (suser(p, 0)) + if (suser(p)) error = EPERM; else sp->sp_openflags = *((int *)data) & diff --git a/sys/dev/usb/if_umb.c b/sys/dev/usb/if_umb.c index b2571c969df..36b15d3da6d 100644 --- a/sys/dev/usb/if_umb.c +++ b/sys/dev/usb/if_umb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_umb.c,v 1.17 2017/10/23 15:23:13 gerhard Exp $ */ +/* $OpenBSD: if_umb.c,v 1.18 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 2016 genua mbH @@ -698,7 +698,7 @@ umb_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) sizeof (sc->sc_info)); break; case SIOCSUMBPARAM: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) break; if ((error = copyin(ifr->ifr_data, &mp, sizeof (mp))) != 0) break; diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c index 88aa365399c..4e6c9e87583 100644 --- a/sys/dev/usb/ucom.c +++ b/sys/dev/usb/ucom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ucom.c,v 1.66 2017/12/30 23:08:29 guenther Exp $ */ +/* $OpenBSD: ucom.c,v 1.67 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: ucom.c,v 1.49 2003/01/01 00:10:25 thorpej Exp $ */ /* @@ -469,7 +469,7 @@ ucom_do_open(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) && suser(p, 0) != 0) + } else if (ISSET(tp->t_state, TS_XCLUDE) && suser(p) != 0) return (EBUSY); else s = spltty(); @@ -713,7 +713,7 @@ ucom_do_ioctl(struct ucom_softc *sc, u_long cmd, caddr_t data, break; case TIOCSFLAGS: - error = suser(p, 0); + error = suser(p); if (error) break; sc->sc_swflags = *(int *)data; diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index a9b530ee65d..0320d153835 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb.c,v 1.115 2018/02/03 13:37:37 mpi Exp $ */ +/* $OpenBSD: usb.c,v 1.116 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: usb.c,v 1.77 2003/01/01 00:10:26 thorpej Exp $ */ /* @@ -598,7 +598,7 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, struct proc *p) #ifdef USB_DEBUG case USB_SETDEBUG: /* only root can access to these debug flags */ - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) return (error); if (!(flag & FWRITE)) return (EBADF); diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c index 7fbb5107c4e..d9559ddda91 100644 --- a/sys/dev/vnd.c +++ b/sys/dev/vnd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vnd.c,v 1.166 2017/12/30 23:08:29 guenther Exp $ */ +/* $OpenBSD: vnd.c,v 1.167 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $ */ /* @@ -404,7 +404,7 @@ vndioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) DNPRINTF(VDB_FOLLOW, "vndioctl(%x, %lx, %p, %x, %p): unit %d\n", dev, cmd, addr, flag, p, unit); - error = suser(p, 0); + error = suser(p); if (error) return (error); if (unit >= numvnd) diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c index 35cfff6454e..b713695a916 100644 --- a/sys/dev/wscons/wsdisplay.c +++ b/sys/dev/wscons/wsdisplay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsdisplay.c,v 1.130 2018/01/17 16:54:19 fcambus Exp $ */ +/* $OpenBSD: wsdisplay.c,v 1.131 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: wsdisplay.c,v 1.82 2005/02/27 00:27:52 perry Exp $ */ /* @@ -859,7 +859,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 && - suser(p, 0) != 0) + suser(p) != 0) return (EBUSY); tp->t_state |= TS_CARR_ON; diff --git a/sys/dev/wscons/wskbd.c b/sys/dev/wscons/wskbd.c index 304d5a92057..07d56e9b787 100644 --- a/sys/dev/wscons/wskbd.c +++ b/sys/dev/wscons/wskbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wskbd.c,v 1.89 2018/01/22 12:20:54 fcambus Exp $ */ +/* $OpenBSD: wskbd.c,v 1.90 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: wskbd.c,v 1.80 2005/05/04 01:52:16 augustss Exp $ */ /* @@ -1060,7 +1060,7 @@ getbell: return (0); case WSKBDIO_SETDEFAULTBELL: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); kbdp = &wskbd_default_bell_data; goto setbell; @@ -1096,7 +1096,7 @@ getkeyrepeat: return (0); case WSKBDIO_SETDEFAULTKEYREPEAT: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); kkdp = &wskbd_default_keyrepeat_data; goto setkeyrepeat; diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c index e415570fdbc..9951a2a2789 100644 --- a/sys/kern/kern_acct.c +++ b/sys/kern/kern_acct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_acct.c,v 1.34 2017/12/30 23:08:29 guenther Exp $ */ +/* $OpenBSD: kern_acct.c,v 1.35 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: kern_acct.c,v 1.42 1996/02/04 02:15:12 christos Exp $ */ /*- @@ -104,7 +104,7 @@ sys_acct(struct proc *p, void *v, register_t *retval) int error; /* Make sure that the caller is root. */ - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); /* diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 623015f75fd..10b04d6736e 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_descrip.c,v 1.141 2017/07/20 16:47:21 mpi Exp $ */ +/* $OpenBSD: kern_descrip.c,v 1.142 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */ /* @@ -708,7 +708,7 @@ sys_fstat(struct proc *p, void *v, register_t *retval) * Don't let non-root see generation numbers * (for NFS security) */ - if (suser(p, 0)) + if (suser(p)) ub.st_gen = 0; error = copyout((caddr_t)&ub, (caddr_t)SCARG(uap, sb), sizeof (ub)); diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index b386ee3af06..5bd55d71d5f 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_ktrace.c,v 1.94 2017/12/30 23:08:29 guenther Exp $ */ +/* $OpenBSD: kern_ktrace.c,v 1.95 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: kern_ktrace.c,v 1.23 1996/02/09 18:59:36 christos Exp $ */ /* @@ -441,7 +441,7 @@ doktrace(struct vnode *vp, int ops, int facs, pid_t pid, struct proc *p) goto done; } if (ops == KTROP_SET) { - if (suser(p, 0) == 0) + if (suser(p) == 0) facs |= KTRFAC_ROOT; ktrstart(p, vp, cred); } diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index 0829c8f5f59..c5d1a9f8082 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_prot.c,v 1.71 2017/09/27 06:45:00 deraadt Exp $ */ +/* $OpenBSD: kern_prot.c,v 1.72 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: kern_prot.c,v 1.33 1996/02/09 18:59:42 christos Exp $ */ /* @@ -364,21 +364,21 @@ sys_setresuid(struct proc *p, void *v, register_t *retval) ruid != uc->cr_ruid && ruid != uc->cr_uid && ruid != uc->cr_svuid && - (error = suser(p, 0))) + (error = suser(p))) return (error); if (euid != (uid_t)-1 && euid != uc->cr_ruid && euid != uc->cr_uid && euid != uc->cr_svuid && - (error = suser(p, 0))) + (error = suser(p))) return (error); if (suid != (uid_t)-1 && suid != uc->cr_ruid && suid != uc->cr_uid && suid != uc->cr_svuid && - (error = suser(p, 0))) + (error = suser(p))) return (error); /* @@ -473,21 +473,21 @@ sys_setresgid(struct proc *p, void *v, register_t *retval) rgid != uc->cr_rgid && rgid != uc->cr_gid && rgid != uc->cr_svgid && - (error = suser(p, 0))) + (error = suser(p))) return (error); if (egid != (gid_t)-1 && egid != uc->cr_rgid && egid != uc->cr_gid && egid != uc->cr_svgid && - (error = suser(p, 0))) + (error = suser(p))) return (error); if (sgid != (gid_t)-1 && sgid != uc->cr_rgid && sgid != uc->cr_gid && sgid != uc->cr_svgid && - (error = suser(p, 0))) + (error = suser(p))) return (error); /* @@ -555,14 +555,14 @@ sys_setregid(struct proc *p, void *v, register_t *retval) rgid != uc->cr_rgid && rgid != uc->cr_gid && rgid != uc->cr_svgid && - (error = suser(p, 0))) + (error = suser(p))) return (error); if (egid != (gid_t)-1 && egid != uc->cr_rgid && egid != uc->cr_gid && egid != uc->cr_svgid && - (error = suser(p, 0))) + (error = suser(p))) return (error); /* @@ -634,14 +634,14 @@ sys_setreuid(struct proc *p, void *v, register_t *retval) ruid != uc->cr_ruid && ruid != uc->cr_uid && ruid != uc->cr_svuid && - (error = suser(p, 0))) + (error = suser(p))) return (error); if (euid != (uid_t)-1 && euid != uc->cr_ruid && euid != uc->cr_uid && euid != uc->cr_svuid && - (error = suser(p, 0))) + (error = suser(p))) return (error); /* @@ -701,7 +701,7 @@ sys_setuid(struct proc *p, void *v, register_t *retval) if (uid != uc->cr_ruid && uid != uc->cr_svuid && uid != uc->cr_uid && - (error = suser(p, 0))) + (error = suser(p))) return (error); /* @@ -715,7 +715,7 @@ sys_setuid(struct proc *p, void *v, register_t *retval) /* * Everything's okay, do it. */ - if (uid == pruc->cr_uid || suser(p, 0) == 0) { + if (uid == pruc->cr_uid || suser(p) == 0) { did_real = 1; newcred->cr_ruid = uid; newcred->cr_svuid = uid; @@ -754,7 +754,7 @@ sys_seteuid(struct proc *p, void *v, register_t *retval) return (0); if (euid != uc->cr_ruid && euid != uc->cr_svuid && - (error = suser(p, 0))) + (error = suser(p))) return (error); /* @@ -793,7 +793,7 @@ sys_setgid(struct proc *p, void *v, register_t *retval) if (gid != uc->cr_rgid && gid != uc->cr_svgid && gid != uc->cr_gid && - (error = suser(p, 0))) + (error = suser(p))) return (error); /* @@ -804,7 +804,7 @@ sys_setgid(struct proc *p, void *v, register_t *retval) pruc = pr->ps_ucred; crset(newcred, pruc); - if (gid == pruc->cr_gid || suser(p, 0) == 0) { + if (gid == pruc->cr_gid || suser(p) == 0) { newcred->cr_rgid = gid; newcred->cr_svgid = gid; } @@ -832,7 +832,7 @@ sys_setegid(struct proc *p, void *v, register_t *retval) return (0); if (egid != uc->cr_rgid && egid != uc->cr_svgid && - (error = suser(p, 0))) + (error = suser(p))) return (error); /* @@ -862,7 +862,7 @@ sys_setgroups(struct proc *p, void *v, register_t *retval) u_int ngrp; int error; - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); ngrp = SCARG(uap, gidsetsize); if (ngrp > NGROUPS_MAX) @@ -904,15 +904,12 @@ groupmember(gid_t gid, struct ucred *cred) * Returns 0 or error. */ int -suser(struct proc *p, u_int flags) +suser(struct proc *p) { struct ucred *cred = p->p_ucred; - if (cred->cr_uid == 0) { - if (!(flags & SUSER_NOACCT)) - p->p_p->ps_acflag |= ASU; + if (cred->cr_uid == 0) return (0); - } return (EPERM); } @@ -1036,7 +1033,7 @@ sys_setlogin(struct proc *p, void *v, register_t *retval) char buf[sizeof(s->s_login)]; int error; - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); error = copyinstr(SCARG(uap, namebuf), buf, sizeof(buf), NULL); if (error == 0) diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index b1601596aba..184c538d2ef 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_resource.c,v 1.57 2016/09/15 02:00:16 dlg Exp $ */ +/* $OpenBSD: kern_resource.c,v 1.58 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: kern_resource.c,v 1.38 1996/10/23 07:19:38 matthias Exp $ */ /*- @@ -190,7 +190,7 @@ donice(struct proc *curp, struct process *chgpr, int n) if (n < PRIO_MIN) n = PRIO_MIN; n += NZERO; - if (n < chgpr->ps_nice && suser(curp, 0)) + if (n < chgpr->ps_nice && suser(curp)) return (EACCES); chgpr->ps_nice = n; SCHED_LOCK(s); @@ -233,7 +233,7 @@ dosetrlimit(struct proc *p, u_int which, struct rlimit *limp) alimp = &p->p_rlimit[which]; if (limp->rlim_max > alimp->rlim_max) - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); if (p->p_p->ps_limit->p_refcnt > 1) { struct plimit *l = p->p_p->ps_limit; diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 4dec0398107..cfa2df78e74 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sig.c,v 1.214 2017/12/30 23:08:29 guenther Exp $ */ +/* $OpenBSD: kern_sig.c,v 1.215 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */ /* @@ -1498,7 +1498,7 @@ coredump(struct proc *p) * If the process has inconsistent uids, nosuidcoredump * determines coredump placement policy. */ - if (((pr->ps_flags & PS_SUGID) && (error = suser(p, 0))) || + if (((pr->ps_flags & PS_SUGID) && (error = suser(p))) || ((pr->ps_flags & PS_SUGID) && nosuidcoredump)) { if (nosuidcoredump == 3 || nosuidcoredump == 2) incrash = 1; diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 08ae58e9a19..c98f9d53d72 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sysctl.c,v 1.331 2018/01/02 06:38:45 guenther Exp $ */ +/* $OpenBSD: kern_sysctl.c,v 1.332 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */ /*- @@ -164,7 +164,7 @@ sys_sysctl(struct proc *p, void *v, register_t *retval) int name[CTL_MAXNAME]; if (SCARG(uap, new) != NULL && - (error = suser(p, 0))) + (error = suser(p))) return (error); /* * all top-level sysctl names are non-terminal @@ -487,7 +487,7 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, return (sysctl_rdint(oldp, oldlenp, newp, mp->msg_bufs)); } case KERN_CONSBUF: - if ((error = suser(p, 0))) + if ((error = suser(p))) return (error); /* FALLTHROUGH */ case KERN_MSGBUF: { @@ -1065,7 +1065,7 @@ fill_file(struct kinfo_file *kf, struct file *fp, struct filedesc *fdp, kf->f_data = PTRTOINT64(fp->f_data); kf->f_usecount = 0; - if (suser(p, 0) == 0 || p->p_ucred->cr_uid == fp->f_cred->cr_uid) { + if (suser(p) == 0 || p->p_ucred->cr_uid == fp->f_cred->cr_uid) { kf->f_offset = fp->f_offset; kf->f_rxfer = fp->f_rxfer; kf->f_rwfer = fp->f_wxfer; @@ -1273,7 +1273,7 @@ sysctl_file(int *name, u_int namelen, char *where, size_t *sizep, if (elem_size < 1) return (EINVAL); - show_pointers = suser(curproc, 0) == 0; + show_pointers = suser(curproc) == 0; kf = malloc(sizeof(*kf), M_TEMP, M_WAITOK); @@ -1464,7 +1464,7 @@ sysctl_doproc(int *name, u_int namelen, char *where, size_t *sizep) dothreads = op & KERN_PROC_SHOW_THREADS; op &= ~KERN_PROC_SHOW_THREADS; - show_pointers = suser(curproc, 0) == 0; + show_pointers = suser(curproc) == 0; if (where != NULL) kproc = malloc(sizeof(*kproc), M_TEMP, M_WAITOK); @@ -1717,7 +1717,7 @@ sysctl_proc_args(int *name, u_int namelen, void *oldp, size_t *oldlenp, /* Only owner or root can get env */ if ((op == KERN_PROC_NENV || op == KERN_PROC_ENV) && (vpr->ps_ucred->cr_uid != cp->p_ucred->cr_uid && - (error = suser(cp, 0)) != 0)) + (error = suser(cp)) != 0)) return (error); ps_strings = vpr->ps_strings; @@ -1900,7 +1900,7 @@ sysctl_proc_cwd(int *name, u_int namelen, void *oldp, size_t *oldlenp, /* Only owner or root can get cwd */ if (findpr->ps_ucred->cr_uid != cp->p_ucred->cr_uid && - (error = suser(cp, 0)) != 0) + (error = suser(cp)) != 0) return (error); len = *oldlenp; @@ -1956,7 +1956,7 @@ sysctl_proc_nobroadcastkill(int *name, u_int namelen, void *newp, size_t newlen, return (EINVAL); /* Only root can change PS_NOBROADCASTKILL */ - if (newp != 0 && (error = suser(cp, 0)) != 0) + if (newp != 0 && (error = suser(cp)) != 0) return (error); /* get the PS_NOBROADCASTKILL flag */ @@ -2018,17 +2018,17 @@ sysctl_proc_vmmap(int *name, u_int namelen, void *oldp, size_t *oldlenp, #if 1 /* XXX Allow only root for now */ - if ((error = suser(cp, 0)) != 0) + if ((error = suser(cp)) != 0) return (error); #else /* Only owner or root can get vmmap */ if (findpr->ps_ucred->cr_uid != cp->p_ucred->cr_uid && - (error = suser(cp, 0)) != 0) + (error = suser(cp)) != 0) return (error); #endif } else { /* Only root can get kernel_map */ - if ((error = suser(cp, 0)) != 0) + if ((error = suser(cp)) != 0) return (error); findpr = NULL; } diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index 61a9b559e5c..ab86d059e79 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_time.c,v 1.100 2017/12/18 05:51:53 cheloha Exp $ */ +/* $OpenBSD: kern_time.c,v 1.101 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: kern_time.c,v 1.20 1996/02/18 11:57:06 fvdl Exp $ */ /* @@ -188,7 +188,7 @@ sys_clock_settime(struct proc *p, void *v, register_t *retval) clockid_t clock_id; int error; - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); if ((error = copyin(SCARG(uap, tp), &ats, sizeof(ats))) != 0) @@ -371,7 +371,7 @@ sys_settimeofday(struct proc *p, void *v, register_t *retval) tv = SCARG(uap, tv); tzp = SCARG(uap, tzp); - if ((error = suser(p, 0))) + if ((error = suser(p))) return (error); /* Verify all parameters before changing time. */ if (tv && (error = copyin(tv, &atv, sizeof(atv)))) @@ -408,7 +408,7 @@ sys_adjfreq(struct proc *p, void *v, register_t *retval) return (error); } if (freq) { - if ((error = suser(p, 0))) + if ((error = suser(p))) return (error); if ((error = copyin(freq, &f, sizeof(f)))) return (error); @@ -448,7 +448,7 @@ sys_adjtime(struct proc *p, void *v, register_t *retval) } if (delta) { - if ((error = suser(p, 0))) + if ((error = suser(p))) return (error); if ((error = copyin(delta, &atv, sizeof(struct timeval)))) diff --git a/sys/kern/kern_xxx.c b/sys/kern/kern_xxx.c index 975c6bc34d8..3ef387746d5 100644 --- a/sys/kern/kern_xxx.c +++ b/sys/kern/kern_xxx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_xxx.c,v 1.33 2017/01/21 05:42:03 guenther Exp $ */ +/* $OpenBSD: kern_xxx.c,v 1.34 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: kern_xxx.c,v 1.32 1996/04/22 01:38:41 christos Exp $ */ /* @@ -48,7 +48,7 @@ sys_reboot(struct proc *p, void *v, register_t *retval) } */ *uap = v; int error; - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); #ifdef MULTIPROCESSOR diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c index b6be84ba182..ad63442ceab 100644 --- a/sys/kern/subr_log.c +++ b/sys/kern/subr_log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_log.c,v 1.54 2017/10/17 08:29:43 mpi Exp $ */ +/* $OpenBSD: subr_log.c,v 1.55 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: subr_log.c,v 1.11 1996/03/30 22:24:44 christos Exp $ */ /* @@ -355,7 +355,7 @@ logioctl(dev_t dev, u_long com, caddr_t data, int flag, struct proc *p) break; case LIOCSFD: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); fp = syslogf; if ((error = getsock(p, *(int *)data, &syslogf)) != 0) diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 647b488af65..3bd7f44590c 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_process.c,v 1.78 2017/10/14 10:17:08 guenther Exp $ */ +/* $OpenBSD: sys_process.c,v 1.79 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: sys_process.c,v 1.55 1996/05/15 06:17:47 tls Exp $ */ /*- @@ -361,14 +361,14 @@ ptrace_ctrl(struct proc *p, int req, pid_t pid, caddr_t addr, int data) */ if ((tr->ps_ucred->cr_ruid != p->p_ucred->cr_ruid || ISSET(tr->ps_flags, PS_SUGIDEXEC | PS_SUGID)) && - (error = suser(p, 0)) != 0) + (error = suser(p)) != 0) return (error); /* * (5.5) it's not a child of the tracing process. */ if (global_ptrace == 0 && !inferior(tr, p->p_p) && - (error = suser(p, 0)) != 0) + (error = suser(p)) != 0) return (error); /* @@ -812,7 +812,7 @@ process_checkioperm(struct proc *p, struct process *tr) if ((tr->ps_ucred->cr_ruid != p->p_ucred->cr_ruid || ISSET(tr->ps_flags, PS_SUGIDEXEC | PS_SUGID)) && - (error = suser(p, 0)) != 0) + (error = suser(p)) != 0) return (error); if ((tr->ps_pid == 1) && (securelevel > -1)) diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 51eb2b3c71b..b9fec5b6bb9 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.136 2018/02/06 01:24:31 tedu Exp $ */ +/* $OpenBSD: tty.c,v 1.137 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */ /*- @@ -829,7 +829,7 @@ ttioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p) splx(s); break; case TIOCGPGRP: /* get pgrp of tty */ - if (!isctty(pr, tp) && suser(p, 0)) + if (!isctty(pr, tp) && suser(p)) return (ENOTTY); *(int *)data = tp->t_pgrp ? tp->t_pgrp->pg_id : NO_PID; break; diff --git a/sys/kern/tty_endrun.c b/sys/kern/tty_endrun.c index 67493fd1833..6e3054ba022 100644 --- a/sys/kern/tty_endrun.c +++ b/sys/kern/tty_endrun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_endrun.c,v 1.7 2015/12/21 21:49:02 sf Exp $ */ +/* $OpenBSD: tty_endrun.c,v 1.8 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 2008 Marc Balmer @@ -124,7 +124,7 @@ endrunopen(dev_t dev, struct tty *tp, struct proc *p) DPRINTF(("endrunopen\n")); if (tp->t_line == ENDRUNDISC) return ENODEV; - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return error; np = malloc(sizeof(struct endrun), M_DEVBUF, M_WAITOK|M_ZERO); snprintf(np->timedev.xname, sizeof(np->timedev.xname), "endrun%d", diff --git a/sys/kern/tty_msts.c b/sys/kern/tty_msts.c index a3c04d9b086..f565ca397f5 100644 --- a/sys/kern/tty_msts.c +++ b/sys/kern/tty_msts.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_msts.c,v 1.20 2015/12/21 21:49:02 sf Exp $ */ +/* $OpenBSD: tty_msts.c,v 1.21 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 2008 Marc Balmer @@ -89,7 +89,7 @@ mstsopen(dev_t dev, struct tty *tp, struct proc *p) DPRINTF(("mstsopen\n")); if (tp->t_line == MSTSDISC) return ENODEV; - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return error; np = malloc(sizeof(struct msts), M_DEVBUF, M_WAITOK|M_ZERO); snprintf(np->timedev.xname, sizeof(np->timedev.xname), "msts%d", diff --git a/sys/kern/tty_nmea.c b/sys/kern/tty_nmea.c index 669ccc8df29..8578fee59ca 100644 --- a/sys/kern/tty_nmea.c +++ b/sys/kern/tty_nmea.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_nmea.c,v 1.45 2015/12/21 21:49:02 sf Exp $ */ +/* $OpenBSD: tty_nmea.c,v 1.46 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 2006, 2007, 2008 Marc Balmer @@ -95,7 +95,7 @@ nmeaopen(dev_t dev, struct tty *tp, struct proc *p) if (tp->t_line == NMEADISC) return (ENODEV); - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); np = malloc(sizeof(struct nmea), M_DEVBUF, M_WAITOK | M_ZERO); snprintf(np->timedev.xname, sizeof(np->timedev.xname), "nmea%d", diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index d16fb827a8c..8babd283dcc 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_pty.c,v 1.82 2018/01/08 11:52:14 mpi Exp $ */ +/* $OpenBSD: tty_pty.c,v 1.83 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: tty_pty.c,v 1.33.4.1 1996/06/02 09:08:11 mrg Exp $ */ /* @@ -248,7 +248,7 @@ ptsopen(dev_t dev, int flag, int devtype, struct proc *p) tp->t_cflag = TTYDEF_CFLAG; tp->t_ispeed = tp->t_ospeed = B115200; ttsetwater(tp); /* would be done in xxparam() */ - } else if (tp->t_state & TS_XCLUDE && suser(p, 0) != 0) + } else if (tp->t_state & TS_XCLUDE && suser(p) != 0) return (EBUSY); if (tp->t_oproc) /* Ctrlr still around. */ tp->t_state |= TS_CARR_ON; diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c index 3d7ee45d3ac..0f88b8d9b27 100644 --- a/sys/kern/tty_tty.c +++ b/sys/kern/tty_tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_tty.c,v 1.21 2017/12/30 23:08:29 guenther Exp $ */ +/* $OpenBSD: tty_tty.c,v 1.22 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: tty_tty.c,v 1.13 1996/03/30 22:24:46 christos Exp $ */ /*- @@ -113,7 +113,7 @@ cttyioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) } switch (cmd) { case TIOCSETVERAUTH: - if ((error = suser(p, 0))) + if ((error = suser(p))) return error; secs = *(int *)addr; if (secs < 1 || secs > 3600) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 2f7ecfd2371..ace43c11592 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.215 2018/01/10 18:14:34 bluhm Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.216 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -127,7 +127,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 (suser(p, 0) == 0) + if (suser(p) == 0) so->so_state = SS_PRIV; so->so_ruid = p->p_ucred->cr_ruid; so->so_euid = p->p_ucred->cr_uid; @@ -1575,7 +1575,7 @@ sosetopt(struct socket *so, int level, int optname, struct mbuf *m) } else { switch (optname) { case SO_BINDANY: - if ((error = suser(curproc, 0)) != 0) /* XXX */ + if ((error = suser(curproc)) != 0) /* XXX */ return (error); break; } diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index d63412a6751..9eeb53281ed 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_syscalls.c,v 1.164 2018/02/11 21:53:57 matthieu Exp $ */ +/* $OpenBSD: uipc_syscalls.c,v 1.165 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */ /* @@ -1183,7 +1183,7 @@ sys_setrtable(struct proc *p, void *v, register_t *retval) if (p->p_p->ps_rtableid == (u_int)rtableid) return (0); - if (p->p_p->ps_rtableid != 0 && (error = suser(p, 0)) != 0) + if (p->p_p->ps_rtableid != 0 && (error = suser(p)) != 0) return (error); if (rtableid < 0 || !rtable_exists((u_int)rtableid)) return (EINVAL); diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 1edad2495cd..cc7b674053e 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_syscalls.c,v 1.275 2018/02/10 05:24:23 deraadt Exp $ */ +/* $OpenBSD: vfs_syscalls.c,v 1.276 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */ /* @@ -117,7 +117,7 @@ sys_mount(struct proc *p, void *v, register_t *retval) int flags = SCARG(uap, flags); void *args = NULL; - if ((error = suser(p, 0))) + if ((error = suser(p))) return (error); /* @@ -379,7 +379,7 @@ sys_unmount(struct proc *p, void *v, register_t *retval) int error; struct nameidata nd; - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, @@ -588,7 +588,7 @@ copyout_statfs(struct statfs *sp, void *uaddr, struct proc *p) int error; /* Don't let non-root see filesystem id (for NFS security) */ - if (suser(p, 0)) { + if (suser(p)) { fsid_t fsid; s = (char *)sp; @@ -812,7 +812,7 @@ sys_chroot(struct proc *p, void *v, register_t *retval) int error; struct nameidata nd; - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, SCARG(uap, path), p); @@ -1020,7 +1020,7 @@ sys_getfh(struct proc *p, void *v, register_t *retval) /* * Must be super user */ - error = suser(p, 0); + error = suser(p); if (error) return (error); NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, @@ -1066,7 +1066,7 @@ sys_fhopen(struct proc *p, void *v, register_t *retval) /* * Must be super user */ - if ((error = suser(p, 0))) + if ((error = suser(p))) return (error); flags = FFLAGS(SCARG(uap, flags)); @@ -1189,7 +1189,7 @@ sys_fhstat(struct proc *p, void *v, register_t *retval) /* * Must be super user */ - if ((error = suser(p, 0))) + if ((error = suser(p))) return (error); if ((error = copyin(SCARG(uap, fhp), &fh, sizeof(fhandle_t))) != 0) @@ -1223,7 +1223,7 @@ sys_fhstatfs(struct proc *p, void *v, register_t *retval) /* * Must be super user */ - if ((error = suser(p, 0))) + if ((error = suser(p))) return (error); if ((error = copyin(SCARG(uap, fhp), &fh, sizeof(fhandle_t))) != 0) @@ -1289,7 +1289,7 @@ domknodat(struct proc *p, int fd, const char *path, mode_t mode, dev_t dev) vp = nd.ni_vp; if (!S_ISFIFO(mode) || dev != 0) { if ((nd.ni_dvp->v_mount->mnt_flag & MNT_NOPERM) == 0 && - (error = suser(p, 0)) != 0) + (error = suser(p)) != 0) goto out; if (p->p_fd->fd_rdir) { error = EINVAL; @@ -1801,7 +1801,7 @@ dofstatat(struct proc *p, int fd, const char *path, struct stat *buf, int flag) return (ENOENT); } /* Don't let non-root see generation numbers (for NFS security) */ - if (suser(p, 0)) + if (suser(p)) sb.st_gen = 0; error = copyout(&sb, buf, sizeof(sb)); #ifdef KTRACE @@ -1993,7 +1993,7 @@ dovchflags(struct proc *p, struct vnode *vp, u_int flags) else if (flags == VNOVAL) error = EINVAL; else { - if (suser(p, 0)) { + if (suser(p)) { if ((error = VOP_GETATTR(vp, &vattr, p->p_ucred, p)) != 0) goto out; @@ -2167,7 +2167,7 @@ dofchownat(struct proc *p, int fd, const char *path, uid_t uid, gid_t gid, goto out; if ((uid != -1 || gid != -1) && (vp->v_mount->mnt_flag & MNT_NOPERM) == 0 && - (suser(p, 0) || suid_clear)) { + (suser(p) || suid_clear)) { error = VOP_GETATTR(vp, &vattr, p->p_ucred, p); if (error) goto out; @@ -2219,7 +2219,7 @@ sys_lchown(struct proc *p, void *v, register_t *retval) goto out; if ((uid != -1 || gid != -1) && (vp->v_mount->mnt_flag & MNT_NOPERM) == 0 && - (suser(p, 0) || suid_clear)) { + (suser(p) || suid_clear)) { error = VOP_GETATTR(vp, &vattr, p->p_ucred, p); if (error) goto out; @@ -2269,7 +2269,7 @@ sys_fchown(struct proc *p, void *v, register_t *retval) goto out; if ((uid != -1 || gid != -1) && (vp->v_mount->mnt_flag & MNT_NOPERM) == 0 && - (suser(p, 0) || suid_clear)) { + (suser(p) || suid_clear)) { error = VOP_GETATTR(vp, &vattr, p->p_ucred, p); if (error) goto out; @@ -2874,7 +2874,7 @@ sys_revoke(struct proc *p, void *v, register_t *retval) if ((error = VOP_GETATTR(vp, &vattr, p->p_ucred, p)) != 0) goto out; if (p->p_ucred->cr_uid != vattr.va_uid && - (error = suser(p, 0))) + (error = suser(p))) goto out; if (vp->v_usecount > 1 || (vp->v_flag & (VALIASED))) VOP_REVOKE(vp, REVOKEALL); diff --git a/sys/net/bpf.c b/sys/net/bpf.c index af7406e1d00..a00911021c2 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.167 2018/02/01 12:10:27 dlg Exp $ */ +/* $OpenBSD: bpf.c,v 1.168 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */ /* @@ -684,7 +684,7 @@ bpfioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) int error = 0; d = bpfilter_lookup(minor(dev)); - if (d->bd_locked && suser(p, 0) != 0) { + if (d->bd_locked && suser(p) != 0) { /* list of allowed ioctls when locked and not root */ switch (cmd) { case BIOCGBLEN: diff --git a/sys/net/if.c b/sys/net/if.c index 91c3d5aeb14..1bdb92ff5be 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.545 2018/02/19 00:24:48 dlg Exp $ */ +/* $OpenBSD: if.c,v 1.546 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -1815,21 +1815,21 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) switch (cmd) { case SIOCIFCREATE: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); NET_LOCK(); error = if_clone_create(ifr->ifr_name, 0); NET_UNLOCK(); return (error); case SIOCIFDESTROY: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); NET_LOCK(); error = if_clone_destroy(ifr->ifr_name); NET_UNLOCK(); return (error); case SIOCSIFGATTR: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); NET_LOCK(); error = if_setgroupattribs(data); @@ -1863,7 +1863,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) switch (cmd) { case SIOCIFAFATTACH: case SIOCIFAFDETACH: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) break; NET_LOCK(); switch (ifar->ifar_af) { @@ -1887,7 +1887,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) break; case SIOCSIFFLAGS: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) break; NET_LOCK(); @@ -1909,7 +1909,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) break; case SIOCSIFXFLAGS: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) break; NET_LOCK(); @@ -1984,7 +1984,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) break; case SIOCSIFMETRIC: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) break; NET_LOCK(); ifp->if_metric = ifr->ifr_metric; @@ -1992,7 +1992,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) break; case SIOCSIFMTU: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) break; NET_LOCK(); error = (*ifp->if_ioctl)(ifp, cmd, data); @@ -2002,7 +2002,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) break; case SIOCSIFDESCR: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) break; error = copyinstr(ifr->ifr_data, ifdescrbuf, IFDESCRSIZE, &bytesdone); @@ -2013,7 +2013,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) break; case SIOCSIFRTLABEL: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) break; error = copyinstr(ifr->ifr_data, ifrtlabelbuf, RTLABEL_LEN, &bytesdone); @@ -2024,7 +2024,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) break; case SIOCSIFPRIORITY: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) break; if (ifr->ifr_metric < 0 || ifr->ifr_metric > 15) { error = EINVAL; @@ -2034,7 +2034,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) break; case SIOCSIFRDOMAIN: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) break; NET_LOCK(); error = if_setrdomain(ifp, ifr->ifr_rdomainid); @@ -2042,7 +2042,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) break; case SIOCAIFGROUP: - if ((error = suser(p, 0))) + if ((error = suser(p))) break; NET_LOCK(); error = if_addgroup(ifp, ifgr->ifgr_group); @@ -2055,7 +2055,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) break; case SIOCDIFGROUP: - if ((error = suser(p, 0))) + if ((error = suser(p))) break; NET_LOCK(); error = (*ifp->if_ioctl)(ifp, cmd, data); @@ -2067,7 +2067,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) break; case SIOCSIFLLADDR: - if ((error = suser(p, 0))) + if ((error = suser(p))) break; if ((ifp->if_sadl == NULL) || (ifr->ifr_addr.sa_len != ETHER_ADDR_LEN) || @@ -2098,7 +2098,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) break; case SIOCSIFLLPRIO: - if ((error = suser(p, 0))) + if ((error = suser(p))) break; if (ifr->ifr_llprio > UCHAR_MAX) { error = EINVAL; @@ -2122,7 +2122,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) case SIOCSIFPAIR: case SIOCSIFPARENT: case SIOCDIFPARENT: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) break; /* FALLTHROUGH */ default: diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index a3d1352b088..a12919dd660 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.c,v 1.306 2018/02/11 02:17:46 henning Exp $ */ +/* $OpenBSD: if_bridge.c,v 1.307 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -269,7 +269,7 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCBRDGADD: /* bridge(4) does not distinguish between routing/forwarding ports */ case SIOCBRDGADDL: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; ifs = ifunit(req->ifbr_ifsname); @@ -336,7 +336,7 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) TAILQ_INSERT_TAIL(&sc->sc_iflist, p, next); break; case SIOCBRDGDEL: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; ifs = ifunit(req->ifbr_ifsname); if (ifs == NULL) { @@ -354,7 +354,7 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = bridge_bifconf(sc, (struct ifbifconf *)data); break; case SIOCBRDGADDS: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; ifs = ifunit(req->ifbr_ifsname); if (ifs == NULL) { /* no such interface */ @@ -388,7 +388,7 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) TAILQ_INSERT_TAIL(&sc->sc_spanlist, p, next); break; case SIOCBRDGDELS: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; TAILQ_FOREACH(p, &sc->sc_spanlist, next) { if (strncmp(p->ifp->if_xname, req->ifbr_ifsname, @@ -443,7 +443,7 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } break; case SIOCBRDGSIFFLGS: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; ifs = ifunit(req->ifbr_ifsname); if (ifs == NULL) { @@ -540,7 +540,7 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCBRDGSPROTO: case SIOCBRDGSIFPRIO: case SIOCBRDGSIFCOST: - error = suser(curproc, 0); + error = suser(curproc); break; default: error = ENOTTY; diff --git a/sys/net/if_mpw.c b/sys/net/if_mpw.c index e51b4b69d88..972f0693923 100644 --- a/sys/net/if_mpw.c +++ b/sys/net/if_mpw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mpw.c,v 1.23 2018/01/09 15:24:24 bluhm Exp $ */ +/* $OpenBSD: if_mpw.c,v 1.24 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 2015 Rafael Zalamena @@ -169,7 +169,7 @@ mpw_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; case SIOCSETMPWCFG: - error = suser(curproc, 0); + error = suser(curproc); if (error != 0) break; diff --git a/sys/net/if_pflow.c b/sys/net/if_pflow.c index 1d5627b907c..9ba382d5069 100644 --- a/sys/net/if_pflow.c +++ b/sys/net/if_pflow.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pflow.c,v 1.86 2018/01/09 15:24:24 bluhm Exp $ */ +/* $OpenBSD: if_pflow.c,v 1.87 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 2011 Florian Obser @@ -515,7 +515,7 @@ pflowioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; case SIOCSETPFLOW: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); if ((error = copyin(ifr->ifr_data, &pflowr, sizeof(pflowr)))) diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c index 919ddeacad0..bd85e81f160 100644 --- a/sys/net/if_pfsync.c +++ b/sys/net/if_pfsync.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pfsync.c,v 1.256 2018/01/09 15:24:24 bluhm Exp $ */ +/* $OpenBSD: if_pfsync.c,v 1.257 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff @@ -1301,7 +1301,7 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t data) return (copyout(&pfsyncr, ifr->ifr_data, sizeof(pfsyncr))); case SIOCSETPFSYNC: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); if ((error = copyin(ifr->ifr_data, &pfsyncr, sizeof(pfsyncr)))) return (error); diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c index 922e57a03fa..5c2ad53602d 100644 --- a/sys/net/if_ppp.c +++ b/sys/net/if_ppp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ppp.c,v 1.110 2018/01/09 15:24:24 bluhm Exp $ */ +/* $OpenBSD: if_ppp.c,v 1.111 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: if_ppp.c,v 1.39 1997/05/17 21:11:59 christos Exp $ */ /* @@ -379,7 +379,7 @@ pppioctl(struct ppp_softc *sc, u_long cmd, caddr_t data, int flag, break; case PPPIOCSFLAGS: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); flags = *(int *)data & SC_MASK; #ifdef PPP_COMPRESS @@ -392,7 +392,7 @@ pppioctl(struct ppp_softc *sc, u_long cmd, caddr_t data, int flag, break; case PPPIOCSMRU: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); mru = *(int *)data; if (mru >= PPP_MRU && mru <= PPP_MAXMRU) @@ -405,7 +405,7 @@ pppioctl(struct ppp_softc *sc, u_long cmd, caddr_t data, int flag, #ifdef VJC case PPPIOCSMAXCID: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); if (sc->sc_comp) sl_compress_setup(sc->sc_comp, *(int *)data); @@ -413,14 +413,14 @@ pppioctl(struct ppp_softc *sc, u_long cmd, caddr_t data, int flag, #endif case PPPIOCXFERUNIT: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); sc->sc_xfer = p->p_p->ps_pid; break; #ifdef PPP_COMPRESS case PPPIOCSCOMPRESS: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); odp = (struct ppp_option_data *) data; nb = odp->length; @@ -499,7 +499,7 @@ pppioctl(struct ppp_softc *sc, u_long cmd, caddr_t data, int flag, if (cmd == PPPIOCGNPMODE) { npi->mode = sc->sc_npmode[npx]; } else { - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); if (npi->mode != sc->sc_npmode[npx]) { sc->sc_npmode[npx] = npi->mode; diff --git a/sys/net/if_pppoe.c b/sys/net/if_pppoe.c index 0252c10f4df..e55316351fd 100644 --- a/sys/net/if_pppoe.c +++ b/sys/net/if_pppoe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pppoe.c,v 1.66 2018/01/09 15:24:24 bluhm Exp $ */ +/* $OpenBSD: if_pppoe.c,v 1.67 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: if_pppoe.c,v 1.51 2003/11/28 08:56:48 keihan Exp $ */ /* @@ -796,7 +796,7 @@ pppoe_ioctl(struct ifnet *ifp, unsigned long cmd, caddr_t data) struct pppoediscparms *parms = (struct pppoediscparms *)data; int len; - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); if (parms->eth_ifname[0] != '\0') { struct ifnet *eth_if; diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c index 91ec6fe151b..c7c283e2480 100644 --- a/sys/net/if_spppsubr.c +++ b/sys/net/if_spppsubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_spppsubr.c,v 1.173 2017/10/20 09:35:09 mpi Exp $ */ +/* $OpenBSD: if_spppsubr.c,v 1.174 2018/02/19 08:59:52 mpi Exp $ */ /* * Synchronous PPP link level subroutines. * @@ -4494,7 +4494,7 @@ sppp_get_params(struct sppp *sp, struct ifreq *ifr) spa->flags = auth->flags; /* do not copy the secret, and only let root know the name */ - if (auth->name != NULL && suser(curproc, 0) == 0) + if (auth->name != NULL && suser(curproc) == 0) strlcpy(spa->name, auth->name, sizeof(spa->name)); if (copyout(spa, (caddr_t)ifr->ifr_data, sizeof(*spa)) != 0) { diff --git a/sys/net/if_switch.c b/sys/net/if_switch.c index 4b816345760..93f529300d3 100644 --- a/sys/net/if_switch.c +++ b/sys/net/if_switch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_switch.c,v 1.22 2018/01/09 15:24:24 bluhm Exp $ */ +/* $OpenBSD: if_switch.c,v 1.23 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 2016 Kazuya GODA @@ -390,12 +390,12 @@ switch_ioctl(struct ifnet *ifp, unsigned long cmd, caddr_t data) switch (cmd) { case SIOCBRDGADD: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; error = switch_port_add(sc, (struct ifbreq *)data); break; case SIOCBRDGDEL: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; error = switch_port_del(sc, (struct ifbreq *)data); break; @@ -403,7 +403,7 @@ switch_ioctl(struct ifnet *ifp, unsigned long cmd, caddr_t data) error = switch_port_list(sc, (struct ifbifconf *)data); break; case SIOCBRDGADDL: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; error = switch_port_add(sc, (struct ifbreq *)data); if (error && error != EEXIST) diff --git a/sys/net/if_trunk.c b/sys/net/if_trunk.c index 2e61223a8ce..49d2dbecbbe 100644 --- a/sys/net/if_trunk.c +++ b/sys/net/if_trunk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_trunk.c,v 1.135 2018/01/09 15:24:24 bluhm Exp $ */ +/* $OpenBSD: if_trunk.c,v 1.136 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Reyk Floeter @@ -631,7 +631,7 @@ trunk_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } break; case SIOCSTRUNK: - if ((error = suser(curproc, 0)) != 0) { + if ((error = suser(curproc)) != 0) { error = EPERM; break; } @@ -688,7 +688,7 @@ trunk_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) trunk_port2req(tp, rp); break; case SIOCSTRUNKPORT: - if ((error = suser(curproc, 0)) != 0) { + if ((error = suser(curproc)) != 0) { error = EPERM; break; } @@ -700,7 +700,7 @@ trunk_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = trunk_port_create(tr, tpif); break; case SIOCSTRUNKDELPORT: - if ((error = suser(curproc, 0)) != 0) { + if ((error = suser(curproc)) != 0) { error = EPERM; break; } diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 0a66004d1fe..ee3cd62f0dd 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vlan.c,v 1.175 2018/01/09 15:24:24 bluhm Exp $ */ +/* $OpenBSD: if_vlan.c,v 1.176 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright 1998 Massachusetts Institute of Technology @@ -890,7 +890,7 @@ vlan_set_compat(struct ifnet *ifp, struct ifreq *ifr) int error; - error = suser(curproc, 0); + error = suser(curproc); if (error != 0) return (error); diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c index f7219e3db98..66db6f67f66 100644 --- a/sys/net/pfkeyv2.c +++ b/sys/net/pfkeyv2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkeyv2.c,v 1.175 2017/11/20 10:56:51 mpi Exp $ */ +/* $OpenBSD: pfkeyv2.c,v 1.176 2018/02/19 08:59:52 mpi Exp $ */ /* * @(#)COPYRIGHT 1.1 (NRL) 17 January 1995 @@ -2336,7 +2336,7 @@ pfkeyv2_dump_policy(struct ipsec_policy *ipo, void **headers, void **buffer, headers); /* Add ids only when we are root. */ - perm = suser(curproc, 0); + perm = suser(curproc); if (perm == 0 && ipo->ipo_ids) export_identities(&p, ipo->ipo_ids, 0, headers); @@ -2438,7 +2438,7 @@ pfkeyv2_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, switch(w.w_op) { case NET_KEY_SADB_DUMP: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) return (error); NET_LOCK(); error = tdb_walk(rdomain, pfkeyv2_sysctl_walker, &w); diff --git a/sys/net/ppp_tty.c b/sys/net/ppp_tty.c index 6a5d2506947..bb1dba2e09b 100644 --- a/sys/net/ppp_tty.c +++ b/sys/net/ppp_tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ppp_tty.c,v 1.47 2017/12/30 23:08:29 guenther Exp $ */ +/* $OpenBSD: ppp_tty.c,v 1.48 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: ppp_tty.c,v 1.12 1997/03/24 21:23:10 christos Exp $ */ /* @@ -166,7 +166,7 @@ pppopen(dev_t dev, struct tty *tp, struct proc *p) struct ppp_softc *sc; int error, s; - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); rw_enter_write(&ppp_pkt_init); @@ -389,7 +389,7 @@ ppptioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p) error = 0; switch (cmd) { case PPPIOCSASYNCMAP: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) break; sc->sc_asyncmap[0] = *(u_int *)data; break; @@ -399,7 +399,7 @@ ppptioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p) break; case PPPIOCSRASYNCMAP: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) break; sc->sc_rasyncmap = *(u_int *)data; break; @@ -409,7 +409,7 @@ ppptioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p) break; case PPPIOCSXASYNCMAP: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) break; s = spltty(); bcopy(data, sc->sc_asyncmap, sizeof(sc->sc_asyncmap)); diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 70497d29a93..eb570e25698 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.261 2018/02/11 02:26:55 benno Exp $ */ +/* $OpenBSD: rtsock.c,v 1.262 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -656,7 +656,7 @@ route_output(struct mbuf *m, struct socket *so, struct sockaddr *dstaddr, * Verify that the caller has the appropriate privilege; RTM_GET * is the only operation the non-superuser is allowed. */ - if (rtm->rtm_type != RTM_GET && suser(curproc, 0) != 0) { + if (rtm->rtm_type != RTM_GET && suser(curproc) != 0) { error = EACCES; goto fail; } diff --git a/sys/net/switchofp.c b/sys/net/switchofp.c index c9da7d77c74..7100ac070b8 100644 --- a/sys/net/switchofp.c +++ b/sys/net/switchofp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: switchofp.c,v 1.69 2017/08/11 13:56:06 reyk Exp $ */ +/* $OpenBSD: switchofp.c,v 1.70 2018/02/19 08:59:52 mpi Exp $ */ /* * Copyright (c) 2016 Kazuya GODA @@ -1141,7 +1141,7 @@ swofp_ioctl(struct ifnet *ifp, unsigned long cmd, caddr_t data) sizeof(uint64_t)); break; case SIOCSWSDPID: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; memcpy(&swofs->swofs_datapath_id, &bparam->ifbrp_datapath, sizeof(uint64_t)); @@ -1153,7 +1153,7 @@ swofp_ioctl(struct ifnet *ifp, unsigned long cmd, caddr_t data) bparam->ifbrp_maxgroup = swofs->swofs_group_max_table; break; case SIOCSWSPORTNO: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; if (breq->ifbr_portno >= OFP_PORT_MAX) diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c index e58de33f652..4c8fb30f2b0 100644 --- a/sys/net80211/ieee80211_ioctl.c +++ b/sys/net80211/ieee80211_ioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_ioctl.c,v 1.58 2017/11/27 20:54:38 stsp Exp $ */ +/* $OpenBSD: ieee80211_ioctl.c,v 1.59 2018/02/19 08:59:52 mpi Exp $ */ /* $NetBSD: ieee80211_ioctl.c,v 1.15 2004/05/06 02:58:16 dyoung Exp $ */ /*- @@ -414,7 +414,7 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ifmedia_ioctl(ifp, ifr, &ic->ic_media, cmd); break; case SIOCS80211NWID: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; if ((error = copyin(ifr->ifr_data, &nwid, sizeof(nwid))) != 0) break; @@ -446,7 +446,7 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = copyout(&nwid, ifr->ifr_data, sizeof(nwid)); break; case SIOCS80211NWKEY: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; error = ieee80211_ioctl_setnwkeys(ic, (void *)data); break; @@ -454,7 +454,7 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ieee80211_ioctl_getnwkeys(ic, (void *)data); break; case SIOCS80211WPAPARMS: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; error = ieee80211_ioctl_setwpaparms(ic, (void *)data); break; @@ -462,7 +462,7 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ieee80211_ioctl_getwpaparms(ic, (void *)data); break; case SIOCS80211WPAPSK: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; psk = (struct ieee80211_wpapsk *)data; if (psk->i_enabled) { @@ -487,14 +487,14 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) psk->i_enabled = 0; break; case SIOCS80211KEYAVAIL: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; ka = (struct ieee80211_keyavail *)data; (void)ieee80211_pmksa_add(ic, IEEE80211_AKM_8021X, ka->i_macaddr, ka->i_key, ka->i_lifetime); break; case SIOCS80211KEYRUN: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; kr = (struct ieee80211_keyrun *)data; error = ieee80211_keyrun(ic, kr->i_macaddr); @@ -502,7 +502,7 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) ieee80211_disable_wep(ic); break; case SIOCS80211POWER: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; power = (struct ieee80211_power *)data; ic->ic_lintval = power->i_maxsleep; @@ -526,7 +526,7 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) power->i_maxsleep = ic->ic_lintval; break; case SIOCS80211BSSID: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; bssid = (struct ieee80211_bssid *)data; if (IEEE80211_ADDR_EQ(bssid->i_bssid, empty_macaddr)) @@ -576,7 +576,7 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } break; case SIOCS80211CHANNEL: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; chanreq = (struct ieee80211chanreq *)data; if (chanreq->i_channel == IEEE80211_CHAN_ANY) @@ -639,7 +639,7 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) #endif break; case SIOCS80211TXPOWER: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; txpower = (struct ieee80211_txpower *)data; if ((ic->ic_caps & IEEE80211_C_TXPMGT) == 0) { @@ -670,7 +670,7 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) ifp->if_mtu = ifr->ifr_mtu; break; case SIOCS80211SCAN: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; #ifndef IEEE80211_STA_ONLY if (ic->ic_opmode == IEEE80211_M_HOSTAP) @@ -717,7 +717,7 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) ieee80211_node2req(ic, ni, nr); break; case SIOCS80211NODE: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; #ifndef IEEE80211_STA_ONLY if (ic->ic_opmode == IEEE80211_M_HOSTAP) { @@ -740,7 +740,7 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; #ifndef IEEE80211_STA_ONLY case SIOCS80211DELNODE: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; nr = (struct ieee80211_nodereq *)data; ni = ieee80211_find_node(ic, nr->nr_macaddr); @@ -793,7 +793,7 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) ifr->ifr_flags = flags >> IEEE80211_F_USERSHIFT; break; case SIOCS80211FLAGS: - if ((error = suser(curproc, 0)) != 0) + if ((error = suser(curproc)) != 0) break; flags = (u_int32_t)ifr->ifr_flags << IEEE80211_F_USERSHIFT; if ( diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 82c95755f82..45a274206a1 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.c,v 1.227 2017/12/04 13:40:34 bluhm Exp $ */ +/* $OpenBSD: in_pcb.c,v 1.228 2018/02/19 08:59:53 mpi Exp $ */ /* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */ /* @@ -361,7 +361,7 @@ in_pcbbind(struct inpcb *inp, struct mbuf *nam, struct proc *p) return (error); } else { if (in_rootonly(ntohs(lport), so->so_proto->pr_protocol) && - suser(p, 0) != 0) + suser(p) != 0) return (EACCES); } if (nam) { @@ -456,7 +456,7 @@ in_pcbpickport(u_int16_t *lport, void *laddr, int wild, struct inpcb *inp, first = ipport_hifirstauto; /* sysctl */ last = ipport_hilastauto; } else if (inp->inp_flags & INP_LOWPORT) { - if (suser(p, 0)) + if (suser(p)) return (EACCES); first = IPPORT_RESERVED-1; /* 1023 */ last = 600; /* not IPPORT_RESERVED/2 */ diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index 0ba5ed4e63e..38e0ff74a7a 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_carp.c,v 1.329 2018/02/07 11:30:01 mpi Exp $ */ +/* $OpenBSD: ip_carp.c,v 1.330 2018/02/19 08:59:53 mpi Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff. All rights reserved. @@ -2060,7 +2060,7 @@ carp_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) case SIOCSVH: KERNEL_ASSERT_LOCKED(); /* touching carp_vhosts */ vhe = SRPL_FIRST_LOCKED(&sc->carp_vhosts); - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) break; if ((error = copyin(ifr->ifr_data, &carpr, sizeof carpr))) break; @@ -2147,7 +2147,7 @@ carp_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) } carpr.carpr_advbase = sc->sc_advbase; carpr.carpr_balancing = sc->sc_balancing; - if (suser(p, 0) == 0) + if (suser(p) == 0) bcopy(sc->sc_key, carpr.carpr_key, sizeof(carpr.carpr_key)); carpr.carpr_peer.s_addr = sc->sc_peer.s_addr; diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 87df5b34831..5746ab7d199 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_output.c,v 1.344 2017/11/22 12:28:49 bluhm Exp $ */ +/* $OpenBSD: ip_output.c,v 1.345 2018/02/19 08:59:53 mpi Exp $ */ /* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */ /* @@ -989,7 +989,7 @@ ip_ctloutput(int op, struct socket *so, int level, int optname, switch (optname) { case IP_AUTH_LEVEL: if (optval < IPSEC_AUTH_LEVEL_DEFAULT && - suser(p, 0)) { + suser(p)) { error = EACCES; break; } @@ -998,7 +998,7 @@ ip_ctloutput(int op, struct socket *so, int level, int optname, case IP_ESP_TRANS_LEVEL: if (optval < IPSEC_ESP_TRANS_LEVEL_DEFAULT && - suser(p, 0)) { + suser(p)) { error = EACCES; break; } @@ -1007,7 +1007,7 @@ ip_ctloutput(int op, struct socket *so, int level, int optname, case IP_ESP_NETWORK_LEVEL: if (optval < IPSEC_ESP_NETWORK_LEVEL_DEFAULT && - suser(p, 0)) { + suser(p)) { error = EACCES; break; } @@ -1015,7 +1015,7 @@ ip_ctloutput(int op, struct socket *so, int level, int optname, break; case IP_IPCOMP_LEVEL: if (optval < IPSEC_IPCOMP_LEVEL_DEFAULT && - suser(p, 0)) { + suser(p)) { error = EACCES; break; } @@ -1040,7 +1040,7 @@ ip_ctloutput(int op, struct socket *so, int level, int optname, /* needs privileges to switch when already set */ if (p->p_p->ps_rtableid != rtid && p->p_p->ps_rtableid != 0 && - (error = suser(p, 0)) != 0) + (error = suser(p)) != 0) break; /* table must exist */ if (!rtable_exists(rtid)) { diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 597624d9eba..c4911a9f3a7 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_input.c,v 1.213 2018/02/12 15:53:05 mpi Exp $ */ +/* $OpenBSD: ip6_input.c,v 1.214 2018/02/19 08:59:53 mpi Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -1377,7 +1377,7 @@ ip6_sysctl_soiikey(void *oldp, size_t *oldlenp, void *newp, size_t newlen) uint8_t oldkey[IP6_SOIIKEY_LEN]; int error; - error = suser(curproc, 0); + error = suser(curproc); if (error != 0) return (error); diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 4818d7cb441..cba5d23b084 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_output.c,v 1.233 2018/02/11 00:24:13 dlg Exp $ */ +/* $OpenBSD: ip6_output.c,v 1.234 2018/02/19 08:59:53 mpi Exp $ */ /* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */ /* @@ -1306,7 +1306,7 @@ do { \ switch (optname) { case IPV6_AUTH_LEVEL: if (optval < IPSEC_AUTH_LEVEL_DEFAULT && - suser(p, 0)) { + suser(p)) { error = EACCES; break; } @@ -1315,7 +1315,7 @@ do { \ case IPV6_ESP_TRANS_LEVEL: if (optval < IPSEC_ESP_TRANS_LEVEL_DEFAULT && - suser(p, 0)) { + suser(p)) { error = EACCES; break; } @@ -1324,7 +1324,7 @@ do { \ case IPV6_ESP_NETWORK_LEVEL: if (optval < IPSEC_ESP_NETWORK_LEVEL_DEFAULT && - suser(p, 0)) { + suser(p)) { error = EACCES; break; } @@ -1333,7 +1333,7 @@ do { \ case IPV6_IPCOMP_LEVEL: if (optval < IPSEC_IPCOMP_LEVEL_DEFAULT && - suser(p, 0)) { + suser(p)) { error = EACCES; break; } @@ -1353,7 +1353,7 @@ do { \ /* needs privileges to switch when already set */ if (p->p_p->ps_rtableid != rtid && p->p_p->ps_rtableid != 0 && - (error = suser(p, 0)) != 0) + (error = suser(p)) != 0) break; /* table must exist */ if (!rtable_exists(rtid)) { @@ -1959,7 +1959,7 @@ ip6_setmoptions(int optname, struct ip6_moptions **im6op, struct mbuf *m, * all multicast addresses. Only super user is allowed * to do this. */ - if (suser(p, 0)) + if (suser(p)) { error = EACCES; break; @@ -2051,7 +2051,7 @@ ip6_setmoptions(int optname, struct ip6_moptions **im6op, struct mbuf *m, } mreq = mtod(m, struct ipv6_mreq *); if (IN6_IS_ADDR_UNSPECIFIED(&mreq->ipv6mr_multiaddr)) { - if (suser(p, 0)) + if (suser(p)) { error = EACCES; break; diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c index 79305a41dd0..527a61a37de 100644 --- a/sys/nfs/nfs_syscalls.c +++ b/sys/nfs/nfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_syscalls.c,v 1.112 2018/01/31 14:41:31 mpi Exp $ */ +/* $OpenBSD: nfs_syscalls.c,v 1.113 2018/02/19 08:59:53 mpi Exp $ */ /* $NetBSD: nfs_syscalls.c,v 1.19 1996/02/18 11:53:52 fvdl Exp $ */ /* @@ -155,7 +155,7 @@ sys_nfssvc(struct proc *p, void *v, register_t *retval) #endif /* Must be super user */ - error = suser(p, 0); + error = suser(p); if (error) return (error); diff --git a/sys/sys/ucred.h b/sys/sys/ucred.h index 7aea2be82ad..03e023dc04a 100644 --- a/sys/sys/ucred.h +++ b/sys/sys/ucred.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ucred.h,v 1.11 2015/03/02 20:46:50 guenther Exp $ */ +/* $OpenBSD: ucred.h,v 1.12 2018/02/19 08:59:53 mpi Exp $ */ /* $NetBSD: ucred.h,v 1.12 1995/06/01 22:44:50 jtc Exp $ */ /* @@ -70,15 +70,13 @@ struct xucred { #ifdef _KERNEL #define crhold(cr) (cr)->cr_ref++ -#define SUSER_NOACCT 0x1 /* don't mark accounting flags */ - int crfromxucred(struct ucred *, const struct xucred *); void crset(struct ucred *, const struct ucred *); struct ucred *crcopy(struct ucred *cr); struct ucred *crdup(struct ucred *cr); void crfree(struct ucred *cr); struct ucred *crget(void); -int suser(struct proc *p, u_int flags); +int suser(struct proc *p); int suser_ucred(struct ucred *cred); #endif /* _KERNEL */ diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c index a860d5b5686..54c68a53f06 100644 --- a/sys/ufs/ufs/ufs_quota.c +++ b/sys/ufs/ufs/ufs_quota.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_quota.c,v 1.40 2017/12/30 23:08:29 guenther Exp $ */ +/* $OpenBSD: ufs_quota.c,v 1.41 2018/02/19 08:59:53 mpi Exp $ */ /* $NetBSD: ufs_quota.c,v 1.8 1996/02/09 22:36:09 christos Exp $ */ /* @@ -1059,7 +1059,7 @@ ufs_quotactl(struct mount *mp, int cmds, uid_t uid, caddr_t arg, break; /* FALLTHROUGH */ default: - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); } diff --git a/sys/uvm/uvm_mmap.c b/sys/uvm/uvm_mmap.c index 8d581afef22..809c6a10cb6 100644 --- a/sys/uvm/uvm_mmap.c +++ b/sys/uvm/uvm_mmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_mmap.c,v 1.146 2018/02/11 04:09:48 deraadt Exp $ */ +/* $OpenBSD: uvm_mmap.c,v 1.147 2018/02/19 08:59:53 mpi Exp $ */ /* $NetBSD: uvm_mmap.c,v 1.49 2001/02/18 21:19:08 chs Exp $ */ /* @@ -873,7 +873,7 @@ sys_mlock(struct proc *p, void *v, register_t *retval) p->p_rlimit[RLIMIT_MEMLOCK].rlim_cur) return (EAGAIN); #else - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); #endif @@ -907,7 +907,7 @@ sys_munlock(struct proc *p, void *v, register_t *retval) return (EINVAL); /* disallow wrap-around. */ #ifndef pmap_wired_count - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); #endif @@ -934,7 +934,7 @@ sys_mlockall(struct proc *p, void *v, register_t *retval) return (EINVAL); #ifndef pmap_wired_count - if ((error = suser(p, 0)) != 0) + if ((error = suser(p)) != 0) return (error); #endif diff --git a/sys/uvm/uvm_swap.c b/sys/uvm/uvm_swap.c index 6d6ef183867..663f05b9562 100644 --- a/sys/uvm/uvm_swap.c +++ b/sys/uvm/uvm_swap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_swap.c,v 1.142 2017/12/30 23:08:29 guenther Exp $ */ +/* $OpenBSD: uvm_swap.c,v 1.143 2018/02/19 08:59:53 mpi Exp $ */ /* $NetBSD: uvm_swap.c,v 1.40 2000/11/17 11:39:39 mrg Exp $ */ /* @@ -668,7 +668,7 @@ sys_swapctl(struct proc *p, void *v, register_t *retval) } /* all other requests require superuser privs. verify. */ - if ((error = suser(p, 0)) || (error = pledge_swapctl(p))) + if ((error = suser(p)) || (error = pledge_swapctl(p))) goto out; /*