pidl/lib: Add recursion detection logic to prevent looping.
[Samba.git] / auth / authn_policy_impl.h
blob121c6cbad46898fb98b632119b0b41da1f54faad
1 /*
2 Unix SMB/CIFS implementation.
3 Samba Active Directory authentication policy private implementation details
5 Copyright (C) Catalyst.Net Ltd 2023
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 KDC_AUTHN_POLICY_IMPL_H
22 #define KDC_AUTHN_POLICY_IMPL_H
24 #include "lib/replace/replace.h"
26 #include "auth/authn_policy.h"
27 #include "lib/util/data_blob.h"
28 #include "libcli/util/ntstatus.h"
30 struct authn_policy {
31 const char *silo_name;
32 const char *policy_name;
33 bool enforced;
36 bool authn_policy_is_enforced(const struct authn_policy *policy);
38 struct authn_kerberos_client_policy {
39 struct authn_policy policy;
40 DATA_BLOB allowed_to_authenticate_from;
41 int64_t tgt_lifetime_raw;
44 struct authn_ntlm_client_policy {
45 struct authn_policy policy;
46 DATA_BLOB allowed_to_authenticate_from;
47 bool allowed_ntlm_network_auth;
50 struct authn_server_policy {
51 struct authn_policy policy;
52 DATA_BLOB allowed_to_authenticate_to;
55 /* Auditing information. */
57 struct authn_audit_info {
58 struct authn_policy *policy;
59 const struct auth_user_info_dc *client_info;
60 enum authn_audit_event event;
61 enum authn_audit_reason reason;
62 NTSTATUS policy_status;
63 const char *location;
64 struct authn_int64_optional tgt_lifetime_raw;
67 static inline struct authn_int64_optional authn_int64_some(const int64_t val)
69 return (struct authn_int64_optional) {
70 .is_present = true,
71 .val = val,
75 static inline struct authn_int64_optional authn_int64_none(void)
77 return (struct authn_int64_optional) {
78 .is_present = false,
82 #endif