smbd: Convert driver_unlink_internals to synthetic_smb_fname
[Samba/bjacke.git] / libcli / security / secdesc.h
blobb8190a1e56443975ba2e17cb11c3737981dd172b
1 /*
2 * Unix SMB/Netbios implementation.
3 * SEC_DESC handling functions
4 * Copyright (C) Andrew Tridgell 1992-1998,
5 * Copyright (C) Jeremy R. Allison 1995-2003.
6 * Copyright (C) Luke Kenneth Casson Leighton 1996-1998,
7 * Copyright (C) Paul Ashton 1997-1998.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, see <http://www.gnu.org/licenses/>.
23 #ifndef _SECDESC_H_
24 #define _SECDESC_H_
26 /* The following definitions come from libcli/security/secdesc.c */
27 #include "librpc/gen_ndr/security.h"
29 /*******************************************************************
30 Given a security_descriptor return the sec_info.
31 ********************************************************************/
32 uint32_t get_sec_info(const struct security_descriptor *sd);
34 /*******************************************************************
35 Merge part of security descriptor old_sec in to the empty sections of
36 security descriptor new_sec.
37 ********************************************************************/
38 struct sec_desc_buf *sec_desc_merge_buf(TALLOC_CTX *ctx, struct sec_desc_buf *new_sdb, struct sec_desc_buf *old_sdb);
39 struct security_descriptor *sec_desc_merge(TALLOC_CTX *ctx, struct security_descriptor *new_sdb, struct security_descriptor *old_sdb);
41 /*******************************************************************
42 Creates a struct security_descriptor structure
43 ********************************************************************/
44 struct security_descriptor *make_sec_desc(TALLOC_CTX *ctx,
45 enum security_descriptor_revision revision,
46 uint16_t type,
47 const struct dom_sid *owner_sid, const struct dom_sid *grp_sid,
48 struct security_acl *sacl, struct security_acl *dacl, size_t *sd_size);
50 /*******************************************************************
51 Duplicate a struct security_descriptor structure.
52 ********************************************************************/
53 struct security_descriptor *dup_sec_desc(TALLOC_CTX *ctx, const struct security_descriptor *src);
55 /*******************************************************************
56 Convert a secdesc into a byte stream
57 ********************************************************************/
58 NTSTATUS marshall_sec_desc(TALLOC_CTX *mem_ctx,
59 const struct security_descriptor *secdesc,
60 uint8_t **data, size_t *len);
62 /*******************************************************************
63 Convert a secdesc_buf into a byte stream
64 ********************************************************************/
65 NTSTATUS marshall_sec_desc_buf(TALLOC_CTX *mem_ctx,
66 const struct sec_desc_buf *secdesc_buf,
67 uint8_t **data, size_t *len);
69 /*******************************************************************
70 Parse a byte stream into a secdesc
71 ********************************************************************/
72 NTSTATUS unmarshall_sec_desc(TALLOC_CTX *mem_ctx, uint8_t *data, size_t len,
73 struct security_descriptor **psecdesc);
75 /*******************************************************************
76 Parse a byte stream into a sec_desc_buf
77 ********************************************************************/
78 NTSTATUS unmarshall_sec_desc_buf(TALLOC_CTX *mem_ctx, uint8_t *data, size_t len,
79 struct sec_desc_buf **psecdesc_buf);
81 /*******************************************************************
82 Creates a struct security_descriptor structure with typical defaults.
83 ********************************************************************/
84 struct security_descriptor *make_standard_sec_desc(TALLOC_CTX *ctx, const struct dom_sid *owner_sid, const struct dom_sid *grp_sid,
85 struct security_acl *dacl, size_t *sd_size);
87 /*******************************************************************
88 Creates a struct sec_desc_buf structure.
89 ********************************************************************/
90 struct sec_desc_buf *make_sec_desc_buf(TALLOC_CTX *ctx, size_t len, struct security_descriptor *sec_desc);
92 /*******************************************************************
93 Duplicates a struct sec_desc_buf structure.
94 ********************************************************************/
95 struct sec_desc_buf *dup_sec_desc_buf(TALLOC_CTX *ctx, struct sec_desc_buf *src);
97 /*******************************************************************
98 Add a new SID with its permissions to struct security_descriptor.
99 ********************************************************************/
100 NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, struct security_descriptor **psd, const struct dom_sid *sid, uint32_t mask, size_t *sd_size);
102 /*******************************************************************
103 Modify a SID's permissions in a struct security_descriptor.
104 ********************************************************************/
105 NTSTATUS sec_desc_mod_sid(struct security_descriptor *sd, struct dom_sid *sid, uint32_t mask);
107 /*******************************************************************
108 Delete a SID from a struct security_descriptor.
109 ********************************************************************/
110 NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, struct security_descriptor **psd, struct dom_sid *sid, size_t *sd_size);
111 bool sd_has_inheritable_components(const struct security_descriptor *parent_ctr, bool container);
112 NTSTATUS se_create_child_secdesc(TALLOC_CTX *ctx,
113 struct security_descriptor **ppsd,
114 size_t *psize,
115 const struct security_descriptor *parent_ctr,
116 const struct dom_sid *owner_sid,
117 const struct dom_sid *group_sid,
118 bool container);
119 NTSTATUS se_create_child_secdesc_buf(TALLOC_CTX *ctx,
120 struct sec_desc_buf **ppsdb,
121 const struct security_descriptor *parent_ctr,
122 bool container);
124 #endif /* _SECDESC_H_ */