Initial import
[samba] / source / 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 2 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, write to the Free Software
19    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22 #ifndef _RPC_SECDES_H /* _RPC_SECDES_H */
23 #define _RPC_SECDES_H 
24
25 /* for ADS */
26 #define SEC_RIGHTS_LIST_CONTENTS        0x4
27 #define SEC_RIGHTS_LIST_OBJECT          0x80
28 #define SEC_RIGHTS_READ_ALL_PROP        0x10
29 #define SEC_RIGHTS_READ_PERMS           0x20000
30 #define SEC_RIGHTS_WRITE_ALL_VALID      0x8
31 #define SEC_RIGHTS_WRITE_ALL_PROP       0x20     
32 #define SEC_RIGHTS_MODIFY_OWNER         0x80000
33 #define SEC_RIGHTS_MODIFY_PERMS         0x40000
34 #define SEC_RIGHTS_CREATE_CHILD         0x1
35 #define SEC_RIGHTS_DELETE_CHILD         0x2
36 #define SEC_RIGHTS_DELETE_SUBTREE       0x40
37 #define SEC_RIGHTS_DELETE               0x10000 /* advanced/special/object/delete */
38 #define SEC_RIGHTS_EXTENDED             0x100 /* change/reset password, receive/send as*/
39 #define SEC_RIGHTS_CHANGE_PASSWD        SEC_RIGHTS_EXTENDED
40 #define SEC_RIGHTS_RESET_PASSWD         SEC_RIGHTS_EXTENDED
41 #define SEC_RIGHTS_FULL_CTRL            0xf01ff
42
43 #define SEC_ACE_OBJECT_PRESENT           0x00000001 /* thanks for Jim McDonough <jmcd@us.ibm.com> */
44 #define SEC_ACE_OBJECT_INHERITED_PRESENT 0x00000002
45
46 #define SEC_ACE_FLAG_OBJECT_INHERIT             0x1
47 #define SEC_ACE_FLAG_CONTAINER_INHERIT          0x2
48 #define SEC_ACE_FLAG_NO_PROPAGATE_INHERIT       0x4
49 #define SEC_ACE_FLAG_INHERIT_ONLY               0x8
50 #define SEC_ACE_FLAG_INHERITED_ACE              0x10 /* New for Windows 2000 */
51 #define SEC_ACE_FLAG_VALID_INHERIT              0xf
52 #define SEC_ACE_FLAG_SUCCESSFUL_ACCESS          0x40
53 #define SEC_ACE_FLAG_FAILED_ACCESS              0x80
54
55 #define SEC_ACE_TYPE_ACCESS_ALLOWED             0x0
56 #define SEC_ACE_TYPE_ACCESS_DENIED              0x1
57 #define SEC_ACE_TYPE_SYSTEM_AUDIT               0x2
58 #define SEC_ACE_TYPE_SYSTEM_ALARM               0x3
59 #define SEC_ACE_TYPE_ALLOWED_COMPOUND           0x4
60 #define SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT      0x5
61 #define SEC_ACE_TYPE_ACCESS_DENIED_OBJECT       0x6
62 #define SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT        0x7
63 #define SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT        0x8
64
65 #define SEC_DESC_OWNER_DEFAULTED        0x0001
66 #define SEC_DESC_GROUP_DEFAULTED        0x0002
67 #define SEC_DESC_DACL_PRESENT           0x0004
68 #define SEC_DESC_DACL_DEFAULTED         0x0008
69 #define SEC_DESC_SACL_PRESENT           0x0010
70 #define SEC_DESC_SACL_DEFAULTED         0x0020
71 #define SEC_DESC_DACL_TRUSTED           0x0040
72 #define SEC_DESC_SERVER_SECURITY        0x0080
73 /*
74  * New Windows 2000 bits.
75  */
76 #define SE_DESC_DACL_AUTO_INHERIT_REQ   0x0100
77 #define SE_DESC_SACL_AUTO_INHERIT_REQ   0x0200
78 #define SE_DESC_DACL_AUTO_INHERITED     0x0400
79 #define SE_DESC_SACL_AUTO_INHERITED     0x0800
80 #define SE_DESC_DACL_PROTECTED          0x1000
81 #define SE_DESC_SACL_PROTECTED          0x2000
82
83 /* Don't know what this means. */
84 #define SEC_DESC_RM_CONTROL_VALID       0x4000
85
86 #define SEC_DESC_SELF_RELATIVE          0x8000
87
88 /* security information */
89 #define OWNER_SECURITY_INFORMATION      0x00000001
90 #define GROUP_SECURITY_INFORMATION      0x00000002
91 #define DACL_SECURITY_INFORMATION       0x00000004
92 #define SACL_SECURITY_INFORMATION       0x00000008
93 /* Extra W2K flags. */
94 #define UNPROTECTED_SACL_SECURITY_INFORMATION   0x10000000
95 #define UNPROTECTED_DACL_SECURITY_INFORMATION   0x20000000
96 #define PROTECTED_SACL_SECURITY_INFORMATION     0x40000000
97 #define PROTECTED_DACL_SECURITY_INFORMATION     0x80000000
98
99 #define ALL_SECURITY_INFORMATION (OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|\
100                                         DACL_SECURITY_INFORMATION|SACL_SECURITY_INFORMATION|\
101                                         UNPROTECTED_SACL_SECURITY_INFORMATION|\
102                                         UNPROTECTED_DACL_SECURITY_INFORMATION|\
103                                         PROTECTED_SACL_SECURITY_INFORMATION|\
104                                         PROTECTED_DACL_SECURITY_INFORMATION)
105
106 /* SEC_ACCESS */
107 typedef struct security_info_info
108 {
109         uint32 mask;
110
111 } SEC_ACCESS;
112
113 /* SEC_ACE */
114 typedef struct security_ace_info
115 {
116         uint8 type;  /* xxxx_xxxx_ACE_TYPE - e.g allowed / denied etc */
117         uint8 flags; /* xxxx_INHERIT_xxxx - e.g OBJECT_INHERIT_ACE */
118         uint16 size;
119
120         SEC_ACCESS info;
121
122         /* this stuff may be present when type is XXXX_TYPE_XXXX_OBJECT */
123         uint32  obj_flags; /* xxxx_ACE_OBJECT_xxxx e.g present/inherited present etc */
124         struct uuid obj_guid;  /* object GUID */
125         struct uuid inh_guid;  /* inherited object GUID */              
126         /* eof object stuff */
127
128         DOM_SID trustee;
129
130 } SEC_ACE;
131 #define  SEC_ACE_HEADER_SIZE (2 * sizeof(uint8) + sizeof(uint16) + sizeof(uint32))
132
133 #ifndef ACL_REVISION
134 #define ACL_REVISION 0x3
135 #endif
136
137 #ifndef NT4_ACL_REVISION
138 #define NT4_ACL_REVISION 0x2
139 #endif
140
141 #ifndef _SEC_ACL
142 /* SEC_ACL */
143 typedef struct security_acl_info
144 {
145         uint16 revision; /* 0x0003 */
146         uint16 size; /* size in bytes of the entire ACL structure */
147         uint32 num_aces; /* number of Access Control Entries */
148
149         SEC_ACE *ace;
150
151 } SEC_ACL;
152 #define  SEC_ACL_HEADER_SIZE (2 * sizeof(uint16) + sizeof(uint32))
153 #define _SEC_ACL
154 #endif
155
156 #ifndef SEC_DESC_REVISION
157 #define SEC_DESC_REVISION 0x1
158 #endif
159
160 #ifndef _SEC_DESC
161 /* SEC_DESC */
162 typedef struct security_descriptor_info
163 {
164         uint16 revision; /* 0x0001 */
165         uint16 type;     /* SEC_DESC_xxxx flags */
166
167         uint32 off_owner_sid; /* offset to owner sid */
168         uint32 off_grp_sid  ; /* offset to group sid */
169         uint32 off_sacl     ; /* offset to system list of permissions */
170         uint32 off_dacl     ; /* offset to list of permissions */
171
172         SEC_ACL *dacl; /* user ACL */
173         SEC_ACL *sacl; /* system ACL */
174         DOM_SID *owner_sid; 
175         DOM_SID *grp_sid;
176
177 } SEC_DESC;
178 #define  SEC_DESC_HEADER_SIZE (2 * sizeof(uint16) + 4 * sizeof(uint32))
179 #define _SEC_DESC
180 #endif
181
182 #ifndef _SEC_DESC_BUF
183 /* SEC_DESC_BUF */
184 typedef struct sec_desc_buf_info
185 {
186         uint32 max_len;
187         uint32 ptr;
188         uint32 len;
189
190         SEC_DESC *sec;
191
192 } SEC_DESC_BUF;
193 #define _SEC_DESC_BUF
194 #endif
195
196 /* A type to describe the mapping of generic access rights to object
197    specific access rights. */
198
199 typedef struct generic_mapping {
200         uint32 generic_read;
201         uint32 generic_write;
202         uint32 generic_execute;
203         uint32 generic_all;
204 } GENERIC_MAPPING;
205
206 typedef struct standard_mapping {
207         uint32 std_read;
208         uint32 std_write;
209         uint32 std_execute;
210         uint32 std_all;
211 } STANDARD_MAPPING;
212
213
214 /* Security Access Masks Rights */
215
216 #define SPECIFIC_RIGHTS_MASK    0x0000FFFF
217 #define STANDARD_RIGHTS_MASK    0x00FF0000
218 #define GENERIC_RIGHTS_MASK     0xF0000000
219
220 #define SEC_RIGHT_SYSTEM_SECURITY       0x01000000
221 #define SEC_RIGHT_MAXIMUM_ALLOWED       0x02000000
222
223 /* Generic access rights */
224
225 #define GENERIC_RIGHT_ALL_ACCESS        0x10000000
226 #define GENERIC_RIGHT_EXECUTE_ACCESS    0x20000000
227 #define GENERIC_RIGHT_WRITE_ACCESS      0x40000000
228 #define GENERIC_RIGHT_READ_ACCESS       0x80000000
229
230 /* Standard access rights. */
231
232 #define STD_RIGHT_DELETE_ACCESS         0x00010000
233 #define STD_RIGHT_READ_CONTROL_ACCESS   0x00020000
234 #define STD_RIGHT_WRITE_DAC_ACCESS      0x00040000
235 #define STD_RIGHT_WRITE_OWNER_ACCESS    0x00080000
236 #define STD_RIGHT_SYNCHRONIZE_ACCESS    0x00100000
237
238 #define STD_RIGHT_ALL_ACCESS            0x001F0000
239
240 /* Combinations of standard masks. */
241 #define STANDARD_RIGHTS_ALL_ACCESS      STD_RIGHT_ALL_ACCESS /* 0x001f0000 */
242 #define STANDARD_RIGHTS_EXECUTE_ACCESS  STD_RIGHT_READ_CONTROL_ACCESS /* 0x00020000 */
243 #define STANDARD_RIGHTS_READ_ACCESS     STD_RIGHT_READ_CONTROL_ACCESS /* 0x00020000 */
244 #define STANDARD_RIGHTS_WRITE_ACCESS \
245                 (STD_RIGHT_WRITE_OWNER_ACCESS   | \
246                  STD_RIGHT_WRITE_DAC_ACCESS     | \
247                  STD_RIGHT_DELETE_ACCESS)       /* 0x000d0000 */
248 #define STANDARD_RIGHTS_REQUIRED_ACCESS \
249                 (STD_RIGHT_DELETE_ACCESS        | \
250                 STD_RIGHT_READ_CONTROL_ACCESS   | \
251                 STD_RIGHT_WRITE_DAC_ACCESS      | \
252                 STD_RIGHT_WRITE_OWNER_ACCESS)   /* 0x000f0000 */
253
254 /* File Object specific access rights */
255
256 #define SA_RIGHT_FILE_READ_DATA         0x00000001
257 #define SA_RIGHT_FILE_WRITE_DATA        0x00000002
258 #define SA_RIGHT_FILE_APPEND_DATA       0x00000004
259 #define SA_RIGHT_FILE_READ_EA           0x00000008
260 #define SA_RIGHT_FILE_WRITE_EA          0x00000010
261 #define SA_RIGHT_FILE_EXECUTE           0x00000020
262 #define SA_RIGHT_FILE_DELETE_CHILD      0x00000040
263 #define SA_RIGHT_FILE_READ_ATTRIBUTES   0x00000080
264 #define SA_RIGHT_FILE_WRITE_ATTRIBUTES  0x00000100
265
266 #define SA_RIGHT_FILE_ALL_ACCESS        0x000001FF
267
268 #define GENERIC_RIGHTS_FILE_ALL_ACCESS \
269                 (STANDARD_RIGHTS_REQUIRED_ACCESS| \
270                 STD_RIGHT_SYNCHRONIZE_ACCESS    | \
271                 SA_RIGHT_FILE_ALL_ACCESS)
272
273 #define GENERIC_RIGHTS_FILE_READ        \
274                 (STANDARD_RIGHTS_READ_ACCESS    | \
275                 STD_RIGHT_SYNCHRONIZE_ACCESS    | \
276                 SA_RIGHT_FILE_READ_DATA         | \
277                 SA_RIGHT_FILE_READ_ATTRIBUTES   | \
278                 SA_RIGHT_FILE_READ_EA)
279
280 #define GENERIC_RIGHTS_FILE_WRITE \
281                 (STANDARD_RIGHTS_WRITE_ACCESS   | \
282                 STD_RIGHT_SYNCHRONIZE_ACCESS    | \
283                 SA_RIGHT_FILE_WRITE_DATA        | \
284                 SA_RIGHT_FILE_WRITE_ATTRIBUTES  | \
285                 SA_RIGHT_FILE_WRITE_EA          | \
286                 SA_RIGHT_FILE_APPEND_DATA)
287
288 #define GENERIC_RIGHTS_FILE_EXECUTE \
289                 (STANDARD_RIGHTS_EXECUTE_ACCESS | \
290                 SA_RIGHT_FILE_READ_ATTRIBUTES   | \
291                 SA_RIGHT_FILE_EXECUTE)            
292
293                 
294 /* SAM server specific access rights */
295
296 #define SA_RIGHT_SAM_CONNECT_SERVER     0x00000001
297 #define SA_RIGHT_SAM_SHUTDOWN_SERVER    0x00000002
298 #define SA_RIGHT_SAM_INITIALISE_SERVER  0x00000004
299 #define SA_RIGHT_SAM_CREATE_DOMAIN      0x00000008
300 #define SA_RIGHT_SAM_ENUM_DOMAINS       0x00000010
301 #define SA_RIGHT_SAM_OPEN_DOMAIN        0x00000020
302
303 #define SA_RIGHT_SAM_ALL_ACCESS         0x0000003F
304
305 #define GENERIC_RIGHTS_SAM_ALL_ACCESS \
306                 (STANDARD_RIGHTS_REQUIRED_ACCESS| \
307                 SA_RIGHT_SAM_ALL_ACCESS)
308
309 #define GENERIC_RIGHTS_SAM_READ \
310                 (STANDARD_RIGHTS_READ_ACCESS    | \
311                 SA_RIGHT_SAM_ENUM_DOMAINS)
312
313 #define GENERIC_RIGHTS_SAM_WRITE \
314                 (STANDARD_RIGHTS_WRITE_ACCESS   | \
315                 SA_RIGHT_SAM_CREATE_DOMAIN      | \
316                 SA_RIGHT_SAM_INITIALISE_SERVER  | \
317                 SA_RIGHT_SAM_SHUTDOWN_SERVER)
318
319 #define GENERIC_RIGHTS_SAM_EXECUTE \
320                 (STANDARD_RIGHTS_EXECUTE_ACCESS | \
321                 SA_RIGHT_SAM_OPEN_DOMAIN        | \
322                 SA_RIGHT_SAM_CONNECT_SERVER)            
323
324
325 /* Domain Object specific access rights */
326
327 #define SA_RIGHT_DOMAIN_LOOKUP_INFO_1           0x00000001
328 #define SA_RIGHT_DOMAIN_SET_INFO_1              0x00000002
329 #define SA_RIGHT_DOMAIN_LOOKUP_INFO_2           0x00000004
330 #define SA_RIGHT_DOMAIN_SET_INFO_2              0x00000008
331 #define SA_RIGHT_DOMAIN_CREATE_USER             0x00000010
332 #define SA_RIGHT_DOMAIN_CREATE_GROUP            0x00000020
333 #define SA_RIGHT_DOMAIN_CREATE_ALIAS            0x00000040
334 #define SA_RIGHT_DOMAIN_LOOKUP_ALIAS_BY_MEM     0x00000080
335 #define SA_RIGHT_DOMAIN_ENUM_ACCOUNTS           0x00000100
336 #define SA_RIGHT_DOMAIN_OPEN_ACCOUNT            0x00000200
337 #define SA_RIGHT_DOMAIN_SET_INFO_3              0x00000400
338
339 #define SA_RIGHT_DOMAIN_ALL_ACCESS              0x000007FF
340
341 #define GENERIC_RIGHTS_DOMAIN_ALL_ACCESS \
342                 (STANDARD_RIGHTS_REQUIRED_ACCESS| \
343                 SA_RIGHT_DOMAIN_ALL_ACCESS)
344
345 #define GENERIC_RIGHTS_DOMAIN_READ \
346                 (STANDARD_RIGHTS_READ_ACCESS            | \
347                 SA_RIGHT_DOMAIN_LOOKUP_ALIAS_BY_MEM     | \
348                 SA_RIGHT_DOMAIN_LOOKUP_INFO_2)
349
350 #define GENERIC_RIGHTS_DOMAIN_WRITE \
351                 (STANDARD_RIGHTS_WRITE_ACCESS   | \
352                 SA_RIGHT_DOMAIN_SET_INFO_3      | \
353                 SA_RIGHT_DOMAIN_CREATE_ALIAS    | \
354                 SA_RIGHT_DOMAIN_CREATE_GROUP    | \
355                 SA_RIGHT_DOMAIN_CREATE_USER     | \
356                 SA_RIGHT_DOMAIN_SET_INFO_2      | \
357                 SA_RIGHT_DOMAIN_SET_INFO_1)
358
359 #define GENERIC_RIGHTS_DOMAIN_EXECUTE \
360                 (STANDARD_RIGHTS_EXECUTE_ACCESS | \
361                 SA_RIGHT_DOMAIN_OPEN_ACCOUNT    | \
362                 SA_RIGHT_DOMAIN_ENUM_ACCOUNTS   | \
363                 SA_RIGHT_DOMAIN_LOOKUP_INFO_1)            
364
365
366 /* User Object specific access rights */
367
368 #define SA_RIGHT_USER_GET_NAME_ETC      0x00000001
369 #define SA_RIGHT_USER_GET_LOCALE        0x00000002
370 #define SA_RIGHT_USER_SET_LOC_COM       0x00000004
371 #define SA_RIGHT_USER_GET_LOGONINFO     0x00000008
372 #define SA_RIGHT_USER_ACCT_FLAGS_EXPIRY 0x00000010
373 #define SA_RIGHT_USER_SET_ATTRIBUTES    0x00000020
374 #define SA_RIGHT_USER_CHANGE_PASSWORD   0x00000040
375 #define SA_RIGHT_USER_SET_PASSWORD      0x00000080
376 #define SA_RIGHT_USER_GET_GROUPS        0x00000100
377 #define SA_RIGHT_USER_READ_GROUP_MEM    0x00000200
378 #define SA_RIGHT_USER_CHANGE_GROUP_MEM  0x00000400
379
380 #define SA_RIGHT_USER_ALL_ACCESS        0x000007FF
381
382 #define GENERIC_RIGHTS_USER_ALL_ACCESS \
383                 (STANDARD_RIGHTS_REQUIRED_ACCESS| \
384                 SA_RIGHT_USER_ALL_ACCESS)       /* 0x000f07ff */
385
386 #define GENERIC_RIGHTS_USER_READ \
387                 (STANDARD_RIGHTS_READ_ACCESS    | \
388                 SA_RIGHT_USER_READ_GROUP_MEM    | \
389                 SA_RIGHT_USER_GET_GROUPS        | \
390                 SA_RIGHT_USER_ACCT_FLAGS_EXPIRY | \
391                 SA_RIGHT_USER_GET_LOGONINFO     | \
392                 SA_RIGHT_USER_GET_LOCALE)       /* 0x0002031a */
393
394 #define GENERIC_RIGHTS_USER_WRITE \
395                 (STANDARD_RIGHTS_WRITE_ACCESS   | \
396                 SA_RIGHT_USER_CHANGE_PASSWORD   | \
397                 SA_RIGHT_USER_SET_LOC_COM       | \
398                 SA_RIGHT_USER_SET_ATTRIBUTES    | \
399                 SA_RIGHT_USER_SET_PASSWORD      | \
400                 SA_RIGHT_USER_CHANGE_GROUP_MEM) /* 0x000204e4 */
401
402 #define GENERIC_RIGHTS_USER_EXECUTE \
403                 (STANDARD_RIGHTS_EXECUTE_ACCESS | \
404                 SA_RIGHT_USER_CHANGE_PASSWORD   | \
405                 SA_RIGHT_USER_GET_NAME_ETC )    /* 0x00020041 */
406
407
408 /* Group Object specific access rights */
409
410 #define SA_RIGHT_GROUP_LOOKUP_INFO      0x00000001
411 #define SA_RIGHT_GROUP_SET_INFO         0x00000002
412 #define SA_RIGHT_GROUP_ADD_MEMBER       0x00000004
413 #define SA_RIGHT_GROUP_REMOVE_MEMBER    0x00000008
414 #define SA_RIGHT_GROUP_GET_MEMBERS      0x00000010
415
416 #define SA_RIGHT_GROUP_ALL_ACCESS       0x0000001F
417
418 #define GENERIC_RIGHTS_GROUP_ALL_ACCESS \
419                 (STANDARD_RIGHTS_REQUIRED_ACCESS| \
420                 SA_RIGHT_GROUP_ALL_ACCESS)      /* 0x000f001f */
421
422 #define GENERIC_RIGHTS_GROUP_READ \
423                 (STANDARD_RIGHTS_READ_ACCESS    | \
424                 SA_RIGHT_GROUP_GET_MEMBERS)     /* 0x00020010 */
425
426 #define GENERIC_RIGHTS_GROUP_WRITE \
427                 (STANDARD_RIGHTS_WRITE_ACCESS   | \
428                 SA_RIGHT_GROUP_REMOVE_MEMBER    | \
429                 SA_RIGHT_GROUP_ADD_MEMBER       | \
430                 SA_RIGHT_GROUP_SET_INFO )       /* 0x0002000e */
431
432 #define GENERIC_RIGHTS_GROUP_EXECUTE \
433                 (STANDARD_RIGHTS_EXECUTE_ACCESS | \
434                 SA_RIGHT_GROUP_LOOKUP_INFO)     /* 0x00020001 */
435
436
437 /* Alias Object specific access rights */
438
439 #define SA_RIGHT_ALIAS_ADD_MEMBER       0x00000001
440 #define SA_RIGHT_ALIAS_REMOVE_MEMBER    0x00000002
441 #define SA_RIGHT_ALIAS_GET_MEMBERS      0x00000004
442 #define SA_RIGHT_ALIAS_LOOKUP_INFO      0x00000008
443 #define SA_RIGHT_ALIAS_SET_INFO         0x00000010
444
445 #define SA_RIGHT_ALIAS_ALL_ACCESS       0x0000001F
446
447 #define GENERIC_RIGHTS_ALIAS_ALL_ACCESS \
448                 (STANDARD_RIGHTS_REQUIRED_ACCESS| \
449                 SA_RIGHT_ALIAS_ALL_ACCESS)      /* 0x000f001f */
450
451 #define GENERIC_RIGHTS_ALIAS_READ \
452                 (STANDARD_RIGHTS_READ_ACCESS    | \
453                 SA_RIGHT_ALIAS_GET_MEMBERS )    /* 0x00020004 */
454
455 #define GENERIC_RIGHTS_ALIAS_WRITE \
456                 (STANDARD_RIGHTS_WRITE_ACCESS   | \
457                 SA_RIGHT_ALIAS_REMOVE_MEMBER    | \
458                 SA_RIGHT_ALIAS_ADD_MEMBER       | \
459                 SA_RIGHT_ALIAS_SET_INFO )       /* 0x00020013 */
460
461 #define GENERIC_RIGHTS_ALIAS_EXECUTE \
462                 (STANDARD_RIGHTS_EXECUTE_ACCESS | \
463                 SA_RIGHT_ALIAS_LOOKUP_INFO )    /* 0x00020008 */
464
465 /*
466  * Acces bits for the svcctl objects
467  */
468
469 /* Service Control Manager Bits */ 
470
471 #define SC_RIGHT_MGR_CONNECT                    0x0001
472 #define SC_RIGHT_MGR_CREATE_SERVICE             0x0002
473 #define SC_RIGHT_MGR_ENUMERATE_SERVICE          0x0004
474 #define SC_RIGHT_MGR_LOCK                       0x0008
475 #define SC_RIGHT_MGR_QUERY_LOCK_STATUS          0x0010
476 #define SC_RIGHT_MGR_MODIFY_BOOT_CONFIG         0x0020
477
478 #define SC_MANAGER_READ_ACCESS \
479         ( STANDARD_RIGHTS_READ_ACCESS           | \
480           SC_RIGHT_MGR_CONNECT                  | \
481           SC_RIGHT_MGR_ENUMERATE_SERVICE        | \
482           SC_RIGHT_MGR_QUERY_LOCK_STATUS )
483
484 #define SC_MANAGER_EXECUTE_ACCESS SC_MANAGER_READ_ACCESS
485
486 #define SC_MANAGER_WRITE_ACCESS \
487         ( STANDARD_RIGHTS_REQUIRED_ACCESS       | \
488           SC_MANAGER_READ_ACCESS                | \
489           SC_RIGHT_MGR_CREATE_SERVICE           | \
490           SC_RIGHT_MGR_LOCK                     | \
491           SC_RIGHT_MGR_MODIFY_BOOT_CONFIG )
492
493 #define SC_MANAGER_ALL_ACCESS SC_MANAGER_WRITE_ACCESS
494
495 /* Service Object Bits */ 
496
497 #define SC_RIGHT_SVC_QUERY_CONFIG               0x0001
498 #define SC_RIGHT_SVC_CHANGE_CONFIG              0x0002
499 #define SC_RIGHT_SVC_QUERY_STATUS               0x0004
500 #define SC_RIGHT_SVC_ENUMERATE_DEPENDENTS       0x0008
501 #define SC_RIGHT_SVC_START                      0x0010
502 #define SC_RIGHT_SVC_STOP                       0x0020
503 #define SC_RIGHT_SVC_PAUSE_CONTINUE             0x0040
504 #define SC_RIGHT_SVC_INTERROGATE                0x0080
505 #define SC_RIGHT_SVC_USER_DEFINED_CONTROL       0x0100
506
507 #define SERVICE_READ_ACCESS \
508         ( STANDARD_RIGHTS_READ_ACCESS           | \
509           SC_RIGHT_SVC_ENUMERATE_DEPENDENTS     | \
510           SC_RIGHT_SVC_INTERROGATE              | \
511           SC_RIGHT_SVC_QUERY_CONFIG             | \
512           SC_RIGHT_SVC_QUERY_STATUS             | \
513           SC_RIGHT_SVC_USER_DEFINED_CONTROL )
514
515 #define SERVICE_EXECUTE_ACCESS \
516         ( SERVICE_READ_ACCESS                   | \
517           SC_RIGHT_SVC_START                    | \
518           SC_RIGHT_SVC_STOP                     | \
519           SC_RIGHT_SVC_PAUSE_CONTINUE )
520
521 #define SERVICE_WRITE_ACCESS \
522         ( STANDARD_RIGHTS_REQUIRED_ACCESS       | \
523           SERVICE_READ_ACCESS                   | \
524           SERVICE_EXECUTE_ACCESS                | \
525           SC_RIGHT_SVC_CHANGE_CONFIG )
526
527 #define SERVICE_ALL_ACCESS SERVICE_WRITE_ACCESS
528
529            
530
531 /*
532  * Access Bits for registry ACLS
533  */
534
535 /* used by registry ACLs */
536
537 #define SEC_RIGHTS_QUERY_VALUE          0x00000001
538 #define SEC_RIGHTS_SET_VALUE            0x00000002
539 #define SEC_RIGHTS_CREATE_SUBKEY        0x00000004
540 #define SEC_RIGHTS_ENUM_SUBKEYS         0x00000008
541 #define SEC_RIGHTS_NOTIFY               0x00000010
542 #define SEC_RIGHTS_CREATE_LINK          0x00000020
543 #define SEC_RIGHTS_MAXIMUM_ALLOWED      0x02000000
544
545
546 #define REG_KEY_READ \
547         ( STANDARD_RIGHTS_READ_ACCESS           |\
548           SEC_RIGHTS_QUERY_VALUE                |\
549           SEC_RIGHTS_ENUM_SUBKEYS               |\
550           SEC_RIGHTS_NOTIFY )
551           
552 #define REG_KEY_EXECUTE REG_KEY_READ
553
554 #define REG_KEY_WRITE \
555         ( STANDARD_RIGHTS_WRITE_ACCESS          |\
556           SEC_RIGHTS_SET_VALUE                  |\
557           SEC_RIGHTS_CREATE_SUBKEY )
558
559 #define REG_KEY_ALL \
560         ( STANDARD_RIGHTS_REQUIRED_ACCESS       |\
561           REG_KEY_READ                          |\
562           REG_KEY_WRITE                         |\
563           SEC_RIGHTS_CREATE_LINK )
564
565
566 #endif /* _RPC_SECDES_H */