4 /* The following definitions come from libcli/security/secdesc.c */
5 #include "librpc/gen_ndr/security.h"
7 /*******************************************************************
8 Given a security_descriptor return the sec_info.
9 ********************************************************************/
10 uint32_t get_sec_info(const struct security_descriptor *sd);
12 /*******************************************************************
13 Merge part of security descriptor old_sec in to the empty sections of
14 security descriptor new_sec.
15 ********************************************************************/
16 struct sec_desc_buf *sec_desc_merge_buf(TALLOC_CTX *ctx, struct sec_desc_buf *new_sdb, struct sec_desc_buf *old_sdb);
17 struct security_descriptor *sec_desc_merge(TALLOC_CTX *ctx, struct security_descriptor *new_sdb, struct security_descriptor *old_sdb);
19 /*******************************************************************
20 Creates a struct security_descriptor structure
21 ********************************************************************/
22 struct security_descriptor *make_sec_desc(TALLOC_CTX *ctx,
23 enum security_descriptor_revision revision,
25 const struct dom_sid *owner_sid, const struct dom_sid *grp_sid,
26 struct security_acl *sacl, struct security_acl *dacl, size_t *sd_size);
28 /*******************************************************************
29 Duplicate a struct security_descriptor structure.
30 ********************************************************************/
31 struct security_descriptor *dup_sec_desc(TALLOC_CTX *ctx, const struct security_descriptor *src);
33 /*******************************************************************
34 Convert a secdesc into a byte stream
35 ********************************************************************/
36 NTSTATUS marshall_sec_desc(TALLOC_CTX *mem_ctx,
37 struct security_descriptor *secdesc,
38 uint8_t **data, size_t *len);
40 /*******************************************************************
41 Convert a secdesc_buf into a byte stream
42 ********************************************************************/
43 NTSTATUS marshall_sec_desc_buf(TALLOC_CTX *mem_ctx,
44 struct sec_desc_buf *secdesc_buf,
45 uint8_t **data, size_t *len);
47 /*******************************************************************
48 Parse a byte stream into a secdesc
49 ********************************************************************/
50 NTSTATUS unmarshall_sec_desc(TALLOC_CTX *mem_ctx, uint8_t *data, size_t len,
51 struct security_descriptor **psecdesc);
53 /*******************************************************************
54 Parse a byte stream into a sec_desc_buf
55 ********************************************************************/
56 NTSTATUS unmarshall_sec_desc_buf(TALLOC_CTX *mem_ctx, uint8_t *data, size_t len,
57 struct sec_desc_buf **psecdesc_buf);
59 /*******************************************************************
60 Creates a struct security_descriptor structure with typical defaults.
61 ********************************************************************/
62 struct security_descriptor *make_standard_sec_desc(TALLOC_CTX *ctx, const struct dom_sid *owner_sid, const struct dom_sid *grp_sid,
63 struct security_acl *dacl, size_t *sd_size);
65 /*******************************************************************
66 Creates a struct sec_desc_buf structure.
67 ********************************************************************/
68 struct sec_desc_buf *make_sec_desc_buf(TALLOC_CTX *ctx, size_t len, struct security_descriptor *sec_desc);
70 /*******************************************************************
71 Duplicates a struct sec_desc_buf structure.
72 ********************************************************************/
73 struct sec_desc_buf *dup_sec_desc_buf(TALLOC_CTX *ctx, struct sec_desc_buf *src);
75 /*******************************************************************
76 Add a new SID with its permissions to struct security_descriptor.
77 ********************************************************************/
78 NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, struct security_descriptor **psd, const struct dom_sid *sid, uint32_t mask, size_t *sd_size);
80 /*******************************************************************
81 Modify a SID's permissions in a struct security_descriptor.
82 ********************************************************************/
83 NTSTATUS sec_desc_mod_sid(struct security_descriptor *sd, struct dom_sid *sid, uint32_t mask);
85 /*******************************************************************
86 Delete a SID from a struct security_descriptor.
87 ********************************************************************/
88 NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, struct security_descriptor **psd, struct dom_sid *sid, size_t *sd_size);
89 bool sd_has_inheritable_components(const struct security_descriptor *parent_ctr, bool container);
90 NTSTATUS se_create_child_secdesc(TALLOC_CTX *ctx,
91 struct security_descriptor **ppsd,
93 const struct security_descriptor *parent_ctr,
94 const struct dom_sid *owner_sid,
95 const struct dom_sid *group_sid,
97 NTSTATUS se_create_child_secdesc_buf(TALLOC_CTX *ctx,
98 struct sec_desc_buf **ppsdb,
99 const struct security_descriptor *parent_ctr,
102 #endif /* _SECDESC_H_ */