Enforce MAC policy in cttyread() as well as the other operations

already instrumented.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, NAI Labs
This commit is contained in:
rwatson 2002-08-12 16:45:19 +00:00
parent b0388fc24a
commit 7a27007bbb

View File

@ -129,7 +129,12 @@ cttyread(dev, uio, flag)
if (ttyvp == NULL)
return (EIO);
vn_lock(ttyvp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_READ(ttyvp, uio, flag, NOCRED);
#ifdef MAC
/* XXX: Shouldn't the cred below be td->td_ucred not NOCRED? */
error = mac_check_vnode_op(td->td_ucred, ttyvp, MAC_OP_VNODE_READ);
if (error == 0)
#endif
error = VOP_READ(ttyvp, uio, flag, NOCRED);
VOP_UNLOCK(ttyvp, 0, td);
return (error);
}