From owner-p4-projects Sat Jul 20 8: 4:25 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0B24B37B401; Sat, 20 Jul 2002 08:04:20 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9E46C37B400 for ; Sat, 20 Jul 2002 08:04:19 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5B00543E4A for ; Sat, 20 Jul 2002 08:04:19 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from freefall.freebsd.org (perforce@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g6KF4JJU034165 for ; Sat, 20 Jul 2002 08:04:19 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g6KF4Jwv034162 for perforce@freebsd.org; Sat, 20 Jul 2002 08:04:19 -0700 (PDT) Date: Sat, 20 Jul 2002 08:04:19 -0700 (PDT) Message-Id: <200207201504.g6KF4Jwv034162@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson Subject: PERFORCE change 14522 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://people.freebsd.org/~peter/p4db/chv.cgi?CH=14522 Change 14522 by rwatson@rwatson_curry on 2002/07/20 08:04:10 Implement MAC security checks for file/directory removal in the system call implementations of unlink() and rmdir(). This duplicates the checks for deletion currently in namei()/lookup(), but puts them in a place more consistent with other checks. We should probably remove the deletion checks from namei(). Affected files ... .. //depot/projects/trustedbsd/mac/sys/kern/vfs_syscalls.c#50 edit Differences ... ==== //depot/projects/trustedbsd/mac/sys/kern/vfs_syscalls.c#50 (text+ko) ==== @@ -2253,8 +2253,16 @@ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); if (!error) { - VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE); - error = VOP_REMOVE(nd.ni_dvp, vp, &nd.ni_cnd); +#ifdef MAC + error = mac_cred_check_delete_vnode(td->td_ucred, nd.ni_dvp, + vp); + if (error == 0) { +#endif + VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE); + error = VOP_REMOVE(nd.ni_dvp, vp, &nd.ni_cnd); +#ifdef MAC + } +#endif } NDFREE(&nd, NDF_ONLY_PNBUF); vput(nd.ni_dvp); @@ -3902,6 +3910,11 @@ error = EBUSY; goto out; } +#ifdef MAC + error = mac_cred_check_delete_vnode(td->td_ucred, nd.ni_dvp, vp); + if (error) + goto out; +#endif if (vn_start_write(nd.ni_dvp, &mp, V_NOWAIT) != 0) { NDFREE(&nd, NDF_ONLY_PNBUF); if (nd.ni_dvp == vp) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message