diff options
| author | Robert Watson <rwatson@FreeBSD.org> | 2001-09-26 20:15:42 +0000 |
|---|---|---|
| committer | Robert Watson <rwatson@FreeBSD.org> | 2001-09-26 20:15:42 +0000 |
| commit | 19f1565901e8b66aced13a90ac2b34e4fa4f81ed (patch) | |
| tree | 19824b8641fb2d7ad8bcbd207478945aba23bd3f | |
| parent | 8002488bd9001e16e666af320c25ee890a83d839 (diff) | |
Notes
| -rw-r--r-- | sys/dev/random/randomdev.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/sys/dev/random/randomdev.c b/sys/dev/random/randomdev.c index a0bd578c76c9..cd6f8739b9c9 100644 --- a/sys/dev/random/randomdev.c +++ b/sys/dev/random/randomdev.c @@ -141,17 +141,27 @@ SYSCTL_PROC(_kern_random_sys_harvest, OID_AUTO, interrupt, static int random_open(dev_t dev, int flags, int fmt, struct thread *td) { - if ((flags & FWRITE) && (securelevel > 0 || suser(td->td_proc))) - return EPERM; - else - return 0; + int error; + + if (flags & FWRITE) { + error = suser(td->td_proc); + if (error) + return (error); + error = securelevel_gt(td->td_proc->p_ucred, 0); + if (error) + return (error); + } + return 0; } static int random_close(dev_t dev, int flags, int fmt, struct thread *td) { - if ((flags & FWRITE) && !(securelevel > 0 || suser(td->td_proc))) - random_reseed(); + if (flags & FWRITE) { + if (!(suser(td->td_proc) || + securelevel_gt(td->td_proc->p_ucred, 0))) + random_reseed(); + } return 0; } |
