1 /*- 2 * Copyright (c) 1999-2002 Robert N. M. Watson 3 * Copyright (c) 2001 Ilmar S. Habibulin 4 * Copyright (c) 2001-2004 Networks Associates Technology, Inc. 5 * Copyright (c) 2006 SPARTA, Inc. 6 * 7 * This software was developed by Robert Watson and Ilmar Habibulin for the 8 * TrustedBSD Project. 9 * 10 * This software was developed for the FreeBSD Project in part by Network 11 * Associates Laboratories, the Security Research Division of Network 12 * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), 13 * as part of the DARPA CHATS research program. 14 * 15 * This software was enhanced by SPARTA ISSO under SPAWAR contract 16 * N66001-04-C-6019 ("SEFOS"). 17 * 18 * Redistribution and use in source and binary forms, with or without 19 * modification, are permitted provided that the following conditions 20 * are met: 21 * 1. Redistributions of source code must retain the above copyright 22 * notice, this list of conditions and the following disclaimer. 23 * 2. Redistributions in binary form must reproduce the above copyright 24 * notice, this list of conditions and the following disclaimer in the 25 * documentation and/or other materials provided with the distribution. 26 * 27 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 31 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 */ 39 40 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD$"); 42 43 #include <sys/param.h> 44 #include <sys/module.h> 45 #include <sys/vnode.h> 46 47 #include <security/audit/audit.h> 48 49 #include <security/mac/mac_framework.h> 50 #include <security/mac/mac_internal.h> 51 #include <security/mac/mac_policy.h> 52 53 int 54 mac_proc_check_setaudit(struct ucred *cred, struct auditinfo *ai) 55 { 56 int error; 57 58 MAC_CHECK(proc_check_setaudit, cred, ai); 59 60 return (error); 61 } 62 63 int 64 mac_proc_check_setaudit_addr(struct ucred *cred, struct auditinfo_addr *aia) 65 { 66 int error; 67 68 MAC_CHECK(proc_check_setaudit_addr, cred, aia); 69 70 return (error); 71 } 72 73 int 74 mac_proc_check_setauid(struct ucred *cred, uid_t auid) 75 { 76 int error; 77 78 MAC_CHECK(proc_check_setauid, cred, auid); 79 80 return (error); 81 } 82 83 int 84 mac_system_check_audit(struct ucred *cred, void *record, int length) 85 { 86 int error; 87 88 MAC_CHECK(system_check_audit, cred, record, length); 89 90 return (error); 91 } 92 93 int 94 mac_system_check_auditctl(struct ucred *cred, struct vnode *vp) 95 { 96 int error; 97 struct label *vl; 98 99 ASSERT_VOP_LOCKED(vp, "mac_system_check_auditctl"); 100 101 vl = (vp != NULL) ? vp->v_label : NULL; 102 103 MAC_CHECK(system_check_auditctl, cred, vp, vl); 104 105 return (error); 106 } 107 108 int 109 mac_system_check_auditon(struct ucred *cred, int cmd) 110 { 111 int error; 112 113 MAC_CHECK(system_check_auditon, cred, cmd); 114 115 return (error); 116 } 117