1*5331Samw /* 2*5331Samw * CDDL HEADER START 3*5331Samw * 4*5331Samw * The contents of this file are subject to the terms of the 5*5331Samw * Common Development and Distribution License (the "License"). 6*5331Samw * You may not use this file except in compliance with the License. 7*5331Samw * 8*5331Samw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*5331Samw * or http://www.opensolaris.org/os/licensing. 10*5331Samw * See the License for the specific language governing permissions 11*5331Samw * and limitations under the License. 12*5331Samw * 13*5331Samw * When distributing Covered Code, include this CDDL HEADER in each 14*5331Samw * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*5331Samw * If applicable, add the following below this CDDL HEADER, with the 16*5331Samw * fields enclosed by brackets "[]" replaced with your own identifying 17*5331Samw * information: Portions Copyright [yyyy] [name of copyright owner] 18*5331Samw * 19*5331Samw * CDDL HEADER END 20*5331Samw */ 21*5331Samw /* 22*5331Samw * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23*5331Samw * Use is subject to license terms. 24*5331Samw */ 25*5331Samw 26*5331Samw #ifndef _SMBSRV_NTACCESS_H 27*5331Samw #define _SMBSRV_NTACCESS_H 28*5331Samw 29*5331Samw #pragma ident "%Z%%M% %I% %E% SMI" 30*5331Samw 31*5331Samw /* 32*5331Samw * This file defines the NT compatible access control masks and values. 33*5331Samw * An access mask as a 32-bit value arranged as shown below. 34*5331Samw * 35*5331Samw * 31-28 Generic bits, interpreted per object type 36*5331Samw * 27-26 Reserved, must-be-zero 37*5331Samw * 25 Maximum allowed 38*5331Samw * 24 System Security rights (SACL is SD) 39*5331Samw * 23-16 Standard access rights, generic to all object types 40*5331Samw * 15-0 Specific access rights, object specific 41*5331Samw * 42*5331Samw * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 43*5331Samw * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 44*5331Samw * +---------------+---------------+-------------------------------+ 45*5331Samw * |G|G|G|G|Res'd|A| StandardRights| SpecificRights | 46*5331Samw * |R|W|E|A| |S| | | 47*5331Samw * +-+-------------+---------------+-------------------------------+ 48*5331Samw */ 49*5331Samw 50*5331Samw #ifdef __cplusplus 51*5331Samw extern "C" { 52*5331Samw #endif 53*5331Samw 54*5331Samw /* 55*5331Samw * Specific rights for files, pipes and directories. 56*5331Samw */ 57*5331Samw #define FILE_READ_DATA (0x0001) /* file & pipe */ 58*5331Samw #define FILE_LIST_DIRECTORY (0x0001) /* directory */ 59*5331Samw #define FILE_WRITE_DATA (0x0002) /* file & pipe */ 60*5331Samw #define FILE_ADD_FILE (0x0002) /* directory */ 61*5331Samw #define FILE_APPEND_DATA (0x0004) /* file */ 62*5331Samw #define FILE_ADD_SUBDIRECTORY (0x0004) /* directory */ 63*5331Samw #define FILE_CREATE_PIPE_INSTANCE (0x0004) /* named pipe */ 64*5331Samw #define FILE_READ_EA (0x0008) /* file & directory */ 65*5331Samw #define FILE_READ_PROPERTIES (0x0008) /* pipe */ 66*5331Samw #define FILE_WRITE_EA (0x0010) /* file & directory */ 67*5331Samw #define FILE_WRITE_PROPERTIES (0x0010) /* pipe */ 68*5331Samw #define FILE_EXECUTE (0x0020) /* file */ 69*5331Samw #define FILE_TRAVERSE (0x0020) /* directory */ 70*5331Samw #define FILE_DELETE_CHILD (0x0040) /* directory */ 71*5331Samw #define FILE_READ_ATTRIBUTES (0x0080) /* all */ 72*5331Samw #define FILE_WRITE_ATTRIBUTES (0x0100) /* all */ 73*5331Samw #define FILE_SPECIFIC_ALL (0x000001FFL) 74*5331Samw #define SPECIFIC_RIGHTS_ALL (0x0000FFFFL) 75*5331Samw 76*5331Samw 77*5331Samw /* 78*5331Samw * Standard rights: 79*5331Samw * 80*5331Samw * DELETE The right to delete the object. 81*5331Samw * 82*5331Samw * READ_CONTROL The right to read the information in the object's security 83*5331Samw * descriptor, not including the information in the SACL. 84*5331Samw * 85*5331Samw * WRITE_DAC The right to modify the DACL in the object's security 86*5331Samw * descriptor. 87*5331Samw * 88*5331Samw * WRITE_OWNER The right to change the owner in the object's security 89*5331Samw * descriptor. 90*5331Samw * 91*5331Samw * SYNCHRONIZE The right to use the object for synchronization. This enables 92*5331Samw * a thread to wait until the object is in the signaled state. 93*5331Samw */ 94*5331Samw #define DELETE (0x00010000L) 95*5331Samw #define READ_CONTROL (0x00020000L) 96*5331Samw #define WRITE_DAC (0x00040000L) 97*5331Samw #define WRITE_OWNER (0x00080000L) /* take ownership */ 98*5331Samw #define SYNCHRONIZE (0x00100000L) 99*5331Samw #define STANDARD_RIGHTS_REQUIRED (0x000F0000L) 100*5331Samw #define STANDARD_RIGHTS_ALL (0x001F0000L) 101*5331Samw 102*5331Samw 103*5331Samw #define STANDARD_RIGHTS_READ (READ_CONTROL) 104*5331Samw #define STANDARD_RIGHTS_WRITE (READ_CONTROL) 105*5331Samw #define STANDARD_RIGHTS_EXECUTE (READ_CONTROL) 106*5331Samw 107*5331Samw #define FILE_METADATA_ALL (FILE_READ_EA |\ 108*5331Samw FILE_READ_ATTRIBUTES |\ 109*5331Samw READ_CONTROL |\ 110*5331Samw FILE_WRITE_EA |\ 111*5331Samw FILE_WRITE_ATTRIBUTES |\ 112*5331Samw WRITE_DAC |\ 113*5331Samw WRITE_OWNER |\ 114*5331Samw SYNCHRONIZE) 115*5331Samw 116*5331Samw #define FILE_DATA_ALL (FILE_READ_DATA |\ 117*5331Samw FILE_WRITE_DATA |\ 118*5331Samw FILE_APPEND_DATA |\ 119*5331Samw FILE_EXECUTE |\ 120*5331Samw DELETE) 121*5331Samw 122*5331Samw #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF) 123*5331Samw 124*5331Samw 125*5331Samw /* 126*5331Samw * Miscellaneous bits: SACL access and maximum allowed access. 127*5331Samw */ 128*5331Samw #define ACCESS_SYSTEM_SECURITY (0x01000000L) 129*5331Samw #define MAXIMUM_ALLOWED (0x02000000L) 130*5331Samw 131*5331Samw 132*5331Samw /* 133*5331Samw * Generic rights. These are shorthands that are interpreted as 134*5331Samw * appropriate for the type of secured object being accessed. 135*5331Samw */ 136*5331Samw #define GENERIC_ALL (0x10000000UL) 137*5331Samw #define GENERIC_EXECUTE (0x20000000UL) 138*5331Samw #define GENERIC_WRITE (0x40000000UL) 139*5331Samw #define GENERIC_READ (0x80000000UL) 140*5331Samw 141*5331Samw #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | \ 142*5331Samw FILE_READ_DATA | \ 143*5331Samw FILE_READ_ATTRIBUTES | \ 144*5331Samw FILE_READ_EA | \ 145*5331Samw SYNCHRONIZE) 146*5331Samw 147*5331Samw #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | \ 148*5331Samw FILE_WRITE_DATA | \ 149*5331Samw FILE_WRITE_ATTRIBUTES | \ 150*5331Samw FILE_WRITE_EA | \ 151*5331Samw FILE_APPEND_DATA | \ 152*5331Samw SYNCHRONIZE) 153*5331Samw 154*5331Samw #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | \ 155*5331Samw FILE_READ_ATTRIBUTES | \ 156*5331Samw FILE_EXECUTE | \ 157*5331Samw SYNCHRONIZE) 158*5331Samw 159*5331Samw #define FILE_GENERIC_ALL (FILE_GENERIC_READ | \ 160*5331Samw FILE_GENERIC_WRITE | \ 161*5331Samw FILE_GENERIC_EXECUTE) 162*5331Samw 163*5331Samw 164*5331Samw /* 165*5331Samw * LSA policy desired access masks. 166*5331Samw */ 167*5331Samw #define POLICY_VIEW_LOCAL_INFORMATION 0x00000001L 168*5331Samw #define POLICY_VIEW_AUDIT_INFORMATION 0x00000002L 169*5331Samw #define POLICY_GET_PRIVATE_INFORMATION 0x00000004L 170*5331Samw #define POLICY_TRUST_ADMIN 0x00000008L 171*5331Samw #define POLICY_CREATE_ACCOUNT 0x00000010L 172*5331Samw #define POLICY_CREATE_SECRET 0x00000020L 173*5331Samw #define POLICY_CREATE_PRIVILEGE 0x00000040L 174*5331Samw #define POLICY_SET_DEFAULT_QUOTA_LIMITS 0x00000080L 175*5331Samw #define POLICY_SET_AUDIT_REQUIREMENTS 0x00000100L 176*5331Samw #define POLICY_AUDIT_LOG_ADMIN 0x00000200L 177*5331Samw #define POLICY_SERVER_ADMIN 0x00000400L 178*5331Samw #define POLICY_LOOKUP_NAMES 0x00000800L 179*5331Samw 180*5331Samw 181*5331Samw /* 182*5331Samw * SAM specific rights desired access masks. These definitions are listed 183*5331Samw * mostly as a convenience; they don't seem to be documented. Setting the 184*5331Samw * desired access mask to GENERIC_EXECUTE and STANDARD_RIGHTS_EXECUTE 185*5331Samw * seems to work when just looking up information. 186*5331Samw */ 187*5331Samw #define SAM_LOOKUP_INFORMATION (GENERIC_EXECUTE \ 188*5331Samw | STANDARD_RIGHTS_EXECUTE) 189*5331Samw 190*5331Samw #define SAM_ACCESS_USER_READ 0x0000031BL 191*5331Samw #define SAM_ACCESS_USER_UPDATE 0x0000031FL 192*5331Samw #define SAM_ACCESS_USER_SETPWD 0x0000037FL 193*5331Samw #define SAM_CONNECT_CREATE_ACCOUNT 0x00000020L 194*5331Samw #define SAM_ENUM_LOCAL_DOMAIN 0x00000030L 195*5331Samw #define SAM_DOMAIN_CREATE_ACCOUNT 0x00000211L 196*5331Samw 197*5331Samw 198*5331Samw /* 199*5331Samw * File attributes 200*5331Samw * 201*5331Samw * Note: 0x00000008 is reserved for use for the old DOS VOLID (volume ID) 202*5331Samw * and is therefore not considered valid in NT. 203*5331Samw * 204*5331Samw * Note: 0x00000010 is reserved for use for the old DOS SUBDIRECTORY flag 205*5331Samw * and is therefore not considered valid in NT. This flag has 206*5331Samw * been disassociated with file attributes since the other flags are 207*5331Samw * protected with READ_ and WRITE_ATTRIBUTES access to the file. 208*5331Samw * 209*5331Samw * Note: Note also that the order of these flags is set to allow both the 210*5331Samw * FAT and the Pinball File Systems to directly set the attributes 211*5331Samw * flags in attributes words without having to pick each flag out 212*5331Samw * individually. The order of these flags should not be changed! 213*5331Samw * 214*5331Samw * The file attributes are defined in smbsrv/smb_vops.h 215*5331Samw */ 216*5331Samw 217*5331Samw /* Filesystem Attributes */ 218*5331Samw #define FILE_CASE_SENSITIVE_SEARCH 0x00000001 219*5331Samw #define FILE_CASE_PRESERVED_NAMES 0x00000002 220*5331Samw #define FILE_UNICODE_ON_DISK 0x00000004 221*5331Samw #define FILE_PERSISTENT_ACLS 0x00000008 222*5331Samw #define FILE_FILE_COMPRESSION 0x00000010 223*5331Samw #define FILE_VOLUME_QUOTAS 0x00000020 224*5331Samw #define FILE_SUPPORTS_SPARSE_FILES 0x00000040 225*5331Samw #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080 226*5331Samw #define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100 227*5331Samw #define FILE_VOLUME_IS_COMPRESSED 0x00008000 228*5331Samw #define FILE_SUPPORTS_OBJECT_IDS 0x00010000 229*5331Samw #define FILE_SUPPORTS_ENCRYPTION 0x00020000 230*5331Samw #define FILE_NAMED_STREAMS 0x00040000 231*5331Samw #define FILE_READ_ONLY_VOLUME 0x00080000 232*5331Samw 233*5331Samw #ifdef __cplusplus 234*5331Samw } 235*5331Samw #endif 236*5331Samw 237*5331Samw #endif /* _SMBSRV_NTACCESS_H */ 238