s3: SMB2 : Fix leak of blocking lock records in the database.
[Samba.git] / libcli / security / security.h
blob6e4b172e66e1fc08d30eab6c4ead9ea104962bd9
1 /*
2 Unix SMB/CIFS implementation.
4 Copyright (C) Stefan Metzmacher 2006
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef _LIBCLI_SECURITY_SECURITY_H_
21 #define _LIBCLI_SECURITY_SECURITY_H_
23 #include "librpc/gen_ndr/security.h"
25 #define PRIMARY_USER_SID_INDEX 0
26 #define PRIMARY_GROUP_SID_INDEX 1
28 /* File Specific access rights */
29 #define FILE_READ_DATA SEC_FILE_READ_DATA
30 #define FILE_WRITE_DATA SEC_FILE_WRITE_DATA
31 #define FILE_APPEND_DATA SEC_FILE_APPEND_DATA
32 #define FILE_READ_EA SEC_FILE_READ_EA /* File and directory */
33 #define FILE_WRITE_EA SEC_FILE_WRITE_EA /* File and directory */
34 #define FILE_EXECUTE SEC_FILE_EXECUTE
35 #define FILE_READ_ATTRIBUTES SEC_FILE_READ_ATTRIBUTE
36 #define FILE_WRITE_ATTRIBUTES SEC_FILE_WRITE_ATTRIBUTE
38 #define FILE_ALL_ACCESS SEC_FILE_ALL
40 /* Directory specific access rights */
41 #define FILE_LIST_DIRECTORY SEC_DIR_LIST
42 #define FILE_ADD_FILE SEC_DIR_ADD_FILE
43 #define FILE_ADD_SUBDIRECTORY SEC_DIR_ADD_SUBDIR
44 #define FILE_TRAVERSE SEC_DIR_TRAVERSE
45 #define FILE_DELETE_CHILD SEC_DIR_DELETE_CHILD
47 /* Generic access masks & rights. */
48 #define DELETE_ACCESS SEC_STD_DELETE /* (1L<<16) */
49 #define READ_CONTROL_ACCESS SEC_STD_READ_CONTROL /* (1L<<17) */
50 #define WRITE_DAC_ACCESS SEC_STD_WRITE_DAC /* (1L<<18) */
51 #define WRITE_OWNER_ACCESS SEC_STD_WRITE_OWNER /* (1L<<19) */
52 #define SYNCHRONIZE_ACCESS SEC_STD_SYNCHRONIZE /* (1L<<20) */
54 #define SYSTEM_SECURITY_ACCESS SEC_FLAG_SYSTEM_SECURITY /* (1L<<24) */
55 #define MAXIMUM_ALLOWED_ACCESS SEC_FLAG_MAXIMUM_ALLOWED /* (1L<<25) */
56 #define GENERIC_ALL_ACCESS SEC_GENERIC_ALL /* (1<<28) */
57 #define GENERIC_EXECUTE_ACCESS SEC_GENERIC_EXECUTE /* (1<<29) */
58 #define GENERIC_WRITE_ACCESS SEC_GENERIC_WRITE /* (1<<30) */
59 #define GENERIC_READ_ACCESS ((unsigned)SEC_GENERIC_READ) /* (((unsigned)1)<<31) */
61 /* Mapping of generic access rights for files to specific rights. */
63 /* This maps to 0x1F01FF */
64 #define FILE_GENERIC_ALL (STANDARD_RIGHTS_REQUIRED_ACCESS|\
65 SEC_STD_SYNCHRONIZE|\
66 FILE_ALL_ACCESS)
68 /* This maps to 0x120089 */
69 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ_ACCESS|\
70 FILE_READ_DATA|\
71 FILE_READ_ATTRIBUTES|\
72 FILE_READ_EA|\
73 SYNCHRONIZE_ACCESS)
75 /* This maps to 0x120116 */
76 #define FILE_GENERIC_WRITE (SEC_STD_READ_CONTROL|\
77 FILE_WRITE_DATA|\
78 FILE_WRITE_ATTRIBUTES|\
79 FILE_WRITE_EA|\
80 FILE_APPEND_DATA|\
81 SYNCHRONIZE_ACCESS)
83 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE_ACCESS|\
84 FILE_READ_ATTRIBUTES|\
85 FILE_EXECUTE|\
86 SYNCHRONIZE_ACCESS)
88 /* Share specific rights. */
89 #define SHARE_ALL_ACCESS FILE_GENERIC_ALL
90 #define SHARE_READ_ONLY (FILE_GENERIC_READ|FILE_EXECUTE)
92 /**
93 * Remaining access is a bit mask of remaining access rights (bits) that have
94 * to be granted in order to fulfill the requested access.
96 * The GUID is optional, if specified it restricts this object tree and its
97 * childs to object/attributes that inherits from this GUID.
98 * For DS access an object inherits from a GUID if one of its class has this GUID
99 * in the schemaIDGUID attribute.
101 struct object_tree {
102 uint32_t remaining_access;
103 struct GUID guid;
104 int num_of_children;
105 struct object_tree *children;
108 /* Moved the dom_sid functions to the top level dir with manual proto header */
109 #include "libcli/security/dom_sid.h"
110 #include "libcli/security/secace.h"
111 #include "libcli/security/secacl.h"
112 #include "libcli/security/secdesc.h"
113 #include "libcli/security/security_descriptor.h"
114 #include "libcli/security/security_token.h"
115 #include "libcli/security/sddl.h"
116 #include "libcli/security/privileges.h"
117 #include "libcli/security/access_check.h"
118 #include "libcli/security/session.h"
119 #include "libcli/security/display_sec.h"
121 #endif