smbspool_krb5_wrapper: let kerberos_get_default_ccache() use smb_force_krb5_cc_defaul...
[Samba.git] / libcli / security / conditional_ace.h
blobe59205679342dd85ef19939c9686bc640a8206ae
1 /*
2 Unix SMB/CIFS implementation.
3 Samba utility functions
5 Copyright © Catalyst
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 _CONDITIONAL_ACE_H_
22 #define _CONDITIONAL_ACE_H_
24 #include <talloc.h>
25 #include "lib/util/data_blob.h"
27 #include "librpc/gen_ndr/conditional_ace.h"
30 struct ace_condition_script *parse_conditional_ace(TALLOC_CTX *mem_ctx,
31 DATA_BLOB data);
33 int run_conditional_ace(TALLOC_CTX *mem_ctx,
34 const struct security_token *token,
35 struct ace_condition_script *program,
36 const struct security_descriptor *sd);
39 bool access_check_conditional_ace(const struct security_ace *ace,
40 const struct security_token *token,
41 const struct security_descriptor *sd,
42 int *result);
44 bool conditional_ace_encode_binary(TALLOC_CTX *mem_ctx,
45 struct ace_condition_script *program,
46 DATA_BLOB *dest);
48 struct ace_condition_script * ace_conditions_compile_sddl(TALLOC_CTX *mem_ctx,
49 const enum ace_condition_flags ace_condition_flags,
50 const char *sddl,
51 const char **message,
52 size_t *message_offset,
53 size_t *consumed_length);
55 char *debug_conditional_ace(TALLOC_CTX *mem_ctx,
56 struct ace_condition_script *program);
58 char *sddl_from_conditional_ace(TALLOC_CTX *mem_ctx,
59 struct ace_condition_script *program);
61 #define IS_INT_TOKEN(x) \
62 (((x)->type) == CONDITIONAL_ACE_TOKEN_INT64 || \
63 unlikely(((x)->type) == CONDITIONAL_ACE_TOKEN_INT32 || \
64 ((x)->type) == CONDITIONAL_ACE_TOKEN_INT16 || \
65 ((x)->type) == CONDITIONAL_ACE_TOKEN_INT8) \
68 #define IS_BOOL_TOKEN(x) \
69 (((x)->type) == CONDITIONAL_ACE_SAMBA_RESULT_BOOL)
71 #define IS_DERIVED_TOKEN(x) \
72 ((((x)->flags) & CONDITIONAL_ACE_FLAG_TOKEN_FROM_ATTR) == 0)
74 #define IS_LITERAL_TOKEN(x) \
75 ((IS_INT_TOKEN(x) || \
76 ((x)->type) == CONDITIONAL_ACE_TOKEN_UNICODE || \
77 ((x)->type) == CONDITIONAL_ACE_TOKEN_OCTET_STRING || \
78 ((x)->type) == CONDITIONAL_ACE_TOKEN_SID || \
79 ((x)->type) == CONDITIONAL_ACE_TOKEN_COMPOSITE) && \
80 (! IS_DERIVED_TOKEN(x)))
82 struct CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 *parse_sddl_literal_as_claim(
83 TALLOC_CTX *mem_ctx,
84 const char *name,
85 const char *str);
87 struct CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 *sddl_decode_resource_attr (
88 TALLOC_CTX *mem_ctx,
89 const char *str,
90 size_t *length);
92 char *sddl_resource_attr_from_claim(
93 TALLOC_CTX *mem_ctx,
94 const struct CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 *claim);
97 #endif /*_CONDITIONAL_ACE_H_*/