pam_wrapper: #ifdef-out unused functions
[Samba.git] / libcli / security / security.h
blob4df18eba535997ae46ff0e04d0f5f2a768e80e5e
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 "lib/util/data_blob.h"
24 #include "lib/util/time.h"
26 #include "librpc/gen_ndr/security.h"
28 #define PRIMARY_USER_SID_INDEX 0
29 #define PRIMARY_GROUP_SID_INDEX 1
31 /* File Specific access rights */
32 #define FILE_READ_DATA SEC_FILE_READ_DATA
33 #define FILE_WRITE_DATA SEC_FILE_WRITE_DATA
34 #define FILE_APPEND_DATA SEC_FILE_APPEND_DATA
35 #define FILE_READ_EA SEC_FILE_READ_EA /* File and directory */
36 #define FILE_WRITE_EA SEC_FILE_WRITE_EA /* File and directory */
37 #define FILE_EXECUTE SEC_FILE_EXECUTE
38 #define FILE_READ_ATTRIBUTES SEC_FILE_READ_ATTRIBUTE
39 #define FILE_WRITE_ATTRIBUTES SEC_FILE_WRITE_ATTRIBUTE
41 #define FILE_ALL_ACCESS SEC_FILE_ALL
43 /* Directory specific access rights */
44 #define FILE_LIST_DIRECTORY SEC_DIR_LIST
45 #define FILE_ADD_FILE SEC_DIR_ADD_FILE
46 #define FILE_ADD_SUBDIRECTORY SEC_DIR_ADD_SUBDIR
47 #define FILE_TRAVERSE SEC_DIR_TRAVERSE
48 #define FILE_DELETE_CHILD SEC_DIR_DELETE_CHILD
50 /* Generic access masks & rights. */
51 #define DELETE_ACCESS SEC_STD_DELETE /* (1L<<16) */
52 #define READ_CONTROL_ACCESS SEC_STD_READ_CONTROL /* (1L<<17) */
53 #define WRITE_DAC_ACCESS SEC_STD_WRITE_DAC /* (1L<<18) */
54 #define WRITE_OWNER_ACCESS SEC_STD_WRITE_OWNER /* (1L<<19) */
55 #define SYNCHRONIZE_ACCESS SEC_STD_SYNCHRONIZE /* (1L<<20) */
57 #define SYSTEM_SECURITY_ACCESS SEC_FLAG_SYSTEM_SECURITY /* (1L<<24) */
58 #define MAXIMUM_ALLOWED_ACCESS SEC_FLAG_MAXIMUM_ALLOWED /* (1L<<25) */
59 #define GENERIC_ALL_ACCESS SEC_GENERIC_ALL /* (1<<28) */
60 #define GENERIC_EXECUTE_ACCESS SEC_GENERIC_EXECUTE /* (1<<29) */
61 #define GENERIC_WRITE_ACCESS SEC_GENERIC_WRITE /* (1<<30) */
62 #define GENERIC_READ_ACCESS ((unsigned)SEC_GENERIC_READ) /* (((unsigned)1)<<31) */
64 /* Mapping of generic access rights for files to specific rights. */
66 /* This maps to 0x1F01FF */
67 #define FILE_GENERIC_ALL (STANDARD_RIGHTS_REQUIRED_ACCESS|\
68 SEC_STD_SYNCHRONIZE|\
69 FILE_ALL_ACCESS)
71 /* This maps to 0x120089 */
72 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ_ACCESS|\
73 FILE_READ_DATA|\
74 FILE_READ_ATTRIBUTES|\
75 FILE_READ_EA|\
76 SYNCHRONIZE_ACCESS)
78 /* This maps to 0x120116 */
79 #define FILE_GENERIC_WRITE (SEC_STD_READ_CONTROL|\
80 FILE_WRITE_DATA|\
81 FILE_WRITE_ATTRIBUTES|\
82 FILE_WRITE_EA|\
83 FILE_APPEND_DATA|\
84 SYNCHRONIZE_ACCESS)
86 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE_ACCESS|\
87 FILE_READ_ATTRIBUTES|\
88 FILE_EXECUTE|\
89 SYNCHRONIZE_ACCESS)
91 /* Share specific rights. */
92 #define SHARE_ALL_ACCESS FILE_GENERIC_ALL
93 #define SHARE_READ_ONLY (FILE_GENERIC_READ|FILE_EXECUTE)
95 /**
96 * Remaining access is a bit mask of remaining access rights (bits) that have
97 * to be granted in order to fulfill the requested access.
99 * The GUID is optional, if specified it restricts this object tree and its
100 * childs to object/attributes that inherits from this GUID.
101 * For DS access an object inherits from a GUID if one of its class has this GUID
102 * in the schemaIDGUID attribute.
104 struct object_tree {
105 uint32_t remaining_access;
106 struct GUID guid;
107 int num_of_children;
108 struct object_tree *children;
111 /* Moved the dom_sid functions to the top level dir with manual proto header */
112 #include "libcli/security/dom_sid.h"
113 #include "libcli/security/secace.h"
114 #include "libcli/security/secacl.h"
115 #include "libcli/security/secdesc.h"
116 #include "libcli/security/security_descriptor.h"
117 #include "libcli/security/security_token.h"
118 #include "libcli/security/sddl.h"
119 #include "libcli/security/privileges.h"
120 #include "libcli/security/access_check.h"
121 #include "libcli/security/session.h"
122 #include "libcli/security/display_sec.h"
124 #endif