implemented lock and mknod
[Samba.git] / source / include / rpc_secdes.h
blobe51a5fd2f8fc44d0584a7ed56f14ac3e72a6a44f
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
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 2 of the License, or
10 (at your option) any later version.
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.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #ifndef _RPC_SECDES_H /* _RPC_SECDES_H */
23 #define _RPC_SECDES_H
25 #define SEC_RIGHTS_QUERY_VALUE 0x00000001
26 #define SEC_RIGHTS_SET_VALUE 0x00000002
27 #define SEC_RIGHTS_CREATE_SUBKEY 0x00000004
28 #define SEC_RIGHTS_ENUM_SUBKEYS 0x00000008
29 #define SEC_RIGHTS_NOTIFY 0x00000010
30 #define SEC_RIGHTS_CREATE_LINK 0x00000020
31 #define SEC_RIGHTS_READ 0x00020019
32 #define SEC_RIGHTS_FULL_CONTROL 0x000f003f
33 #define SEC_RIGHTS_MAXIMUM_ALLOWED 0x02000000
34 /* for ADS */
35 #define SEC_RIGHTS_LIST_CONTENTS 0x4
36 #define SEC_RIGHTS_LIST_OBJECT 0x80
37 #define SEC_RIGHTS_READ_ALL_PROP 0x10
38 #define SEC_RIGHTS_READ_PERMS 0x20000
39 #define SEC_RIGHTS_WRITE_ALL_VALID 0x8
40 #define SEC_RIGHTS_WRITE_ALL_PROP 0x20
41 #define SEC_RIGHTS_MODIFY_OWNER 0x80000
42 #define SEC_RIGHTS_MODIFY_PERMS 0x40000
43 #define SEC_RIGHTS_CREATE_CHILD 0x1
44 #define SEC_RIGHTS_DELETE_CHILD 0x2
45 #define SEC_RIGHTS_DELETE_SUBTREE 0x40
46 #define SEC_RIGHTS_DELETE 0x10000 /* advanced/special/object/delete */
47 #define SEC_RIGHTS_EXTENDED 0x100 /* change/reset password, receive/send as*/
48 #define SEC_RIGHTS_CHANGE_PASSWD SEC_RIGHTS_EXTENDED
49 #define SEC_RIGHTS_RESET_PASSWD SEC_RIGHTS_EXTENDED
50 #define SEC_RIGHTS_FULL_CTRL 0xf01ff
52 #define SEC_ACE_OBJECT_PRESENT 0x00000001 /* thanks for Jim McDonough <jmcd@us.ibm.com> */
53 #define SEC_ACE_OBJECT_INHERITED_PRESENT 0x00000002
55 #define SEC_ACE_FLAG_OBJECT_INHERIT 0x1
56 #define SEC_ACE_FLAG_CONTAINER_INHERIT 0x2
57 #define SEC_ACE_FLAG_NO_PROPAGATE_INHERIT 0x4
58 #define SEC_ACE_FLAG_INHERIT_ONLY 0x8
59 #define SEC_ACE_FLAG_INHERITED_ACE 0x10 /* New for Windows 2000 */
60 #define SEC_ACE_FLAG_VALID_INHERIT 0xf
61 #define SEC_ACE_FLAG_SUCCESSFUL_ACCESS 0x40
62 #define SEC_ACE_FLAG_FAILED_ACCESS 0x80
64 #define SEC_ACE_TYPE_ACCESS_ALLOWED 0x0
65 #define SEC_ACE_TYPE_ACCESS_DENIED 0x1
66 #define SEC_ACE_TYPE_SYSTEM_AUDIT 0x2
67 #define SEC_ACE_TYPE_SYSTEM_ALARM 0x3
68 #define SEC_ACE_TYPE_ALLOWED_COMPOUND 0x4
69 #define SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT 0x5
70 #define SEC_ACE_TYPE_ACCESS_DENIED_OBJECT 0x6
71 #define SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT 0x7
72 #define SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT 0x8
74 #define SEC_DESC_OWNER_DEFAULTED 0x0001
75 #define SEC_DESC_GROUP_DEFAULTED 0x0002
76 #define SEC_DESC_DACL_PRESENT 0x0004
77 #define SEC_DESC_DACL_DEFAULTED 0x0008
78 #define SEC_DESC_SACL_PRESENT 0x0010
79 #define SEC_DESC_SACL_DEFAULTED 0x0020
80 #define SEC_DESC_SELF_RELATIVE 0x8000
82 * New Windows 2000 bits.
84 #define SE_DESC_DACL_AUTO_INHERIT_REQ 0x0100
85 #define SE_DESC_SACL_AUTO_INHERIT_REQ 0x0200
86 #define SE_DESC_DACL_AUTO_INHERITED 0x0400
87 #define SE_DESC_SACL_AUTO_INHERITED 0x0800
88 #define SE_DESC_DACL_PROTECTED 0x1000
89 #define SE_DESC_SACL_PROTECTED 0x2000
91 /* security information */
92 #define OWNER_SECURITY_INFORMATION 0x00000001
93 #define GROUP_SECURITY_INFORMATION 0x00000002
94 #define DACL_SECURITY_INFORMATION 0x00000004
95 #define SACL_SECURITY_INFORMATION 0x00000008
97 #define ALL_SECURITY_INFORMATION (OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|\
98 DACL_SECURITY_INFORMATION|SACL_SECURITY_INFORMATION)
100 /* Globally Unique ID */
101 #define GUID_SIZE 16
102 typedef struct guid_info
104 uint8 info[GUID_SIZE];
105 } GUID;
107 /* SEC_ACCESS */
108 typedef struct security_info_info
110 uint32 mask;
112 } SEC_ACCESS;
114 /* SEC_ACE */
115 typedef struct security_ace_info
117 uint8 type; /* xxxx_xxxx_ACE_TYPE - e.g allowed / denied etc */
118 uint8 flags; /* xxxx_INHERIT_xxxx - e.g OBJECT_INHERIT_ACE */
119 uint16 size;
121 SEC_ACCESS info;
123 /* this stuff may be present when type is XXXX_TYPE_XXXX_OBJECT */
124 uint32 obj_flags; /* xxxx_ACE_OBJECT_xxxx e.g present/inherited present etc */
125 GUID obj_guid; /* object GUID */
126 GUID inh_guid; /* inherited object GUID */
127 /* eof object stuff */
129 DOM_SID trustee;
131 } SEC_ACE;
132 #define SEC_ACE_HEADER_SIZE (2 * sizeof(uint8) + sizeof(uint16) + sizeof(uint32))
134 #ifndef ACL_REVISION
135 #define ACL_REVISION 0x3
136 #endif
138 #ifndef NT4_ACL_REVISION
139 #define NT4_ACL_REVISION 0x2
140 #endif
142 #ifndef _SEC_ACL
143 /* SEC_ACL */
144 typedef struct security_acl_info
146 uint16 revision; /* 0x0003 */
147 uint16 size; /* size in bytes of the entire ACL structure */
148 uint32 num_aces; /* number of Access Control Entries */
150 SEC_ACE *ace;
152 } SEC_ACL;
153 #define SEC_ACL_HEADER_SIZE (2 * sizeof(uint16) + sizeof(uint32))
154 #define _SEC_ACL
155 #endif
157 #ifndef SEC_DESC_REVISION
158 #define SEC_DESC_REVISION 0x1
159 #endif
161 #ifndef _SEC_DESC
162 /* SEC_DESC */
163 typedef struct security_descriptor_info
165 uint16 revision; /* 0x0001 */
166 uint16 type; /* SEC_DESC_xxxx flags */
168 uint32 off_owner_sid; /* offset to owner sid */
169 uint32 off_grp_sid ; /* offset to group sid */
170 uint32 off_sacl ; /* offset to system list of permissions */
171 uint32 off_dacl ; /* offset to list of permissions */
173 SEC_ACL *dacl; /* user ACL */
174 SEC_ACL *sacl; /* system ACL */
175 DOM_SID *owner_sid;
176 DOM_SID *grp_sid;
178 } SEC_DESC;
179 #define SEC_DESC_HEADER_SIZE (2 * sizeof(uint16) + 4 * sizeof(uint32))
180 #define _SEC_DESC
181 #endif
183 #ifndef _SEC_DESC_BUF
184 /* SEC_DESC_BUF */
185 typedef struct sec_desc_buf_info
187 uint32 max_len;
188 uint32 ptr;
189 uint32 len;
191 SEC_DESC *sec;
193 } SEC_DESC_BUF;
194 #define _SEC_DESC_BUF
195 #endif
197 /* A type to describe the mapping of generic access rights to object
198 specific access rights. */
200 typedef struct generic_mapping {
201 uint32 generic_read;
202 uint32 generic_write;
203 uint32 generic_execute;
204 uint32 generic_all;
205 } GENERIC_MAPPING;
207 typedef struct standard_mapping {
208 uint32 std_read;
209 uint32 std_write;
210 uint32 std_execute;
211 uint32 std_all;
212 } STANDARD_MAPPING;
214 #endif /* _RPC_SECDES_H */