1 // SPDX-License-Identifier: GPL-2.0-or-later 2 /* 3 * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC. 4 * Copyright (C) 2007 The Regents of the University of California. 5 * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). 6 * Written by Brian Behlendorf <behlendorf1@llnl.gov>. 7 * UCRL-CODE-235197 8 * 9 * This file is part of the SPL, Solaris Porting Layer. 10 * 11 * The SPL is free software; you can redistribute it and/or modify it 12 * under the terms of the GNU General Public License as published by the 13 * Free Software Foundation; either version 2 of the License, or (at your 14 * option) any later version. 15 * 16 * The SPL is distributed in the hope that it will be useful, but WITHOUT 17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 * for more details. 20 * 21 * You should have received a copy of the GNU General Public License along 22 * with the SPL. If not, see <http://www.gnu.org/licenses/>. 23 */ 24 25 #ifndef _SPL_ACL_H 26 #define _SPL_ACL_H 27 28 #include <sys/types.h> 29 30 typedef struct ace { 31 uid_t a_who; 32 uint32_t a_access_mask; 33 uint16_t a_flags; 34 uint16_t a_type; 35 } ace_t; 36 37 typedef struct ace_object { 38 uid_t a_who; /* uid or gid */ 39 uint32_t a_access_mask; /* read,write,... */ 40 uint16_t a_flags; /* see below */ 41 uint16_t a_type; /* allow or deny */ 42 uint8_t a_obj_type[16]; /* obj type */ 43 uint8_t a_inherit_obj_type[16]; /* inherit obj */ 44 } ace_object_t; 45 46 #define MAX_ACL_ENTRIES 1024 47 48 #define ACE_READ_DATA 0x00000001 49 #define ACE_LIST_DIRECTORY 0x00000001 50 #define ACE_WRITE_DATA 0x00000002 51 #define ACE_ADD_FILE 0x00000002 52 #define ACE_APPEND_DATA 0x00000004 53 #define ACE_ADD_SUBDIRECTORY 0x00000004 54 #define ACE_READ_NAMED_ATTRS 0x00000008 55 #define ACE_WRITE_NAMED_ATTRS 0x00000010 56 #define ACE_EXECUTE 0x00000020 57 #define ACE_DELETE_CHILD 0x00000040 58 #define ACE_READ_ATTRIBUTES 0x00000080 59 #define ACE_WRITE_ATTRIBUTES 0x00000100 60 #define ACE_DELETE 0x00010000 61 #define ACE_READ_ACL 0x00020000 62 #define ACE_WRITE_ACL 0x00040000 63 #define ACE_WRITE_OWNER 0x00080000 64 #define ACE_SYNCHRONIZE 0x00100000 65 66 #define ACE_FILE_INHERIT_ACE 0x0001 67 #define ACE_DIRECTORY_INHERIT_ACE 0x0002 68 #define ACE_NO_PROPAGATE_INHERIT_ACE 0x0004 69 #define ACE_INHERIT_ONLY_ACE 0x0008 70 #define ACE_SUCCESSFUL_ACCESS_ACE_FLAG 0x0010 71 #define ACE_FAILED_ACCESS_ACE_FLAG 0x0020 72 #define ACE_IDENTIFIER_GROUP 0x0040 73 #define ACE_INHERITED_ACE 0x0080 74 #define ACE_OWNER 0x1000 75 #define ACE_GROUP 0x2000 76 #define ACE_EVERYONE 0x4000 77 78 #define ACE_ACCESS_ALLOWED_ACE_TYPE 0x0000 79 #define ACE_ACCESS_DENIED_ACE_TYPE 0x0001 80 #define ACE_SYSTEM_AUDIT_ACE_TYPE 0x0002 81 #define ACE_SYSTEM_ALARM_ACE_TYPE 0x0003 82 83 #define ACL_AUTO_INHERIT 0x0001 84 #define ACL_PROTECTED 0x0002 85 #define ACL_DEFAULTED 0x0004 86 #define ACL_FLAGS_ALL (ACL_AUTO_INHERIT|ACL_PROTECTED|ACL_DEFAULTED) 87 88 #define ACE_ACCESS_ALLOWED_COMPOUND_ACE_TYPE 0x04 89 #define ACE_ACCESS_ALLOWED_OBJECT_ACE_TYPE 0x05 90 #define ACE_ACCESS_DENIED_OBJECT_ACE_TYPE 0x06 91 #define ACE_SYSTEM_AUDIT_OBJECT_ACE_TYPE 0x07 92 #define ACE_SYSTEM_ALARM_OBJECT_ACE_TYPE 0x08 93 #define ACE_ACCESS_ALLOWED_CALLBACK_ACE_TYPE 0x09 94 #define ACE_ACCESS_DENIED_CALLBACK_ACE_TYPE 0x0A 95 #define ACE_ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE 0x0B 96 #define ACE_ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE 0x0C 97 #define ACE_SYSTEM_AUDIT_CALLBACK_ACE_TYPE 0x0D 98 #define ACE_SYSTEM_ALARM_CALLBACK_ACE_TYPE 0x0E 99 #define ACE_SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE 0x0F 100 #define ACE_SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE 0x10 101 102 #define ACE_ALL_TYPES 0x001F 103 104 #define ACE_TYPE_FLAGS (ACE_OWNER|ACE_GROUP|ACE_EVERYONE|ACE_IDENTIFIER_GROUP) 105 106 #define ACE_ALL_PERMS (ACE_READ_DATA|ACE_LIST_DIRECTORY|ACE_WRITE_DATA| \ 107 ACE_ADD_FILE|ACE_APPEND_DATA|ACE_ADD_SUBDIRECTORY|ACE_READ_NAMED_ATTRS|\ 108 ACE_WRITE_NAMED_ATTRS|ACE_EXECUTE|ACE_DELETE_CHILD|ACE_READ_ATTRIBUTES|\ 109 ACE_WRITE_ATTRIBUTES|ACE_DELETE|ACE_READ_ACL|ACE_WRITE_ACL| \ 110 ACE_WRITE_OWNER|ACE_SYNCHRONIZE) 111 112 #define VSA_ACE 0x0010 113 #define VSA_ACECNT 0x0020 114 #define VSA_ACE_ALLTYPES 0x0040 115 #define VSA_ACE_ACLFLAGS 0x0080 116 117 #endif /* _SPL_ACL_H */ 118