diff options
author | John Baldwin <jhb@FreeBSD.org> | 2002-04-01 21:31:13 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2002-04-01 21:31:13 +0000 |
commit | 44731cab3b9966b7ca67f3fe50e7f3c711533730 (patch) | |
tree | 79021f0d43a5858be317d5cd33eac8cd4962b336 /sys/dev | |
parent | a4a49508b4ddf1b482743f71bcd6707c9ce7b406 (diff) | |
download | src-44731cab3b9966b7ca67f3fe50e7f3c711533730.tar.gz src-44731cab3b9966b7ca67f3fe50e7f3c711533730.zip |
Change the suser() API to take advantage of td_ucred as well as do a
general cleanup of the API. The entire API now consists of two functions
similar to the pre-KSE API. The suser() function takes a thread pointer
as its only argument. The td_ucred member of this thread must be valid
so the only valid thread pointers are curthread and a few kernel threads
such as thread0. The suser_cred() function takes a pointer to a struct
ucred as its first argument and an integer flag as its second argument.
The flag is currently only used for the PRISON_ROOT flag.
Discussed on: smp@
Notes
Notes:
svn path=/head/; revision=93593
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/an/if_an.c | 10 | ||||
-rw-r--r-- | sys/dev/asr/asr.c | 2 | ||||
-rw-r--r-- | sys/dev/ata/atapi-cd.c | 2 | ||||
-rw-r--r-- | sys/dev/awi/awi.c | 16 | ||||
-rw-r--r-- | sys/dev/awi/awi_wep.c | 4 | ||||
-rw-r--r-- | sys/dev/awi/awi_wicfg.c | 8 | ||||
-rw-r--r-- | sys/dev/cnw/if_cnw.c | 12 | ||||
-rw-r--r-- | sys/dev/cy/cy.c | 6 | ||||
-rw-r--r-- | sys/dev/cy/cy_isa.c | 6 | ||||
-rw-r--r-- | sys/dev/dgb/dgb.c | 6 | ||||
-rw-r--r-- | sys/dev/digi/digi.c | 6 | ||||
-rw-r--r-- | sys/dev/fdc/fdc.c | 8 | ||||
-rw-r--r-- | sys/dev/nmdm/nmdm.c | 2 | ||||
-rw-r--r-- | sys/dev/null/null.c | 2 | ||||
-rw-r--r-- | sys/dev/ofw/ofw_console.c | 2 | ||||
-rw-r--r-- | sys/dev/random/randomdev.c | 4 | ||||
-rw-r--r-- | sys/dev/rc/rc.c | 4 | ||||
-rw-r--r-- | sys/dev/rp/rp.c | 6 | ||||
-rw-r--r-- | sys/dev/sbni/if_sbni.c | 8 | ||||
-rw-r--r-- | sys/dev/si/si.c | 10 | ||||
-rw-r--r-- | sys/dev/sio/sio.c | 6 | ||||
-rw-r--r-- | sys/dev/syscons/syscons.c | 4 | ||||
-rw-r--r-- | sys/dev/syscons/sysmouse.c | 2 | ||||
-rw-r--r-- | sys/dev/usb/ucom.c | 2 | ||||
-rw-r--r-- | sys/dev/usb/umodem.c | 2 | ||||
-rw-r--r-- | sys/dev/vinum/vinum.c | 2 | ||||
-rw-r--r-- | sys/dev/wi/if_wi.c | 12 | ||||
-rw-r--r-- | sys/dev/wl/if_wl.c | 10 |
28 files changed, 99 insertions, 65 deletions
diff --git a/sys/dev/an/if_an.c b/sys/dev/an/if_an.c index e713796f609f..826d06918912 100644 --- a/sys/dev/an/if_an.c +++ b/sys/dev/an/if_an.c @@ -1266,7 +1266,7 @@ an_ioctl(ifp, command, data) int i; struct an_softc *sc; struct ifreq *ifr; - struct proc *p = curproc; + struct thread *td = curthread; struct ieee80211req *ireq; u_int8_t tmpstr[IEEE80211_NWID_LEN*2]; u_int8_t *tmpptr; @@ -1353,7 +1353,7 @@ an_ioctl(ifp, command, data) error = copyout(&sc->areq, ifr->ifr_data, sizeof(sc->areq)); break; case SIOCSAIRONET: - if ((error = suser(p))) + if ((error = suser(td))) goto out; error = copyin(ifr->ifr_data, &sc->areq, sizeof(sc->areq)); if (error != 0) @@ -1361,7 +1361,7 @@ an_ioctl(ifp, command, data) an_setdef(sc, &sc->areq); break; case SIOCGPRIVATE_0: /* used by Cisco client utility */ - if ((error = suser(p))) + if ((error = suser(td))) goto out; copyin(ifr->ifr_data, &l_ioctl, sizeof(l_ioctl)); mode = l_ioctl.command; @@ -1381,7 +1381,7 @@ an_ioctl(ifp, command, data) break; case SIOCGPRIVATE_1: /* used by Cisco client utility */ - if ((error = suser(p))) + if ((error = suser(td))) goto out; copyin(ifr->ifr_data, &l_ioctl, sizeof(l_ioctl)); l_ioctl.command = 0; @@ -1614,7 +1614,7 @@ an_ioctl(ifp, command, data) } break; case SIOCS80211: - if ((error = suser(p))) + if ((error = suser(td))) goto out; sc->areq.an_len = sizeof(sc->areq); /* diff --git a/sys/dev/asr/asr.c b/sys/dev/asr/asr.c index cdef43d8be63..a232d62f93d8 100644 --- a/sys/dev/asr/asr.c +++ b/sys/dev/asr/asr.c @@ -3879,7 +3879,7 @@ asr_open( s = splcam (); if (ASR_ctlr_held) { error = EBUSY; - } else if ((error = suser(td->td_proc)) == 0) { + } else if ((error = suser(td)) == 0) { ++ASR_ctlr_held; } splx(s); diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c index c4d1528bbd25..51cc51d9fe60 100644 --- a/sys/dev/ata/atapi-cd.c +++ b/sys/dev/ata/atapi-cd.c @@ -573,7 +573,7 @@ acdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td) break; case CDIOCRESET: - error = suser(td->td_proc); + error = suser(td); if (error) break; error = atapi_test_ready(cdp->device); diff --git a/sys/dev/awi/awi.c b/sys/dev/awi/awi.c index fe764b04e439..6dfde41e4d25 100644 --- a/sys/dev/awi/awi.c +++ b/sys/dev/awi/awi.c @@ -521,7 +521,11 @@ awi_ioctl(ifp, cmd, data) break; case SIOCS80211NWID: #ifdef __FreeBSD__ +#if __FreeBSD__ >= 5 + error = suser(curthread); +#else error = suser(curproc); +#endif if (error) break; #endif @@ -555,7 +559,11 @@ awi_ioctl(ifp, cmd, data) break; case SIOCS80211NWKEY: #ifdef __FreeBSD__ +#if __FreeBSD__ >= 5 + error = suser(curthread); +#else error = suser(curproc); +#endif if (error) break; #endif @@ -613,7 +621,11 @@ awi_ioctl(ifp, cmd, data) error = awi_wep_getkey(sc, ireq->i_val, tmpstr, &len); if(error) break; +#if __FreeBSD__ >= 5 + if(!suser(curthread)) +#else if(!suser(curproc)) +#endif bzero(tmpstr, len); ireq->i_len = len; error = copyout(tmpstr, ireq->i_data, len); @@ -650,7 +662,11 @@ awi_ioctl(ifp, cmd, data) } break; case SIOCS80211: +#if __FreeBSD__ >= 5 + error = suser(curthread); +#else error = suser(curproc); +#endif if(error) break; switch(ireq->i_type) { diff --git a/sys/dev/awi/awi_wep.c b/sys/dev/awi/awi_wep.c index 750b165d2e2d..bdd38b296dfe 100644 --- a/sys/dev/awi/awi_wep.c +++ b/sys/dev/awi/awi_wep.c @@ -189,7 +189,11 @@ awi_wep_getnwkey(sc, nwkey) nwkey->i_defkid = sc->sc_wep_defkid + 1; /* do not show any keys to non-root user */ #ifdef __FreeBSD__ +#if __FreeBSD__ >= 5 + suerr = suser(curthread); +#else suerr = suser(curproc); +#endif #else suerr = suser(curproc->p_ucred, &curproc->p_acflag); #endif diff --git a/sys/dev/awi/awi_wicfg.c b/sys/dev/awi/awi_wicfg.c index 80b81600fedd..639ea9bfe318 100644 --- a/sys/dev/awi/awi_wicfg.c +++ b/sys/dev/awi/awi_wicfg.c @@ -108,7 +108,11 @@ awi_wicfg(ifp, cmd, data) break; case SIOCSWAVELAN: #ifdef __FreeBSD__ +#if __FreeBSD__ >= 5 + error = suser(curthread); +#else error = suser(curproc); +#endif #else error = suser(curproc->p_ucred, &curproc->p_acflag); #endif @@ -272,7 +276,11 @@ awi_cfgget(ifp, cmd, data) keys = (struct wi_ltv_keys *)&wreq; /* do not show keys to non-root user */ #ifdef __FreeBSD__ +#if __FreeBSD__ >= 5 + error = suser(curthread); +#else error = suser(curproc); +#endif #else error = suser(curproc->p_ucred, &curproc->p_acflag); #endif diff --git a/sys/dev/cnw/if_cnw.c b/sys/dev/cnw/if_cnw.c index d17f6cd45b02..80ebef59838a 100644 --- a/sys/dev/cnw/if_cnw.c +++ b/sys/dev/cnw/if_cnw.c @@ -1239,7 +1239,11 @@ cnw_ioctl(ifp, cmd, data) #endif struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; - struct proc *p = curproc; /*XXX*/ +#if __FreeBSD__ >= 5 + struct thread *td = curthread; /* XXX */ +#else + struct proc *td = curproc; /*XXX*/ +#endif s = splnet(); @@ -1331,7 +1335,7 @@ cnw_ioctl(ifp, cmd, data) #if !defined(__FreeBSD__) error = suser(p->p_ucred, &p->p_acflag); #else - error = suser(p); + error = suser(td); #endif if (error) break; @@ -1342,7 +1346,7 @@ cnw_ioctl(ifp, cmd, data) #if !defined(__FreeBSD__) error = suser(p->p_ucred, &p->p_acflag); #else - error = suser(p); + error = suser(td); #endif if (error) break; @@ -1353,7 +1357,7 @@ cnw_ioctl(ifp, cmd, data) #if !defined(__FreeBSD__) error = suser(p->p_ucred, &p->p_acflag); #else - error = suser(p); + error = suser(td); #endif if (error) break; diff --git a/sys/dev/cy/cy.c b/sys/dev/cy/cy.c index dc523c2d72bd..f42bdb348f6c 100644 --- a/sys/dev/cy/cy.c +++ b/sys/dev/cy/cy.c @@ -718,7 +718,7 @@ open_top: } } if (tp->t_state & TS_XCLUDE && - suser_td(td)) { + suser(td)) { error = EBUSY; goto out; } @@ -1637,7 +1637,7 @@ sioioctl(dev, cmd, data, flag, td) } switch (cmd) { case TIOCSETA: - error = suser_td(td); + error = suser(td); if (error != 0) return (error); *ct = *(struct termios *)data; @@ -1736,7 +1736,7 @@ sioioctl(dev, cmd, data, flag, td) break; case TIOCMSDTRWAIT: /* must be root since the wait applies to following logins */ - error = suser_td(td); + error = suser(td); if (error != 0) { splx(s); return (error); diff --git a/sys/dev/cy/cy_isa.c b/sys/dev/cy/cy_isa.c index dc523c2d72bd..f42bdb348f6c 100644 --- a/sys/dev/cy/cy_isa.c +++ b/sys/dev/cy/cy_isa.c @@ -718,7 +718,7 @@ open_top: } } if (tp->t_state & TS_XCLUDE && - suser_td(td)) { + suser(td)) { error = EBUSY; goto out; } @@ -1637,7 +1637,7 @@ sioioctl(dev, cmd, data, flag, td) } switch (cmd) { case TIOCSETA: - error = suser_td(td); + error = suser(td); if (error != 0) return (error); *ct = *(struct termios *)data; @@ -1736,7 +1736,7 @@ sioioctl(dev, cmd, data, flag, td) break; case TIOCMSDTRWAIT: /* must be root since the wait applies to following logins */ - error = suser_td(td); + error = suser(td); if (error != 0) { splx(s); return (error); diff --git a/sys/dev/dgb/dgb.c b/sys/dev/dgb/dgb.c index 4d36f2e1ade8..c276ed3518ad 100644 --- a/sys/dev/dgb/dgb.c +++ b/sys/dev/dgb/dgb.c @@ -1050,7 +1050,7 @@ open_top: } } if (tp->t_state & TS_XCLUDE && - suser_td(td)) { + suser(td)) { error = EBUSY; goto out; } @@ -1548,7 +1548,7 @@ dgbioctl(dev, cmd, data, flag, td) } switch (cmd) { case TIOCSETA: - error = suser_td(td); + error = suser(td); if (error != 0) return (error); *ct = *(struct termios *)data; @@ -1770,7 +1770,7 @@ dgbioctl(dev, cmd, data, flag, td) break; case TIOCMSDTRWAIT: /* must be root since the wait applies to following logins */ - error = suser_td(td); + error = suser(td); if (error != 0) { splx(s); return (error); diff --git a/sys/dev/digi/digi.c b/sys/dev/digi/digi.c index 2f069c53f4b6..df4df2aed944 100644 --- a/sys/dev/digi/digi.c +++ b/sys/dev/digi/digi.c @@ -783,7 +783,7 @@ open_top: } goto open_top; } - if (tp->t_state & TS_XCLUDE && suser(td->td_proc) != 0) { + if (tp->t_state & TS_XCLUDE && suser(td) != 0) { error = EBUSY; goto out; } @@ -1146,7 +1146,7 @@ digiioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) switch (cmd) { case TIOCSETA: - error = suser_td(td); + error = suser(td); if (error != 0) return (error); *ct = *(struct termios *)data; @@ -1317,7 +1317,7 @@ digiioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) *(int *)data = digimctl(port, 0, DMGET); break; case TIOCMSDTRWAIT: - error = suser_td(td); + error = suser(td); if (error != 0) { splx(s); return (error); diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index 0d659ab465ca..6fe54cd7b9cf 100644 --- a/sys/dev/fdc/fdc.c +++ b/sys/dev/fdc/fdc.c @@ -2644,7 +2644,7 @@ fdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) * Set density definition permanently. Only * allow for superuser. */ - if (suser_td(td) != 0) + if (suser(td) != 0) return (EPERM); fd->fts[type] = *(struct fd_type *)addr; } @@ -2669,7 +2669,7 @@ fdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) #endif case FD_CLRERR: - if (suser_td(td) != 0) + if (suser(td) != 0) return (EPERM); fd->fdc->fdc_errs = 0; return (0); @@ -2751,7 +2751,7 @@ fdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) case FD_STYPE: /* set drive type */ /* this is considered harmful; only allow for superuser */ - if (suser_td(td) != 0) + if (suser(td) != 0) return (EPERM); *fd->ft = *(struct fd_type *)addr; break; @@ -2775,7 +2775,7 @@ fdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) #endif case FD_CLRERR: - if (suser_td(td) != 0) + if (suser(td) != 0) return (EPERM); fd->fdc->fdc_errs = 0; break; diff --git a/sys/dev/nmdm/nmdm.c b/sys/dev/nmdm/nmdm.c index 10d5d7044a71..6037451eeb67 100644 --- a/sys/dev/nmdm/nmdm.c +++ b/sys/dev/nmdm/nmdm.c @@ -209,7 +209,7 @@ nmdmopen(dev_t dev, int flag, int devtype, struct thread *td) tp->t_lflag = TTYDEF_LFLAG; tp->t_cflag = TTYDEF_CFLAG; tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED; - } else if (tp->t_state & TS_XCLUDE && suser_td(td)) { + } else if (tp->t_state & TS_XCLUDE && suser(td)) { return (EBUSY); } else if (pti->pt_prison != td->td_ucred->cr_prison) { return (EBUSY); diff --git a/sys/dev/null/null.c b/sys/dev/null/null.c index ec0d521270e8..043843dfeb22 100644 --- a/sys/dev/null/null.c +++ b/sys/dev/null/null.c @@ -99,7 +99,7 @@ null_ioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct thread *td) if (cmd != DIOCGKERNELDUMP) return (noioctl(dev, cmd, data, fflag, td)); - error = suser_td(td); + error = suser(td); if (error) return (error); return (set_dumper(NULL)); diff --git a/sys/dev/ofw/ofw_console.c b/sys/dev/ofw/ofw_console.c index 154f7ff4118e..cce7fb884498 100644 --- a/sys/dev/ofw/ofw_console.c +++ b/sys/dev/ofw/ofw_console.c @@ -123,7 +123,7 @@ ofw_dev_open(dev_t dev, int flag, int mode, struct thread *td) ttsetwater(tp); setuptimeout = 1; - } else if ((tp->t_state & TS_XCLUDE) && suser_td(td)) { + } else if ((tp->t_state & TS_XCLUDE) && suser(td)) { return (EBUSY); } diff --git a/sys/dev/random/randomdev.c b/sys/dev/random/randomdev.c index bb7440c3522b..9db07a1de523 100644 --- a/sys/dev/random/randomdev.c +++ b/sys/dev/random/randomdev.c @@ -147,7 +147,7 @@ random_open(dev_t dev __unused, int flags, int fmt __unused, struct thread *td) int error; if (flags & FWRITE) { - error = suser(td->td_proc); + error = suser(td); if (error) return (error); error = securelevel_gt(td->td_ucred, 0); @@ -162,7 +162,7 @@ static int random_close(dev_t dev __unused, int flags, int fmt __unused, struct thread *td) { if (flags & FWRITE) { - if (!(suser(td->td_proc) || + if (!(suser(td) || securelevel_gt(td->td_ucred, 0))) random_reseed(); } diff --git a/sys/dev/rc/rc.c b/sys/dev/rc/rc.c index 43f77f93c855..291c0e20f63d 100644 --- a/sys/dev/rc/rc.c +++ b/sys/dev/rc/rc.c @@ -764,7 +764,7 @@ again: } } if (tp->t_state & TS_XCLUDE && - suser_td(td)) { + suser(td)) { error = EBUSY; goto out; } @@ -1118,7 +1118,7 @@ struct thread *td; break; case TIOCMSDTRWAIT: - error = suser_td(td); + error = suser(td); if (error != 0) { splx(s); return (error); diff --git a/sys/dev/rp/rp.c b/sys/dev/rp/rp.c index 53b73686bf6b..3176ca424d3f 100644 --- a/sys/dev/rp/rp.c +++ b/sys/dev/rp/rp.c @@ -1010,7 +1010,7 @@ open_top: goto open_top; } } - if(tp->t_state & TS_XCLUDE && suser_td(td) != 0) { + if(tp->t_state & TS_XCLUDE && suser(td) != 0) { splx(oldspl); error = EBUSY; goto out2; @@ -1271,7 +1271,7 @@ rpioctl(dev, cmd, data, flag, td) } switch (cmd) { case TIOCSETA: - error = suser_td(td); + error = suser(td); if(error != 0) return(error); *ct = *(struct termios *)data; @@ -1416,7 +1416,7 @@ rpioctl(dev, cmd, data, flag, td) *(int *)data = result; break; case TIOCMSDTRWAIT: - error = suser_td(td); + error = suser(td); if(error != 0) { splx(oldspl); return(error); diff --git a/sys/dev/sbni/if_sbni.c b/sys/dev/sbni/if_sbni.c index f4d2887336d6..4be96a47fdba 100644 --- a/sys/dev/sbni/if_sbni.c +++ b/sys/dev/sbni/if_sbni.c @@ -1042,6 +1042,7 @@ sbni_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct sbni_softc *sc; struct ifreq *ifr; + struct thread *td; struct proc *p; struct sbni_in_stats *in_stats; struct sbni_flags flags; @@ -1049,7 +1050,8 @@ sbni_ioctl(struct ifnet *ifp, u_long command, caddr_t data) sc = ifp->if_softc; ifr = (struct ifreq *)data; - p = curproc; + td = curthread; + p = td->td_proc; error = 0; s = splimp(); @@ -1114,7 +1116,7 @@ sbni_ioctl(struct ifnet *ifp, u_long command, caddr_t data) case SIOCSHWFLAGS: /* set flags */ /* root only */ - error = suser(p); + error = suser(td); if (error) break; flags = *(struct sbni_flags*)&ifr->ifr_data; @@ -1136,7 +1138,7 @@ sbni_ioctl(struct ifnet *ifp, u_long command, caddr_t data) break; case SIOCRINSTATS: - if (!(error = suser(p))) /* root only */ + if (!(error = suser(td))) /* root only */ bzero(&sc->in_stats, sizeof(struct sbni_in_stats)); break; diff --git a/sys/dev/si/si.c b/sys/dev/si/si.c index dc1858ffe9fd..1a064ed6ce4c 100644 --- a/sys/dev/si/si.c +++ b/sys/dev/si/si.c @@ -607,7 +607,7 @@ siopen(dev_t dev, int flag, int mode, struct thread *td) /* quickly let in /dev/si_control */ if (IS_CONTROLDEV(mynor)) { - if ((error = suser_td(td))) + if ((error = suser(td))) return(error); return(0); } @@ -686,7 +686,7 @@ open_top: } } if (tp->t_state & TS_XCLUDE && - suser_td(td)) { + suser(td)) { DPRINT((pp, DBG_OPEN|DBG_FAIL, "already open and EXCLUSIVE set\n")); error = EBUSY; @@ -951,7 +951,7 @@ siioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) } switch (cmd) { case TIOCSETA: - error = suser_td(td); + error = suser(td); if (error != 0) return (error); *ct = *(struct termios *)data; @@ -1064,7 +1064,7 @@ siioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) break; case TIOCMSDTRWAIT: /* must be root since the wait applies to following logins */ - error = suser_td(td); + error = suser(td); if (error == 0) pp->sp_dtr_wait = *(int *)data * hz / 100; break; @@ -1117,7 +1117,7 @@ si_Sioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) ip = (int *)data; -#define SUCHECK if ((error = suser_td(td))) goto out +#define SUCHECK if ((error = suser(td))) goto out switch (cmd) { case TCSIPORTS: diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 11894df8d0d8..0c434cb76a84 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -1206,7 +1206,7 @@ open_top: } } if (tp->t_state & TS_XCLUDE && - suser_td(td)) { + suser(td)) { error = EBUSY; goto out; } @@ -1980,7 +1980,7 @@ sioioctl(dev, cmd, data, flag, td) } switch (cmd) { case TIOCSETA: - error = suser_td(td); + error = suser(td); if (error != 0) return (error); *ct = *(struct termios *)data; @@ -2071,7 +2071,7 @@ sioioctl(dev, cmd, data, flag, td) break; case TIOCMSDTRWAIT: /* must be root since the wait applies to following logins */ - error = suser_td(td); + error = suser(td); if (error != 0) { splx(s); return (error); diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index 29d0332695c7..f572f8a97d2e 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -479,7 +479,7 @@ scopen(dev_t dev, int flag, int mode, struct thread *td) (*linesw[tp->t_line].l_modem)(tp, 1); } else - if (tp->t_state & TS_XCLUDE && suser_td(td)) + if (tp->t_state & TS_XCLUDE && suser(td)) return(EBUSY); error = (*linesw[tp->t_line].l_open)(dev, tp); @@ -976,7 +976,7 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) return 0; case KDENABIO: /* allow io operations */ - error = suser_td(td); + error = suser(td); if (error != 0) return error; error = securelevel_gt(td->td_ucred, 0); diff --git a/sys/dev/syscons/sysmouse.c b/sys/dev/syscons/sysmouse.c index 80eac8e5d8a4..310052a49eca 100644 --- a/sys/dev/syscons/sysmouse.c +++ b/sys/dev/syscons/sysmouse.c @@ -99,7 +99,7 @@ smopen(dev_t dev, int flag, int mode, struct thread *td) tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED; smparam(tp, &tp->t_termios); (*linesw[tp->t_line].l_modem)(tp, 1); - } else if (tp->t_state & TS_XCLUDE && suser_td(td)) { + } else if (tp->t_state & TS_XCLUDE && suser(td)) { return EBUSY; } diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c index b4d197ea9be6..8e697fe7e40a 100644 --- a/sys/dev/usb/ucom.c +++ b/sys/dev/usb/ucom.c @@ -257,7 +257,7 @@ ucomopen(dev_t dev, int flag, int mode, usb_proc_ptr p) if (ISSET(tp->t_state, TS_ISOPEN) && ISSET(tp->t_state, TS_XCLUDE) && - suser_td(p)) + suser(p)) return (EBUSY); /* diff --git a/sys/dev/usb/umodem.c b/sys/dev/usb/umodem.c index 3d24746a5c40..d6b4fc88e6f7 100644 --- a/sys/dev/usb/umodem.c +++ b/sys/dev/usb/umodem.c @@ -593,7 +593,7 @@ umodemopen(dev_t dev, int flag, int mode, usb_proc_ptr p) if (ISSET(tp->t_state, TS_ISOPEN) && ISSET(tp->t_state, TS_XCLUDE) && - suser_td(p)) + suser(p)) return (EBUSY); /* diff --git a/sys/dev/vinum/vinum.c b/sys/dev/vinum/vinum.c index 5ea226d5c203..ac98a5e48673 100644 --- a/sys/dev/vinum/vinum.c +++ b/sys/dev/vinum/vinum.c @@ -375,7 +375,7 @@ vinumopen(dev_t dev, } case VINUM_SUPERDEV_TYPE: - error = suser_td(td); /* are we root? */ + error = suser(td); /* are we root? */ if (error == 0) { /* yes, can do */ if (devminor == VINUM_DAEMON_DEV) /* daemon device */ vinum_conf.flags |= VF_DAEMONOPEN; /* we're open */ diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c index 3b88f957a124..71a66ee8daf0 100644 --- a/sys/dev/wi/if_wi.c +++ b/sys/dev/wi/if_wi.c @@ -1672,7 +1672,7 @@ wi_ioctl(ifp, command, data) struct wi_req wreq; struct ifreq *ifr; struct ieee80211req *ireq; - struct proc *p = curproc; + struct thread *td = curthread; sc = ifp->if_softc; WI_LOCK(sc); @@ -1724,7 +1724,7 @@ wi_ioctl(ifp, command, data) if (error) break; /* Don't show WEP keys to non-root users. */ - if (wreq.wi_type == WI_RID_DEFLT_CRYPT_KEYS && suser(p)) + if (wreq.wi_type == WI_RID_DEFLT_CRYPT_KEYS && suser(td)) break; if (wreq.wi_type == WI_RID_IFACE_STATS) { bcopy((char *)&sc->wi_stats, (char *)&wreq.wi_val, @@ -1768,7 +1768,7 @@ wi_ioctl(ifp, command, data) error = copyout(&wreq, ifr->ifr_data, sizeof(wreq)); break; case SIOCSWAVELAN: - if ((error = suser(p))) + if ((error = suser(td))) goto out; error = copyin(ifr->ifr_data, &wreq, sizeof(wreq)); if (error) @@ -1809,7 +1809,7 @@ wi_ioctl(ifp, command, data) error = copyout(&wreq, ifr->ifr_data, sizeof(wreq)); break; case SIOCSPRISM2DEBUG: - if ((error = suser(p))) + if ((error = suser(td))) goto out; error = copyin(ifr->ifr_data, &wreq, sizeof(wreq)); if (error) @@ -1858,7 +1858,7 @@ wi_ioctl(ifp, command, data) break; } len = sc->wi_keys.wi_keys[ireq->i_val].wi_keylen; - if (suser(p)) + if (suser(td)) bcopy(sc->wi_keys.wi_keys[ireq->i_val].wi_keydat, tmpkey, len); else @@ -1911,7 +1911,7 @@ wi_ioctl(ifp, command, data) } break; case SIOCS80211: - if ((error = suser(p))) + if ((error = suser(td))) goto out; switch(ireq->i_type) { case IEEE80211_IOC_SSID: diff --git a/sys/dev/wl/if_wl.c b/sys/dev/wl/if_wl.c index dc9ca96dff03..2563bcd54fba 100644 --- a/sys/dev/wl/if_wl.c +++ b/sys/dev/wl/if_wl.c @@ -1214,7 +1214,7 @@ wlioctl(struct ifnet *ifp, u_long cmd, caddr_t data) /* pointer to buffer in user space */ up = (void *)ifr->ifr_data; /* work out if they're root */ - isroot = (suser_td(td) == 0); + isroot = (suser(td) == 0); for (i = 0; i < 0x40; i++) { /* don't hand the DES key out to non-root users */ @@ -1229,7 +1229,7 @@ wlioctl(struct ifnet *ifp, u_long cmd, caddr_t data) /* copy the PSA in from the caller; we only copy _some_ values */ case SIOCSWLPSA: /* root only */ - if ((error = suser_td(td))) + if ((error = suser(td))) break; error = EINVAL; /* assume the worst */ /* pointer to buffer in user space containing data */ @@ -1283,7 +1283,7 @@ wlioctl(struct ifnet *ifp, u_long cmd, caddr_t data) */ case SIOCSWLCNWID: /* root only */ - if ((error = suser_td(td))) + if ((error = suser(td))) break; if (!(ifp->if_flags & IFF_UP)) { error = EIO; /* only allowed while up */ @@ -1301,7 +1301,7 @@ wlioctl(struct ifnet *ifp, u_long cmd, caddr_t data) /* copy the EEPROM in 2.4 Gz WaveMODEM out to the caller */ case SIOCGWLEEPROM: /* root only */ - if ((error = suser_td(td))) + if ((error = suser(td))) break; /* pointer to buffer in user space */ up = (void *)ifr->ifr_data; @@ -1324,7 +1324,7 @@ wlioctl(struct ifnet *ifp, u_long cmd, caddr_t data) /* zero (Delete) the wl cache */ case SIOCDWLCACHE: /* root only */ - if ((error = suser_td(td))) + if ((error = suser(td))) break; wl_cache_zero(unit); break; |