shadow_copy2: fix shadow_copy2_convert() in the classical case.
[Samba.git] / libcli / security / security_descriptor.h
blob1c7f893ead8d29f55a4e0c702d04e6cf1053a5cc
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_sacl_add(struct security_descriptor *sd,
30 const struct security_ace *ace);
31 NTSTATUS security_descriptor_dacl_add(struct security_descriptor *sd,
32 const struct security_ace *ace);
33 NTSTATUS security_descriptor_dacl_del(struct security_descriptor *sd,
34 const struct dom_sid *trustee);
35 NTSTATUS security_descriptor_sacl_del(struct security_descriptor *sd,
36 const struct dom_sid *trustee);
37 bool security_ace_equal(const struct security_ace *ace1,
38 const struct security_ace *ace2);
39 bool security_acl_equal(const struct security_acl *acl1,
40 const struct security_acl *acl2);
41 bool security_descriptor_equal(const struct security_descriptor *sd1,
42 const struct security_descriptor *sd2);
43 bool security_descriptor_mask_equal(const struct security_descriptor *sd1,
44 const struct security_descriptor *sd2,
45 uint32_t mask);
46 struct security_descriptor *security_descriptor_append(struct security_descriptor *sd,
47 ...);
48 struct security_descriptor *security_descriptor_dacl_create(TALLOC_CTX *mem_ctx,
49 uint16_t sd_type,
50 const char *owner_sid,
51 const char *group_sid,
52 ...);
53 struct security_descriptor *security_descriptor_sacl_create(TALLOC_CTX *mem_ctx,
54 uint16_t sd_type,
55 const char *owner_sid,
56 const char *group_sid,
57 ...);
58 struct security_ace *security_ace_create(TALLOC_CTX *mem_ctx,
59 const char *sid_str,
60 enum security_ace_type type,
61 uint32_t access_mask,
62 uint8_t flags);
64 struct security_acl *security_acl_dup(TALLOC_CTX *mem_ctx,
65 const struct security_acl *oacl);
67 struct security_acl *security_acl_concatenate(TALLOC_CTX *mem_ctx,
68 const struct security_acl *acl1,
69 const struct security_acl *acl2);
71 uint32_t map_generic_rights_ds(uint32_t access_mask);
73 struct security_descriptor *create_security_descriptor(TALLOC_CTX *mem_ctx,
74 struct security_descriptor *parent_sd,
75 struct security_descriptor *creator_sd,
76 bool is_container,
77 struct GUID *object_list,
78 uint32_t inherit_flags,
79 struct security_token *token,
80 struct dom_sid *default_owner, /* valid only for DS, NULL for the other RSs */
81 struct dom_sid *default_group, /* valid only for DS, NULL for the other RSs */
82 uint32_t (*generic_map)(uint32_t access_mask));
84 #endif /* __SECURITY_DESCRIPTOR_H__ */