diff options
author | jhb <jhb@FreeBSD.org> | 2002-04-01 21:31:13 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2002-04-01 21:31:13 +0000 |
commit | dc2e474f79c1287592679cd5e0c4c2307feccd60 (patch) | |
tree | 79021f0d43a5858be317d5cd33eac8cd4962b336 /sys/pc98 | |
parent | 34c7d606c9818987384d404948ecdc98521462bd (diff) | |
download | FreeBSD-src-dc2e474f79c1287592679cd5e0c4c2307feccd60.zip FreeBSD-src-dc2e474f79c1287592679cd5e0c4c2307feccd60.tar.gz |
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@
Diffstat (limited to 'sys/pc98')
-rw-r--r-- | sys/pc98/cbus/fdc.c | 8 | ||||
-rw-r--r-- | sys/pc98/cbus/sio.c | 8 | ||||
-rw-r--r-- | sys/pc98/i386/machdep.c | 2 | ||||
-rw-r--r-- | sys/pc98/pc98/fd.c | 8 | ||||
-rw-r--r-- | sys/pc98/pc98/machdep.c | 2 | ||||
-rw-r--r-- | sys/pc98/pc98/sio.c | 8 | ||||
-rw-r--r-- | sys/pc98/pc98/syscons.c | 4 | ||||
-rw-r--r-- | sys/pc98/pc98/wd_cd.c | 2 |
8 files changed, 21 insertions, 21 deletions
diff --git a/sys/pc98/cbus/fdc.c b/sys/pc98/cbus/fdc.c index d52138d..e8b85c3 100644 --- a/sys/pc98/cbus/fdc.c +++ b/sys/pc98/cbus/fdc.c @@ -3188,7 +3188,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; } @@ -3213,7 +3213,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); @@ -3295,7 +3295,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; @@ -3319,7 +3319,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/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c index 65cf662..375527a 100644 --- a/sys/pc98/cbus/sio.c +++ b/sys/pc98/cbus/sio.c @@ -1902,7 +1902,7 @@ open_top: } } if (tp->t_state & TS_XCLUDE && - suser_td(td)) { + suser(td)) { error = EBUSY; goto out; } @@ -2935,7 +2935,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; @@ -3028,7 +3028,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); @@ -3086,7 +3086,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/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c index 65c9201..8c904dc 100644 --- a/sys/pc98/i386/machdep.c +++ b/sys/pc98/i386/machdep.c @@ -2204,7 +2204,7 @@ set_dbregs(struct thread *td, struct dbreg *dbregs) * from within kernel mode? */ - if (suser_td(td) != 0) { + if (suser(td) != 0) { if (dbregs->dr7 & 0x3) { /* dr0 is enabled */ if (dbregs->dr0 >= VM_MAXUSER_ADDRESS) diff --git a/sys/pc98/pc98/fd.c b/sys/pc98/pc98/fd.c index d52138d..e8b85c3 100644 --- a/sys/pc98/pc98/fd.c +++ b/sys/pc98/pc98/fd.c @@ -3188,7 +3188,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; } @@ -3213,7 +3213,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); @@ -3295,7 +3295,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; @@ -3319,7 +3319,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/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index 65c9201..8c904dc 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -2204,7 +2204,7 @@ set_dbregs(struct thread *td, struct dbreg *dbregs) * from within kernel mode? */ - if (suser_td(td) != 0) { + if (suser(td) != 0) { if (dbregs->dr7 & 0x3) { /* dr0 is enabled */ if (dbregs->dr0 >= VM_MAXUSER_ADDRESS) diff --git a/sys/pc98/pc98/sio.c b/sys/pc98/pc98/sio.c index 65cf662..375527a 100644 --- a/sys/pc98/pc98/sio.c +++ b/sys/pc98/pc98/sio.c @@ -1902,7 +1902,7 @@ open_top: } } if (tp->t_state & TS_XCLUDE && - suser_td(td)) { + suser(td)) { error = EBUSY; goto out; } @@ -2935,7 +2935,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; @@ -3028,7 +3028,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); @@ -3086,7 +3086,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/pc98/pc98/syscons.c b/sys/pc98/pc98/syscons.c index aaabf37..ef449d0 100644 --- a/sys/pc98/pc98/syscons.c +++ b/sys/pc98/pc98/syscons.c @@ -476,7 +476,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); @@ -978,7 +978,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/pc98/pc98/wd_cd.c b/sys/pc98/pc98/wd_cd.c index 909a409..f0e6093 100644 --- a/sys/pc98/pc98/wd_cd.c +++ b/sys/pc98/pc98/wd_cd.c @@ -630,7 +630,7 @@ acdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0); case CDIOCRESET: - error = suser_td(td); + error = suser(td); if (error) return (error); return acd_request_wait(cdp, ATAPI_TEST_UNIT_READY, |