133965Sjdp/*- 278828Sobrien * Copyright (c) 2008 Robert N. M. Watson 378828Sobrien * All rights reserved. 478828Sobrien * 578828Sobrien * This software was developed by Robert Watson for the TrustedBSD Project. 678828Sobrien * 778828Sobrien * Redistribution and use in source and binary forms, with or without 878828Sobrien * modification, are permitted provided that the following conditions 978828Sobrien * are met: 1078828Sobrien * 1. Redistributions of source code must retain the above copyright 1178828Sobrien * notice, this list of conditions and the following disclaimer. 1278828Sobrien * 2. Redistributions in binary form must reproduce the above copyright 1378828Sobrien * notice, this list of conditions and the following disclaimer in the 1478828Sobrien * documentation and/or other materials provided with the distribution. 1578828Sobrien * 1678828Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17218822Sdim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18218822Sdim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1978828Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2033965Sjdp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2133965Sjdp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2233965Sjdp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2333965Sjdp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2433965Sjdp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2578828Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2678828Sobrien * SUCH DAMAGE. 2778828Sobrien * 2878828Sobrien * $FreeBSD: releng/10.3/sys/security/mac_bsdextended/ugidfw_internal.h 189533 2009-03-08 12:32:06Z rwatson $ 2978828Sobrien */ 3078828Sobrien 3133965Sjdp#ifndef _SYS_SECURITY_MAC_BSDEXTENDED_UGIDFW_INTERNAL_H 3233965Sjdp#define _SYS_SECURITY_MAC_BSDEXTENDED_UGIDFW_INTERNAL_H 3378828Sobrien 3478828Sobrien/* 3578828Sobrien * Central access control routines used by object-specific checks. 3678828Sobrien */ 3733965Sjdpint ugidfw_accmode2mbi(accmode_t accmode); 3878828Sobrienint ugidfw_check(struct ucred *cred, struct vnode *vp, struct vattr *vap, 3933965Sjdp int acc_mode); 4033965Sjdpint ugidfw_check_vp(struct ucred *cred, struct vnode *vp, int acc_mode); 4178828Sobrien 4278828Sobrien/* 4333965Sjdp * System access control checks. 4478828Sobrien */ 4578828Sobrienint ugidfw_system_check_acct(struct ucred *cred, struct vnode *vp, 4678828Sobrien struct label *vplabel); 4733965Sjdpint ugidfw_system_check_auditctl(struct ucred *cred, struct vnode *vp, 4878828Sobrien struct label *vplabel); 4978828Sobrienint ugidfw_system_check_swapon(struct ucred *cred, struct vnode *vp, 5078828Sobrien struct label *vplabel); 5178828Sobrien 5278828Sobrien/* 5378828Sobrien * Vnode access control checks. 5478828Sobrien */ 5578828Sobrienint ugidfw_vnode_check_access(struct ucred *cred, struct vnode *vp, 5678828Sobrien struct label *vplabel, accmode_t accmode); 5778828Sobrienint ugidfw_vnode_check_chdir(struct ucred *cred, struct vnode *dvp, 5878828Sobrien struct label *dvplabel); 5978828Sobrienint ugidfw_vnode_check_chroot(struct ucred *cred, struct vnode *dvp, 6078828Sobrien struct label *dvplabel); 6178828Sobrienint ugidfw_check_create_vnode(struct ucred *cred, struct vnode *dvp, 6233965Sjdp struct label *dvplabel, struct componentname *cnp, 6378828Sobrien struct vattr *vap); 6478828Sobrienint ugidfw_vnode_check_deleteacl(struct ucred *cred, struct vnode *vp, 6578828Sobrien struct label *vplabel, acl_type_t type); 6678828Sobrienint ugidfw_vnode_check_deleteextattr(struct ucred *cred, 6778828Sobrien struct vnode *vp, struct label *vplabel, int attrnamespace, 6878828Sobrien const char *name); 6978828Sobrienint ugidfw_vnode_check_exec(struct ucred *cred, struct vnode *vp, 7078828Sobrien struct label *vplabel, struct image_params *imgp, 7178828Sobrien struct label *execlabel); 7278828Sobrienint ugidfw_vnode_check_getacl(struct ucred *cred, struct vnode *vp, 7378828Sobrien struct label *vplabel, acl_type_t type); 7478828Sobrienint ugidfw_vnode_check_getextattr(struct ucred *cred, struct vnode *vp, 7578828Sobrien struct label *vplabel, int attrnamespace, const char *name); 7678828Sobrienint ugidfw_vnode_check_link(struct ucred *cred, struct vnode *dvp, 7778828Sobrien struct label *dvplabel, struct vnode *vp, struct label *label, 7878828Sobrien struct componentname *cnp); 7978828Sobrienint ugidfw_vnode_check_listextattr(struct ucred *cred, struct vnode *vp, 8078828Sobrien struct label *vplabel, int attrnamespace); 8178828Sobrienint ugidfw_vnode_check_lookup(struct ucred *cred, struct vnode *dvp, 8278828Sobrien struct label *dvplabel, struct componentname *cnp); 8378828Sobrienint ugidfw_vnode_check_open(struct ucred *cred, struct vnode *vp, 8478828Sobrien struct label *vplabel, accmode_t accmode); 8578828Sobrienint ugidfw_vnode_check_readdir(struct ucred *cred, struct vnode *dvp, 8633965Sjdp struct label *dvplabel); 8778828Sobrienint ugidfw_vnode_check_readdlink(struct ucred *cred, struct vnode *vp, 8878828Sobrien struct label *vplabel); 8978828Sobrienint ugidfw_vnode_check_rename_from(struct ucred *cred, struct vnode *dvp, 9078828Sobrien struct label *dvplabel, struct vnode *vp, struct label *vplabel, 9178828Sobrien struct componentname *cnp); 9278828Sobrienint ugidfw_vnode_check_rename_to(struct ucred *cred, struct vnode *dvp, 9378828Sobrien struct label *dvplabel, struct vnode *vp, struct label *vplabel, 9478828Sobrien int samedir, struct componentname *cnp); 9578828Sobrienint ugidfw_vnode_check_revoke(struct ucred *cred, struct vnode *vp, 9678828Sobrien struct label *vplabel); 9778828Sobrienint ugidfw_check_setacl_vnode(struct ucred *cred, struct vnode *vp, 9878828Sobrien struct label *vplabel, acl_type_t type, struct acl *acl); 9978828Sobrienint ugidfw_vnode_check_setextattr(struct ucred *cred, struct vnode *vp, 10078828Sobrien struct label *vplabel, int attrnamespace, const char *name); 10178828Sobrienint ugidfw_vnode_check_setflags(struct ucred *cred, struct vnode *vp, 10278828Sobrien struct label *vplabel, u_long flags); 10378828Sobrienint ugidfw_vnode_check_setmode(struct ucred *cred, struct vnode *vp, 10478828Sobrien struct label *vplabel, mode_t mode); 10578828Sobrienint ugidfw_vnode_check_setowner(struct ucred *cred, struct vnode *vp, 10678828Sobrien struct label *vplabel, uid_t uid, gid_t gid); 10778828Sobrienint ugidfw_vnode_check_setutimes(struct ucred *cred, struct vnode *vp, 10878828Sobrien struct label *vplabel, struct timespec atime, 10978828Sobrien struct timespec utime); 11078828Sobrienint ugidfw_vnode_check_stat(struct ucred *active_cred, 11178828Sobrien struct ucred *file_cred, struct vnode *vp, struct label *vplabel); 11278828Sobrienint ugidfw_vnode_check_unlink(struct ucred *cred, struct vnode *dvp, 11378828Sobrien struct label *dvplabel, struct vnode *vp, struct label *vplabel, 11478828Sobrien struct componentname *cnp); 11578828Sobrien 11678828Sobrien#endif /* _SYS_SECURITY_MAC_BSDEXTENDED_UGIDFW_INTERNAL_H */ 11733965Sjdp