nfs4acls: Introduce a helper variable
[Samba.git] / libcli / security / security_descriptor.h
blobdd5d5f3804957706f68a784f103efb0a12b4b10b
1 /*
2 Unix SMB/CIFS implementation.
3 Samba utility functions
5 Copyright (C) 2009 Jelmer Vernooij <jelmer@samba.org>
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 3 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, see <http://www.gnu.org/licenses/>.
21 #ifndef __SECURITY_DESCRIPTOR_H__
22 #define __SECURITY_DESCRIPTOR_H__
24 #include "librpc/gen_ndr/security.h"
26 struct security_descriptor *security_descriptor_initialise(TALLOC_CTX *mem_ctx);
27 struct security_descriptor *security_descriptor_copy(TALLOC_CTX *mem_ctx,
28 const struct security_descriptor *osd);
29 NTSTATUS security_descriptor_for_client(TALLOC_CTX *mem_ctx,
30 const struct security_descriptor *ssd,
31 uint32_t sec_info,
32 uint32_t access_granted,
33 struct security_descriptor **_csd);
34 NTSTATUS security_descriptor_sacl_add(struct security_descriptor *sd,
35 const struct security_ace *ace);
36 NTSTATUS security_descriptor_dacl_add(struct security_descriptor *sd,
37 const struct security_ace *ace);
38 NTSTATUS security_descriptor_dacl_del(struct security_descriptor *sd,
39 const struct dom_sid *trustee);
40 NTSTATUS security_descriptor_sacl_del(struct security_descriptor *sd,
41 const struct dom_sid *trustee);
42 bool security_ace_equal(const struct security_ace *ace1,
43 const struct security_ace *ace2);
44 bool security_acl_equal(const struct security_acl *acl1,
45 const struct security_acl *acl2);
46 bool security_descriptor_equal(const struct security_descriptor *sd1,
47 const struct security_descriptor *sd2);
48 bool security_descriptor_mask_equal(const struct security_descriptor *sd1,
49 const struct security_descriptor *sd2,
50 uint32_t mask);
51 struct security_descriptor *security_descriptor_append(struct security_descriptor *sd,
52 ...);
53 struct security_descriptor *security_descriptor_dacl_create(TALLOC_CTX *mem_ctx,
54 uint16_t sd_type,
55 const char *owner_sid,
56 const char *group_sid,
57 ...);
58 struct security_descriptor *security_descriptor_sacl_create(TALLOC_CTX *mem_ctx,
59 uint16_t sd_type,
60 const char *owner_sid,
61 const char *group_sid,
62 ...);
63 struct security_ace *security_ace_create(TALLOC_CTX *mem_ctx,
64 const char *sid_str,
65 enum security_ace_type type,
66 uint32_t access_mask,
67 uint8_t flags);
69 struct security_acl *security_acl_dup(TALLOC_CTX *mem_ctx,
70 const struct security_acl *oacl);
72 struct security_acl *security_acl_concatenate(TALLOC_CTX *mem_ctx,
73 const struct security_acl *acl1,
74 const struct security_acl *acl2);
76 uint32_t map_generic_rights_ds(uint32_t access_mask);
78 struct security_descriptor *create_security_descriptor(TALLOC_CTX *mem_ctx,
79 struct security_descriptor *parent_sd,
80 struct security_descriptor *creator_sd,
81 bool is_container,
82 struct GUID *object_list,
83 uint32_t inherit_flags,
84 struct security_token *token,
85 struct dom_sid *default_owner, /* valid only for DS, NULL for the other RSs */
86 struct dom_sid *default_group, /* valid only for DS, NULL for the other RSs */
87 uint32_t (*generic_map)(uint32_t access_mask));
89 bool security_descriptor_with_ms_nfs(const struct security_descriptor *psd);
91 #endif /* __SECURITY_DESCRIPTOR_H__ */