tests: Improve the error message for bad format chars
[samba4-gss.git] / libcli / security / security_descriptor.h
blob6ff365fe54363d48b5a9ad594e0b3eaff2c06494
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 "lib/util/data_blob.h"
25 #include "librpc/gen_ndr/security.h"
27 struct security_descriptor *security_descriptor_initialise(TALLOC_CTX *mem_ctx);
28 struct security_descriptor *security_descriptor_copy(TALLOC_CTX *mem_ctx,
29 const struct security_descriptor *osd);
30 NTSTATUS security_descriptor_for_client(TALLOC_CTX *mem_ctx,
31 const struct security_descriptor *ssd,
32 uint32_t sec_info,
33 uint32_t access_granted,
34 struct security_descriptor **_csd);
35 NTSTATUS security_descriptor_sacl_add(struct security_descriptor *sd,
36 const struct security_ace *ace);
37 NTSTATUS security_descriptor_sacl_insert(struct security_descriptor *sd,
38 const struct security_ace *ace,
39 ssize_t idx);
40 NTSTATUS security_descriptor_dacl_add(struct security_descriptor *sd,
41 const struct security_ace *ace);
42 NTSTATUS security_descriptor_dacl_insert(struct security_descriptor *sd,
43 const struct security_ace *ace,
44 ssize_t idx);
45 NTSTATUS security_descriptor_dacl_del(struct security_descriptor *sd,
46 const struct dom_sid *trustee);
47 NTSTATUS security_descriptor_sacl_del(struct security_descriptor *sd,
48 const struct dom_sid *trustee);
49 NTSTATUS security_descriptor_dacl_del_ace(struct security_descriptor *sd,
50 const struct security_ace *ace);
51 NTSTATUS security_descriptor_sacl_del_ace(struct security_descriptor *sd,
52 const struct security_ace *ace);
53 bool security_ace_equal(const struct security_ace *ace1,
54 const struct security_ace *ace2);
55 bool security_acl_equal(const struct security_acl *acl1,
56 const struct security_acl *acl2);
57 bool security_descriptor_equal(const struct security_descriptor *sd1,
58 const struct security_descriptor *sd2);
59 bool security_descriptor_mask_equal(const struct security_descriptor *sd1,
60 const struct security_descriptor *sd2,
61 uint32_t mask);
62 struct security_descriptor *security_descriptor_dacl_create(TALLOC_CTX *mem_ctx,
63 uint16_t sd_type,
64 const char *owner_sid,
65 const char *group_sid,
66 ...);
67 struct security_descriptor *security_descriptor_sacl_create(TALLOC_CTX *mem_ctx,
68 uint16_t sd_type,
69 const char *owner_sid,
70 const char *group_sid,
71 ...);
72 struct security_ace *security_ace_create(TALLOC_CTX *mem_ctx,
73 const char *sid_str,
74 enum security_ace_type type,
75 uint32_t access_mask,
76 uint8_t flags);
78 struct security_acl *security_acl_dup(TALLOC_CTX *mem_ctx,
79 const struct security_acl *oacl);
81 struct security_acl *security_acl_concatenate(TALLOC_CTX *mem_ctx,
82 const struct security_acl *acl1,
83 const struct security_acl *acl2);
85 uint32_t map_generic_rights_ds(uint32_t access_mask);
87 struct security_descriptor *create_security_descriptor(TALLOC_CTX *mem_ctx,
88 struct security_descriptor *parent_sd,
89 struct security_descriptor *creator_sd,
90 bool is_container,
91 struct GUID *object_list,
92 uint32_t inherit_flags,
93 struct security_token *token,
94 struct dom_sid *default_owner, /* valid only for DS, NULL for the other RSs */
95 struct dom_sid *default_group, /* valid only for DS, NULL for the other RSs */
96 uint32_t (*generic_map)(uint32_t access_mask));
98 bool security_descriptor_with_ms_nfs(const struct security_descriptor *psd);
100 #endif /* __SECURITY_DESCRIPTOR_H__ */