diff options
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_acct.c | 4 | ||||
-rw-r--r-- | sys/kern/kern_descrip.c | 4 | ||||
-rw-r--r-- | sys/kern/kern_ktrace.c | 4 | ||||
-rw-r--r-- | sys/kern/kern_prot.c | 45 | ||||
-rw-r--r-- | sys/kern/kern_resource.c | 6 | ||||
-rw-r--r-- | sys/kern/kern_sig.c | 4 | ||||
-rw-r--r-- | sys/kern/kern_sysctl.c | 24 | ||||
-rw-r--r-- | sys/kern/kern_time.c | 10 | ||||
-rw-r--r-- | sys/kern/kern_xxx.c | 4 | ||||
-rw-r--r-- | sys/kern/subr_log.c | 4 | ||||
-rw-r--r-- | sys/kern/sys_process.c | 8 | ||||
-rw-r--r-- | sys/kern/tty.c | 4 | ||||
-rw-r--r-- | sys/kern/tty_endrun.c | 4 | ||||
-rw-r--r-- | sys/kern/tty_msts.c | 4 | ||||
-rw-r--r-- | sys/kern/tty_nmea.c | 4 | ||||
-rw-r--r-- | sys/kern/tty_pty.c | 4 | ||||
-rw-r--r-- | sys/kern/tty_tty.c | 4 | ||||
-rw-r--r-- | sys/kern/uipc_socket.c | 6 | ||||
-rw-r--r-- | sys/kern/uipc_syscalls.c | 4 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 32 |
20 files changed, 90 insertions, 93 deletions
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 <mbalmer@openbsd.org> @@ -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 <mbalmer@openbsd.org> @@ -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 <mbalmer@openbsd.org> @@ -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); |