diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2003-08-15 20:32:22 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2003-08-15 20:32:22 +0000 |
commit | a1ee01486d4d2da0dce2fd97a58ca548a402d598 (patch) | |
tree | eb06f4625b973fc701bb62d6902e4f1eb40bb4f2 /sys/dev | |
parent | 1a3299929d48eae52404e0b75267c111d07d2af4 (diff) |
change arguments to suser. suser now takes the process, and a flags
argument. old cred only calls user suser_ucred. this will allow future
work to more flexibly implement the idea of a root process. looks like
something i saw in freebsd, but a little different.
use of suser_ucred vs suser in file system code should be looked at again,
for the moment semantics remain unchanged.
review and input from art@ testing and further review miod@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/cons.c | 4 | ||||
-rw-r--r-- | sys/dev/ic/an.c | 6 | ||||
-rw-r--r-- | sys/dev/ic/awi_wep.c | 5 | ||||
-rw-r--r-- | sys/dev/ic/com.c | 4 | ||||
-rw-r--r-- | sys/dev/ic/cy.c | 4 | ||||
-rw-r--r-- | sys/dev/ic/if_wi.c | 10 | ||||
-rw-r--r-- | sys/dev/ic/if_wi_hostap.c | 8 | ||||
-rw-r--r-- | sys/dev/ic/z8530tty.c | 4 | ||||
-rw-r--r-- | sys/dev/ofw/ofcons.c | 4 | ||||
-rw-r--r-- | sys/dev/pci/cz.c | 4 | ||||
-rw-r--r-- | sys/dev/pci/if_lmc.c | 4 | ||||
-rw-r--r-- | sys/dev/pci/wdt.c | 4 | ||||
-rw-r--r-- | sys/dev/rnd.c | 10 | ||||
-rw-r--r-- | sys/dev/sbus/magma.c | 4 | ||||
-rw-r--r-- | sys/dev/sbus/spif.c | 4 | ||||
-rw-r--r-- | sys/dev/systrace.c | 6 | ||||
-rw-r--r-- | sys/dev/usb/ucom.c | 4 | ||||
-rw-r--r-- | sys/dev/vnd.c | 4 | ||||
-rw-r--r-- | sys/dev/wscons/wsdisplay_compat_usl.c | 4 | ||||
-rw-r--r-- | sys/dev/wscons/wskbd.c | 6 |
20 files changed, 53 insertions, 50 deletions
diff --git a/sys/dev/cons.c b/sys/dev/cons.c index bfeec64913b..7d4f72dffea 100644 --- a/sys/dev/cons.c +++ b/sys/dev/cons.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cons.c,v 1.12 2003/06/16 18:44:11 millert Exp $ */ +/* $OpenBSD: cons.c,v 1.13 2003/08/15 20:32:16 tedu Exp $ */ /* $NetBSD: cons.c,v 1.30 1996/04/08 19:57:30 jonathan Exp $ */ /* @@ -179,7 +179,7 @@ cnioctl(dev, cmd, data, flag, p) * output from the "virtual" console. */ if (cmd == TIOCCONS && constty != NULL) { - error = suser(p->p_ucred, (u_short *) NULL); + error = suser(p, SUSER_NOACCT); if (error) return (error); constty = NULL; diff --git a/sys/dev/ic/an.c b/sys/dev/ic/an.c index ee6adcbae24..80c20a42765 100644 --- a/sys/dev/ic/an.c +++ b/sys/dev/ic/an.c @@ -1,4 +1,4 @@ -/* $OpenBSD: an.c,v 1.27 2003/06/25 22:28:14 mickey Exp $ */ +/* $OpenBSD: an.c,v 1.28 2003/08/15 20:32:16 tedu Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -1062,7 +1062,7 @@ an_ioctl(ifp, command, data) break; #ifdef ANCACHE if (areq.an_type == AN_RID_ZERO_CACHE) { - error = suser(p->p_ucred, &p->p_acflag); + error = suser(p, 0); if (error) break; sc->an_sigitems = sc->an_nextitem = 0; @@ -1086,7 +1086,7 @@ an_ioctl(ifp, command, data) error = copyout(&areq, ifr->ifr_data, sizeof(areq)); break; case SIOCSAIRONET: - error = suser(p->p_ucred, &p->p_acflag); + error = suser(p, 0); if (error) break; error = copyin(ifr->ifr_data, &areq, sizeof(areq)); diff --git a/sys/dev/ic/awi_wep.c b/sys/dev/ic/awi_wep.c index 14daa17b8ee..c0b611f99c3 100644 --- a/sys/dev/ic/awi_wep.c +++ b/sys/dev/ic/awi_wep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: awi_wep.c,v 1.8 2002/03/14 01:26:54 millert Exp $ */ +/* $OpenBSD: awi_wep.c,v 1.9 2003/08/15 20:32:16 tedu Exp $ */ /* $NetBSD: awi_wep.c,v 1.2 2000/07/04 14:47:58 onoe Exp $ */ /* @@ -207,6 +207,9 @@ awi_wep_getnwkey(sc, nwkey) #ifdef __FreeBSD__ suerr = suser(curproc); #else +#ifdef __OpenBSD__ + suerr = suser(curproc, 0); +#else suerr = suser(curproc->p_ucred, &curproc->p_acflag); #endif error = 0; diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c index f34f3d7f95d..c451bb6db23 100644 --- a/sys/dev/ic/com.c +++ b/sys/dev/ic/com.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com.c,v 1.91 2003/07/15 03:15:58 jason Exp $ */ +/* $OpenBSD: com.c,v 1.92 2003/08/15 20:32:16 tedu Exp $ */ /* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */ /* @@ -884,7 +884,7 @@ comioctl(dev, cmd, data, flag, p) case TIOCSFLAGS: { int userbits, driverbits = 0; - error = suser(p->p_ucred, &p->p_acflag); + error = suser(p, 0); if (error != 0) return(EPERM); diff --git a/sys/dev/ic/cy.c b/sys/dev/ic/cy.c index c1c4908476a..04fb4d49c20 100644 --- a/sys/dev/ic/cy.c +++ b/sys/dev/ic/cy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cy.c,v 1.22 2003/08/05 16:14:47 markus Exp $ */ +/* $OpenBSD: cy.c,v 1.23 2003/08/15 20:32:17 tedu Exp $ */ /* * Copyright (c) 1996 Timo Rossi. * All rights reserved. @@ -589,7 +589,7 @@ cyioctl(dev, cmd, data, flag, p) break; case TIOCSFLAGS: - error = suser(p->p_ucred, &p->p_acflag); + error = suser(p, 0); if (error != 0) return (EPERM); diff --git a/sys/dev/ic/if_wi.c b/sys/dev/ic/if_wi.c index a14bf871442..5b195d646cc 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.96 2003/06/07 21:14:42 mickey Exp $ */ +/* $OpenBSD: if_wi.c,v 1.97 2003/08/15 20:32:17 tedu Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -124,7 +124,7 @@ u_int32_t widebug = WIDEBUG; #if !defined(lint) && !defined(__OpenBSD__) static const char rcsid[] = - "$OpenBSD: if_wi.c,v 1.96 2003/06/07 21:14:42 mickey Exp $"; + "$OpenBSD: if_wi.c,v 1.97 2003/08/15 20:32:17 tedu Exp $"; #endif /* lint */ #ifdef foo @@ -1515,7 +1515,7 @@ wi_ioctl(ifp, command, data) case SIOCS80211NWID: case SIOCS80211NWKEY: case SIOCS80211POWER: - error = suser(p->p_ucred, &p->p_acflag); + error = suser(p, 0); if (error) { splx(s); return (error); @@ -1603,7 +1603,7 @@ wi_ioctl(ifp, command, data) break; case WI_RID_DEFLT_CRYPT_KEYS: /* For non-root user, return all-zeroes keys */ - if (suser(p->p_ucred, &p->p_acflag)) + if (suser(p, 0)) bzero((char *)&wreq, sizeof(struct wi_ltv_keys)); else @@ -2755,7 +2755,7 @@ wi_get_nwkey(sc, nwkey) nwkey->i_defkid = sc->wi_tx_key + 1; /* do not show any keys to non-root user */ - error = suser(curproc->p_ucred, &curproc->p_acflag); + error = suser(curproc, 0); 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 0d6f069c2b1..6be36bd6e73 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.25 2003/05/16 02:30:40 millert Exp $ */ +/* $OpenBSD: if_wi_hostap.c,v 1.26 2003/08/15 20:32:17 tedu Exp $ */ /* * Copyright (c) 2002 @@ -1203,7 +1203,7 @@ wihap_ioctl(struct wi_softc *sc, u_long command, caddr_t data) switch (command) { case SIOCHOSTAP_DEL: - if ((error = suser(p->p_ucred, &p->p_acflag))) + if ((error = suser(p, 0))) break; if ((error = copyin(ifr->ifr_data, &reqsta, sizeof(reqsta)))) break; @@ -1247,7 +1247,7 @@ wihap_ioctl(struct wi_softc *sc, u_long command, caddr_t data) break; case SIOCHOSTAP_ADD: - if ((error = suser(p->p_ucred, &p->p_acflag))) + if ((error = suser(p, 0))) break; if ((error = copyin(ifr->ifr_data, &reqsta, sizeof(reqsta)))) break; @@ -1270,7 +1270,7 @@ wihap_ioctl(struct wi_softc *sc, u_long command, caddr_t data) break; case SIOCHOSTAP_SFLAGS: - if ((error = suser(p->p_ucred, &p->p_acflag))) + if ((error = suser(p, 0))) 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 98d6d66f874..c414f09358f 100644 --- a/sys/dev/ic/z8530tty.c +++ b/sys/dev/ic/z8530tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: z8530tty.c,v 1.12 2003/06/02 23:28:02 millert Exp $ */ +/* $OpenBSD: z8530tty.c,v 1.13 2003/08/15 20:32:17 tedu Exp $ */ /* $NetBSD: z8530tty.c,v 1.13 1996/10/16 20:42:14 gwr Exp $ */ /* @@ -536,7 +536,7 @@ zsioctl(dev, cmd, data, flag, p) break; case TIOCSFLAGS: - error = suser(p->p_ucred, &p->p_acflag); + error = suser(p, 0); if (error != 0) return (EPERM); tmp = *(int *)data; diff --git a/sys/dev/ofw/ofcons.c b/sys/dev/ofw/ofcons.c index ee04c8dd04f..65e7a49c00b 100644 --- a/sys/dev/ofw/ofcons.c +++ b/sys/dev/ofw/ofcons.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ofcons.c,v 1.10 2003/04/27 11:22:53 ho Exp $ */ +/* $OpenBSD: ofcons.c,v 1.11 2003/08/15 20:32:17 tedu Exp $ */ /* $NetBSD: ofcons.c,v 1.3 1996/10/13 01:38:11 christos Exp $ */ /* @@ -150,7 +150,7 @@ ofcopen(dev, flag, mode, p) tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED; ofcparam(tp, &tp->t_termios); ttsetwater(tp); - } else if ((tp->t_state&TS_XCLUDE) && suser(p->p_ucred, &p->p_acflag)) + } else if ((tp->t_state&TS_XCLUDE) && suser(p, 0)) return EBUSY; tp->t_state |= TS_CARR_ON; diff --git a/sys/dev/pci/cz.c b/sys/dev/pci/cz.c index 0b7178c2ca7..dfd8bc4bce5 100644 --- a/sys/dev/pci/cz.c +++ b/sys/dev/pci/cz.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cz.c,v 1.7 2003/08/11 05:03:10 mickey Exp $ */ +/* $OpenBSD: cz.c,v 1.8 2003/08/15 20:32:17 tedu Exp $ */ /* $NetBSD: cz.c,v 1.15 2001/01/20 19:10:36 thorpej Exp $ */ /*- @@ -1174,7 +1174,7 @@ czttyioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) break; case TIOCSFLAGS: - error = suser(p->p_ucred, &p->p_acflag); + error = suser(p, 0); if (error) break; sc->sc_swflags = *(int *)data; diff --git a/sys/dev/pci/if_lmc.c b/sys/dev/pci/if_lmc.c index e6df0b65203..2b2d581e870 100644 --- a/sys/dev/pci/if_lmc.c +++ b/sys/dev/pci/if_lmc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_lmc.c,v 1.15 2002/06/30 13:04:36 itojun Exp $ */ +/* $OpenBSD: if_lmc.c,v 1.16 2003/08/15 20:32:17 tedu Exp $ */ /* $NetBSD: if_lmc.c,v 1.1 1999/03/25 03:32:43 explorer Exp $ */ /*- @@ -1216,7 +1216,7 @@ lmc_ifioctl(struct ifnet * ifp, ioctl_cmd_t cmd, caddr_t data) break; case LMCIOCSINFO: - error = suser(p->p_ucred, &p->p_acflag); + error = suser(p, 0); if (error) goto out; diff --git a/sys/dev/pci/wdt.c b/sys/dev/pci/wdt.c index 9d1a8f33afa..0f93ddeb3bf 100644 --- a/sys/dev/pci/wdt.c +++ b/sys/dev/pci/wdt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wdt.c,v 1.4 2002/03/14 01:27:00 millert Exp $ */ +/* $OpenBSD: wdt.c,v 1.5 2003/08/15 20:32:17 tedu Exp $ */ /*- * Copyright (c) 1998,1999 Alex Nash @@ -579,7 +579,7 @@ wdt_sched (struct wdt_softc *wdt, struct proc *p) * if the counters aren't reloaded within wdt->timeout_secs * seconds. */ - if ((error = suser(p->p_ucred, &p->p_acflag))) + if ((error = suser(p, 0))) return(error); /* block out the timeout handler */ diff --git a/sys/dev/rnd.c b/sys/dev/rnd.c index 391baa805ce..a90b8ebfde3 100644 --- a/sys/dev/rnd.c +++ b/sys/dev/rnd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rnd.c,v 1.62 2002/11/25 10:09:24 mickey Exp $ */ +/* $OpenBSD: rnd.c,v 1.63 2003/08/15 20:32:16 tedu Exp $ */ /* * rnd.c -- A strong random number generator @@ -1163,7 +1163,7 @@ randomioctl(dev, cmd, data, flag, p) splx(s); break; case RNDADDTOENTCNT: - if (suser(p->p_ucred, &p->p_acflag) != 0) + if (suser(p, 0) != 0) ret = EPERM; else { cnt = *(u_int *)data; @@ -1175,7 +1175,7 @@ randomioctl(dev, cmd, data, flag, p) } break; case RNDZAPENTCNT: - if (suser(p->p_ucred, &p->p_acflag) != 0) + if (suser(p, 0) != 0) ret = EPERM; else { s = splhigh(); @@ -1184,7 +1184,7 @@ randomioctl(dev, cmd, data, flag, p) } break; case RNDSTIRARC4: - if (suser(p->p_ucred, &p->p_acflag) != 0) + if (suser(p, 0) != 0) ret = EPERM; else if (random_state.entropy_count < 64) ret = EAGAIN; @@ -1195,7 +1195,7 @@ randomioctl(dev, cmd, data, flag, p) } break; case RNDCLRSTATS: - if (suser(p->p_ucred, &p->p_acflag) != 0) + if (suser(p, 0) != 0) ret = EPERM; else { s = splhigh(); diff --git a/sys/dev/sbus/magma.c b/sys/dev/sbus/magma.c index bfce5aa56d7..1faaf4f937c 100644 --- a/sys/dev/sbus/magma.c +++ b/sys/dev/sbus/magma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: magma.c,v 1.10 2003/07/15 03:47:43 jason Exp $ */ +/* $OpenBSD: magma.c,v 1.11 2003/08/15 20:32:17 tedu Exp $ */ /* * magma.c * @@ -1065,7 +1065,7 @@ mttyioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p) break; case TIOCSFLAGS: - if (suser(p->p_ucred, &p->p_acflag)) + if (suser(p, 0)) error = EPERM; else mp->mp_openflags = *((int *)data) & diff --git a/sys/dev/sbus/spif.c b/sys/dev/sbus/spif.c index 8175fd26cb7..c559c31517d 100644 --- a/sys/dev/sbus/spif.c +++ b/sys/dev/sbus/spif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spif.c,v 1.9 2003/06/27 00:27:17 jason Exp $ */ +/* $OpenBSD: spif.c,v 1.10 2003/08/15 20:32:17 tedu Exp $ */ /* * Copyright (c) 1999-2002 Jason L. Wright (jason@thought.net) @@ -515,7 +515,7 @@ sttyioctl(dev, cmd, data, flags, p) *((int *)data) = sp->sp_openflags; break; case TIOCSFLAGS: - if (suser(p->p_ucred, &p->p_acflag)) + if (suser(p, 0)) error = EPERM; else sp->sp_openflags = *((int *)data) & diff --git a/sys/dev/systrace.c b/sys/dev/systrace.c index d31b6914da3..d7c8972207d 100644 --- a/sys/dev/systrace.c +++ b/sys/dev/systrace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: systrace.c,v 1.30 2003/06/16 06:36:40 itojun Exp $ */ +/* $OpenBSD: systrace.c,v 1.31 2003/08/15 20:32:16 tedu Exp $ */ /* * Copyright 2002 Niels Provos <provos@citi.umich.edu> * All rights reserved. @@ -533,7 +533,7 @@ systraceioctl(dev, cmd, data, flag, p) TAILQ_INIT(&fst->messages); TAILQ_INIT(&fst->policies); - if (suser(p->p_ucred, &p->p_acflag) == 0) + if (suser(p, 0) == 0) fst->issuser = 1; fst->p_ruid = p->p_cred->p_ruid; fst->p_rgid = p->p_cred->p_rgid; @@ -1155,7 +1155,7 @@ systrace_attach(struct fsystrace *fst, pid_t pid) */ if ((proc->p_cred->p_ruid != p->p_cred->p_ruid || ISSET(proc->p_flag, P_SUGID)) && - (error = suser(p->p_ucred, &p->p_acflag)) != 0) + (error = suser(p, 0)) != 0) goto out; /* diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c index 74869e2cffc..5bfb473a61d 100644 --- a/sys/dev/usb/ucom.c +++ b/sys/dev/usb/ucom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ucom.c,v 1.18 2003/05/19 00:33:00 nate Exp $ */ +/* $OpenBSD: ucom.c,v 1.19 2003/08/15 20:32:18 tedu Exp $ */ /* $NetBSD: ucom.c,v 1.49 2003/01/01 00:10:25 thorpej Exp $ */ /* @@ -692,7 +692,7 @@ ucom_do_ioctl(struct ucom_softc *sc, u_long cmd, caddr_t data, break; case TIOCSFLAGS: - error = suser(p->p_ucred, &p->p_acflag); + error = suser(p, 0); if (error) break; sc->sc_swflags = *(int *)data; diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c index 1cdb2aac31f..77104c0b898 100644 --- a/sys/dev/vnd.c +++ b/sys/dev/vnd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vnd.c,v 1.38 2003/06/02 23:28:01 millert Exp $ */ +/* $OpenBSD: vnd.c,v 1.39 2003/08/15 20:32:16 tedu Exp $ */ /* $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $ */ /* @@ -757,7 +757,7 @@ vndioctl(dev, cmd, addr, flag, p) printf("vndioctl(%x, %lx, %p, %x, %p): unit %d\n", dev, cmd, addr, flag, p, unit); #endif - error = suser(p->p_ucred, &p->p_acflag); + error = suser(p, 0); if (error) return (error); if (unit >= numvnd) diff --git a/sys/dev/wscons/wsdisplay_compat_usl.c b/sys/dev/wscons/wsdisplay_compat_usl.c index 2c4b76ee8d0..9afc8297581 100644 --- a/sys/dev/wscons/wsdisplay_compat_usl.c +++ b/sys/dev/wscons/wsdisplay_compat_usl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsdisplay_compat_usl.c,v 1.13 2003/08/11 17:43:05 millert Exp $ */ +/* $OpenBSD: wsdisplay_compat_usl.c,v 1.14 2003/08/15 20:32:18 tedu Exp $ */ /* $NetBSD: wsdisplay_compat_usl.c,v 1.12 2000/03/23 07:01:47 thorpej Exp $ */ /* @@ -432,7 +432,7 @@ wsdisplay_usl_ioctl2(sc, scr, cmd, data, flag, p) return (0); case KDENABIO: - if (suser(p->p_ucred, &p->p_acflag) || securelevel > 1) + if (suser(p, 0) || securelevel > 1) return (EPERM); /* FALLTHRU */ case KDDISABIO: diff --git a/sys/dev/wscons/wskbd.c b/sys/dev/wscons/wskbd.c index 1fcc522e611..c163ff838c7 100644 --- a/sys/dev/wscons/wskbd.c +++ b/sys/dev/wscons/wskbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wskbd.c,v 1.35 2003/06/02 23:28:04 millert Exp $ */ +/* $OpenBSD: wskbd.c,v 1.36 2003/08/15 20:32:18 tedu Exp $ */ /* $NetBSD: wskbd.c,v 1.38 2000/03/23 07:01:47 thorpej Exp $ */ /* @@ -934,7 +934,7 @@ getbell: return (0); case WSKBDIO_SETDEFAULTBELL: - if ((error = suser(p->p_ucred, &p->p_acflag)) != 0) + if ((error = suser(p, 0)) != 0) return (error); kbdp = &wskbd_default_bell_data; goto setbell; @@ -977,7 +977,7 @@ getkeyrepeat: return (0); case WSKBDIO_SETDEFAULTKEYREPEAT: - if ((error = suser(p->p_ucred, &p->p_acflag)) != 0) + if ((error = suser(p, 0)) != 0) return (error); kkdp = &wskbd_default_keyrepeat_data; goto setkeyrepeat; |