o Modify open() and close() for /dev/random to use securelevel_gt() instead
of direct securelevel variable checks. Obtained from: TrustedBSD Project
This commit is contained in:
parent
8002488bd9
commit
19f1565901
@ -141,17 +141,27 @@ SYSCTL_PROC(_kern_random_sys_harvest, OID_AUTO, interrupt,
|
|||||||
static int
|
static int
|
||||||
random_open(dev_t dev, int flags, int fmt, struct thread *td)
|
random_open(dev_t dev, int flags, int fmt, struct thread *td)
|
||||||
{
|
{
|
||||||
if ((flags & FWRITE) && (securelevel > 0 || suser(td->td_proc)))
|
int error;
|
||||||
return EPERM;
|
|
||||||
else
|
if (flags & FWRITE) {
|
||||||
return 0;
|
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
|
static int
|
||||||
random_close(dev_t dev, int flags, int fmt, struct thread *td)
|
random_close(dev_t dev, int flags, int fmt, struct thread *td)
|
||||||
{
|
{
|
||||||
if ((flags & FWRITE) && !(securelevel > 0 || suser(td->td_proc)))
|
if (flags & FWRITE) {
|
||||||
random_reseed();
|
if (!(suser(td->td_proc) ||
|
||||||
|
securelevel_gt(td->td_proc->p_ucred, 0)))
|
||||||
|
random_reseed();
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user