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
,
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
,
51 struct security_descriptor
*security_descriptor_dacl_create(TALLOC_CTX
*mem_ctx
,
53 const char *owner_sid
,
54 const char *group_sid
,
56 struct security_descriptor
*security_descriptor_sacl_create(TALLOC_CTX
*mem_ctx
,
58 const char *owner_sid
,
59 const char *group_sid
,
61 struct security_ace
*security_ace_create(TALLOC_CTX
*mem_ctx
,
63 enum security_ace_type type
,
67 struct security_acl
*security_acl_dup(TALLOC_CTX
*mem_ctx
,
68 const struct security_acl
*oacl
);
70 struct security_acl
*security_acl_concatenate(TALLOC_CTX
*mem_ctx
,
71 const struct security_acl
*acl1
,
72 const struct security_acl
*acl2
);
74 uint32_t map_generic_rights_ds(uint32_t access_mask
);
76 struct security_descriptor
*create_security_descriptor(TALLOC_CTX
*mem_ctx
,
77 struct security_descriptor
*parent_sd
,
78 struct security_descriptor
*creator_sd
,
80 struct GUID
*object_list
,
81 uint32_t inherit_flags
,
82 struct security_token
*token
,
83 struct dom_sid
*default_owner
, /* valid only for DS, NULL for the other RSs */
84 struct dom_sid
*default_group
, /* valid only for DS, NULL for the other RSs */
85 uint32_t (*generic_map
)(uint32_t access_mask
));
87 bool security_descriptor_with_ms_nfs(const struct security_descriptor
*psd
);
89 #endif /* __SECURITY_DESCRIPTOR_H__ */