1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00

o Modify generic specfs device open access control checks to use

securelevel_ge() instead of direct securelevel variable checks.

Obtained from:	TrustedBSD Project
This commit is contained in:
Robert Watson 2001-09-26 20:18:26 +00:00
parent 8c7cc7234e
commit f86cf763ef
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=83978

View File

@ -176,15 +176,19 @@ spec_open(ap)
* When running in secure mode, do not allow opens
* for writing if the device is mounted
*/
if (securelevel >= 1 && vfs_mountedon(vp))
return (EPERM);
if (vfs_mountedon(vp)) {
error = securelevel_ge(td->td_proc->p_ucred, 1);
if (error)
return (error);
}
/*
* When running in very secure mode, do not allow
* opens for writing of any devices.
*/
if (securelevel >= 2)
return (EPERM);
error = securelevel_ge(td->td_proc->p_ucred, 2);
if (error)
return (error);
}
/* XXX: Special casing of ttys for deadfs. Probably redundant */