s3-security: use shared SECINFO_OWNER define.
[gd/samba-autobuild/.git] / source3 / include / rpc_secdes.h
1 /* 
2    Unix SMB/CIFS implementation.
3    SMB parameters and setup
4    Copyright (C) Andrew Tridgell              1992-2000
5    Copyright (C) Luke Kenneth Casson Leighton 1996-2000
6    
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3 of the License, or
10    (at your option) any later version.
11    
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16    
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef _RPC_SECDES_H /* _RPC_SECDES_H */
22 #define _RPC_SECDES_H 
23
24 /* for ADS */
25 #define SEC_RIGHTS_FULL_CTRL            0xf01ff
26
27 /* security information */
28 #define GROUP_SECURITY_INFORMATION      0x00000002
29 #define DACL_SECURITY_INFORMATION       0x00000004
30 #define SACL_SECURITY_INFORMATION       0x00000008
31 /* Extra W2K flags. */
32 #define UNPROTECTED_SACL_SECURITY_INFORMATION   0x10000000
33 #define UNPROTECTED_DACL_SECURITY_INFORMATION   0x20000000
34 #define PROTECTED_SACL_SECURITY_INFORMATION     0x40000000
35 #define PROTECTED_DACL_SECURITY_INFORMATION     0x80000000
36
37 #define ALL_SECURITY_INFORMATION (SECINFO_OWNER|GROUP_SECURITY_INFORMATION|\
38                                         DACL_SECURITY_INFORMATION|SACL_SECURITY_INFORMATION|\
39                                         UNPROTECTED_SACL_SECURITY_INFORMATION|\
40                                         UNPROTECTED_DACL_SECURITY_INFORMATION|\
41                                         PROTECTED_SACL_SECURITY_INFORMATION|\
42                                         PROTECTED_DACL_SECURITY_INFORMATION)
43
44 /* A type to describe the mapping of generic access rights to object
45    specific access rights. */
46
47 struct generic_mapping {
48         uint32 generic_read;
49         uint32 generic_write;
50         uint32 generic_execute;
51         uint32 generic_all;
52 };
53
54 struct standard_mapping {
55         uint32 std_read;
56         uint32 std_write;
57         uint32 std_execute;
58         uint32 std_all;
59 };
60
61
62 /* Security Access Masks Rights */
63
64 #define SPECIFIC_RIGHTS_MASK    0x0000FFFF
65 #define STANDARD_RIGHTS_MASK    0x00FF0000
66 #define GENERIC_RIGHTS_MASK     0xF0000000
67
68 /* Generic access rights */
69
70 #define GENERIC_RIGHT_ALL_ACCESS        0x10000000
71 #define GENERIC_RIGHT_EXECUTE_ACCESS    0x20000000
72 #define GENERIC_RIGHT_WRITE_ACCESS      0x40000000
73 #define GENERIC_RIGHT_READ_ACCESS       0x80000000
74
75 /* Standard access rights. */
76
77 #define STD_RIGHT_DELETE_ACCESS         0x00010000
78 #define STD_RIGHT_READ_CONTROL_ACCESS   0x00020000
79 #define STD_RIGHT_WRITE_DAC_ACCESS      0x00040000
80 #define STD_RIGHT_WRITE_OWNER_ACCESS    0x00080000
81 #define STD_RIGHT_SYNCHRONIZE_ACCESS    0x00100000
82
83 #define STD_RIGHT_ALL_ACCESS            0x001F0000
84
85 /* File Object specific access rights */
86
87 #define SA_RIGHT_FILE_READ_DATA         0x00000001
88 #define SA_RIGHT_FILE_WRITE_DATA        0x00000002
89 #define SA_RIGHT_FILE_APPEND_DATA       0x00000004
90 #define SA_RIGHT_FILE_READ_EA           0x00000008
91 #define SA_RIGHT_FILE_WRITE_EA          0x00000010
92 #define SA_RIGHT_FILE_EXECUTE           0x00000020
93 #define SA_RIGHT_FILE_DELETE_CHILD      0x00000040
94 #define SA_RIGHT_FILE_READ_ATTRIBUTES   0x00000080
95 #define SA_RIGHT_FILE_WRITE_ATTRIBUTES  0x00000100
96
97 #define SA_RIGHT_FILE_ALL_ACCESS        0x000001FF
98
99 #define GENERIC_RIGHTS_FILE_ALL_ACCESS \
100                 (STANDARD_RIGHTS_REQUIRED_ACCESS| \
101                 STD_RIGHT_SYNCHRONIZE_ACCESS    | \
102                 SA_RIGHT_FILE_ALL_ACCESS)
103
104 #define GENERIC_RIGHTS_FILE_READ        \
105                 (STANDARD_RIGHTS_READ_ACCESS    | \
106                 STD_RIGHT_SYNCHRONIZE_ACCESS    | \
107                 SA_RIGHT_FILE_READ_DATA         | \
108                 SA_RIGHT_FILE_READ_ATTRIBUTES   | \
109                 SA_RIGHT_FILE_READ_EA)
110
111 #define GENERIC_RIGHTS_FILE_WRITE \
112                 (STANDARD_RIGHTS_WRITE_ACCESS   | \
113                 STD_RIGHT_SYNCHRONIZE_ACCESS    | \
114                 SA_RIGHT_FILE_WRITE_DATA        | \
115                 SA_RIGHT_FILE_WRITE_ATTRIBUTES  | \
116                 SA_RIGHT_FILE_WRITE_EA          | \
117                 SA_RIGHT_FILE_APPEND_DATA)
118
119 #define GENERIC_RIGHTS_FILE_EXECUTE \
120                 (STANDARD_RIGHTS_EXECUTE_ACCESS | \
121                 STD_RIGHT_SYNCHRONIZE_ACCESS    | \
122                 SA_RIGHT_FILE_READ_ATTRIBUTES   | \
123                 SA_RIGHT_FILE_EXECUTE)            
124
125 #define GENERIC_RIGHTS_FILE_MODIFY \
126                 (STANDARD_RIGHTS_MODIFY_ACCESS  | \
127                 STD_RIGHT_SYNCHRONIZE_ACCESS    | \
128                 STD_RIGHT_DELETE_ACCESS         | \
129                 SA_RIGHT_FILE_WRITE_ATTRIBUTES  | \
130                 SA_RIGHT_FILE_READ_ATTRIBUTES   | \
131                 SA_RIGHT_FILE_EXECUTE           | \
132                 SA_RIGHT_FILE_WRITE_EA          | \
133                 SA_RIGHT_FILE_READ_EA           | \
134                 SA_RIGHT_FILE_APPEND_DATA       | \
135                 SA_RIGHT_FILE_WRITE_DATA        | \
136                 SA_RIGHT_FILE_READ_DATA)
137
138 #endif /* _RPC_SECDES_H */