From f103a76ebd421344544b6a88b78e6112f95facd9 Mon Sep 17 00:00:00 2001 From: rwatson Date: Thu, 1 Aug 2002 01:18:42 +0000 Subject: [PATCH] Introduce support for Mandatory Access Control and extensible kernel access control. Authorize the creation of UNIX domain sockets in the file system namespace via an appropriate invocation a MAC framework entry point. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs --- sys/kern/uipc_usrreq.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index a946ff3dd47d..dac95c906802 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -638,8 +639,14 @@ unp_bind(unp, nam, td) FILEDESC_LOCK(td->td_proc->p_fd); vattr.va_mode = (ACCESSPERMS & ~td->td_proc->p_fd->fd_cmask); FILEDESC_UNLOCK(td->td_proc->p_fd); - VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE); - error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr); +#ifdef MAC + error = mac_check_vnode_create(td->td_ucred, nd.ni_dvp, &nd.ni_cnd, + &vattr); +#endif /* MAC */ + if (error == 0) { + VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE); + error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr); + } NDFREE(&nd, NDF_ONLY_PNBUF); vput(nd.ni_dvp); if (error) {