1101099Srwatson/*- 2166905Srwatson * Copyright (c) 1999-2002, 2007 Robert N. M. Watson 3145412Strhodes * Copyright (c) 2001-2005 Networks Associates Technology, Inc. 4171253Srwatson * Copyright (c) 2005 Tom Rhodes 5172930Srwatson * Copyright (c) 2006 SPARTA, Inc. 6101099Srwatson * All rights reserved. 7101099Srwatson * 8101099Srwatson * This software was developed by Robert Watson for the TrustedBSD Project. 9145412Strhodes * It was later enhanced by Tom Rhodes for the TrustedBSD Project. 10101099Srwatson * 11106393Srwatson * This software was developed for the FreeBSD Project in part by Network 12106393Srwatson * Associates Laboratories, the Security Research Division of Network 13106393Srwatson * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), 14106393Srwatson * as part of the DARPA CHATS research program. 15101099Srwatson * 16172930Srwatson * This software was enhanced by SPARTA ISSO under SPAWAR contract 17172930Srwatson * N66001-04-C-6019 ("SEFOS"). 18172930Srwatson * 19101099Srwatson * Redistribution and use in source and binary forms, with or without 20101099Srwatson * modification, are permitted provided that the following conditions 21101099Srwatson * are met: 22101099Srwatson * 1. Redistributions of source code must retain the above copyright 23101099Srwatson * notice, this list of conditions and the following disclaimer. 24101099Srwatson * 2. Redistributions in binary form must reproduce the above copyright 25101099Srwatson * notice, this list of conditions and the following disclaimer in the 26101099Srwatson * documentation and/or other materials provided with the distribution. 27101099Srwatson * 28101099Srwatson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 29101099Srwatson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 30101099Srwatson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 31101099Srwatson * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 32101099Srwatson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33101099Srwatson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34101099Srwatson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35101099Srwatson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36101099Srwatson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 37101099Srwatson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 38101099Srwatson * SUCH DAMAGE. 39101099Srwatson * 40101099Srwatson * $FreeBSD$ 41101099Srwatson */ 42136774Srwatson 43101099Srwatson#include <sys/param.h> 44101099Srwatson#include <sys/acl.h> 45101099Srwatson#include <sys/kernel.h> 46157986Sdwmalone#include <sys/jail.h> 47145412Strhodes#include <sys/lock.h> 48101099Srwatson#include <sys/malloc.h> 49166905Srwatson#include <sys/module.h> 50101099Srwatson#include <sys/mount.h> 51145412Strhodes#include <sys/mutex.h> 52170689Srwatson#include <sys/priv.h> 53101099Srwatson#include <sys/systm.h> 54101099Srwatson#include <sys/vnode.h> 55101099Srwatson#include <sys/sysctl.h> 56134132Strhodes#include <sys/syslog.h> 57182905Strasz#include <sys/stat.h> 58101099Srwatson 59165469Srwatson#include <security/mac/mac_policy.h> 60101099Srwatson#include <security/mac_bsdextended/mac_bsdextended.h> 61184331Srwatson#include <security/mac_bsdextended/ugidfw_internal.h> 62101099Srwatson 63184331Srwatsonint 64172955Srwatsonugidfw_system_check_acct(struct ucred *cred, struct vnode *vp, 65168976Srwatson struct label *vplabel) 66168933Srwatson{ 67168933Srwatson 68181069Srwatson if (vp != NULL) 69181069Srwatson return (ugidfw_check_vp(cred, vp, MBI_WRITE)); 70181069Srwatson else 71181069Srwatson return (0); 72168933Srwatson} 73168933Srwatson 74184331Srwatsonint 75172955Srwatsonugidfw_system_check_auditctl(struct ucred *cred, struct vnode *vp, 76168976Srwatson struct label *vplabel) 77168933Srwatson{ 78168933Srwatson 79181069Srwatson if (vp != NULL) 80181069Srwatson return (ugidfw_check_vp(cred, vp, MBI_WRITE)); 81181069Srwatson else 82181069Srwatson return (0); 83168933Srwatson} 84168933Srwatson 85184331Srwatsonint 86172955Srwatsonugidfw_system_check_swapon(struct ucred *cred, struct vnode *vp, 87168976Srwatson struct label *vplabel) 88156300Sdwmalone{ 89156300Sdwmalone 90172955Srwatson return (ugidfw_check_vp(cred, vp, MBI_WRITE)); 91156300Sdwmalone} 92