r5726: merge LsaLookupPrivValue() code from trunk
[ira/wip.git] / source3 / include / privileges.h
1
2 /* 
3    Unix SMB/CIFS implementation.
4    SMB parameters and setup
5    Copyright (C) Andrew Tridgell 1992-1997
6    Copyright (C) Luke Kenneth Casson Leighton 1996-1997
7    Copyright (C) Paul Ashton 1997
8    Copyright (C) Simo Sorce 2003
9    Copyright (C) Gerald (Jerry) Carter 2005
10    
11    This program is free software; you can redistribute it and/or modify
12    it under the terms of the GNU General Public License as published by
13    the Free Software Foundation; either version 2 of the License, or
14    (at your option) any later version.
15    
16    This program is distributed in the hope that it will be useful,
17    but WITHOUT ANY WARRANTY; without even the implied warranty of
18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19    GNU General Public License for more details.
20    
21    You should have received a copy of the GNU General Public License
22    along with this program; if not, write to the Free Software
23    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26 #ifndef PRIVILEGES_H
27 #define PRIVILEGES_H
28
29 /* privilege bitmask */
30
31 #define SE_PRIV_MASKSIZE 4
32
33 typedef struct {
34         uint32 mask[SE_PRIV_MASKSIZE];
35 } SE_PRIV;
36
37
38 /* common privilege defines */
39
40 #define SE_END                          { { 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }
41 #define SE_NONE                         { { 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }
42 #define SE_ALL_PRIVS                    { { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF } }
43
44
45 /* 
46  * We will use our own set of privileges since it makes no sense
47  * to implement all of the Windows set when only a portion will
48  * be used.  Use 128-bit mask to give room to grow.
49  */
50
51 #define SE_NETWORK_LOGON                { { 0x00000001, 0x00000000, 0x00000000, 0x00000000 } }
52 #define SE_INTERACTIVE_LOGON            { { 0x00000002, 0x00000000, 0x00000000, 0x00000000 } }
53 #define SE_BATCH_LOGON                  { { 0x00000004, 0x00000000, 0x00000000, 0x00000000 } }
54 #define SE_SERVICE_LOGON                { { 0x00000008, 0x00000000, 0x00000000, 0x00000000 } }
55 #define SE_MACHINE_ACCOUNT              { { 0x00000010, 0x00000000, 0x00000000, 0x00000000 } }
56 #define SE_PRINT_OPERATOR               { { 0x00000020, 0x00000000, 0x00000000, 0x00000000 } }
57 #define SE_ADD_USERS                    { { 0x00000040, 0x00000000, 0x00000000, 0x00000000 } }
58 #define SE_DISK_OPERATOR                { { 0x00000080, 0x00000000, 0x00000000, 0x00000000 } }
59 #define SE_REMOTE_SHUTDOWN              { { 0x00000100, 0x00000000, 0x00000000, 0x00000000 } }
60
61 /* defined in lib/privilegs.c */
62
63 extern const SE_PRIV se_priv_none;
64 extern const SE_PRIV se_machine_account;
65 extern const SE_PRIV se_print_operator;
66 extern const SE_PRIV se_add_users;
67 extern const SE_PRIV se_disk_operators;
68 extern const SE_PRIV se_remote_shutdown;
69
70
71 /*
72  * These are used in Lsa replies (srv_lsa_nt.c)
73  */
74 #define PR_NONE                0x0000
75 #define PR_LOG_ON_LOCALLY      0x0001
76 #define PR_ACCESS_FROM_NETWORK 0x0002
77 #define PR_LOG_ON_BATCH_JOB    0x0004
78 #define PR_LOG_ON_SERVICE      0x0010
79
80
81 #ifndef _BOOL
82 typedef int BOOL;
83 #define _BOOL       /* So we don't typedef BOOL again in vfs.h */
84 #endif
85
86 typedef struct LUID
87 {
88         uint32 low;
89         uint32 high;
90 } LUID;
91
92 typedef struct LUID_ATTR
93 {
94         LUID luid;
95         uint32 attr;
96 } LUID_ATTR;
97
98 typedef struct privilege_set
99 {
100         TALLOC_CTX *mem_ctx;
101         BOOL ext_ctx;
102         uint32 count;
103         uint32 control;
104         LUID_ATTR *set;
105 } PRIVILEGE_SET;
106
107 typedef struct _PRIVS {
108         SE_PRIV se_priv;
109         const char *name;
110         const char *description;
111 } PRIVS;
112
113 #endif /* PRIVILEGES_H */