s4:kdc: remember is_krbtgt, is_rodc and is_trust samba_kdc_entry
[Samba.git] / libcli / auth / netlogon_creds_cli.h
blob56a2dd9bc77bf653dc5f7ff0eb97da210c39d8c6
1 /*
2 Unix SMB/CIFS implementation.
4 module to store/fetch session keys for the schannel client
6 Copyright (C) Stefan Metzmacher 2013
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef NETLOGON_CREDS_CLI_H
23 #define NETLOGON_CREDS_CLI_H
25 #include "librpc/gen_ndr/dcerpc.h"
26 #include "librpc/gen_ndr/schannel.h"
28 struct netlogon_creds_cli_context;
29 struct cli_credentials;
30 struct messaging_context;
31 struct dcerpc_binding_handle;
32 struct db_context;
34 NTSTATUS netlogon_creds_cli_set_global_db(struct db_context **db);
35 NTSTATUS netlogon_creds_cli_open_global_db(struct loadparm_context *lp_ctx);
36 void netlogon_creds_cli_close_global_db(void);
38 NTSTATUS netlogon_creds_cli_context_global(struct loadparm_context *lp_ctx,
39 struct messaging_context *msg_ctx,
40 const char *client_account,
41 enum netr_SchannelType type,
42 const char *server_computer,
43 const char *server_netbios_domain,
44 const char *server_dns_domain,
45 TALLOC_CTX *mem_ctx,
46 struct netlogon_creds_cli_context **_context);
47 NTSTATUS netlogon_creds_bind_cli_credentials(
48 struct netlogon_creds_cli_context *context, TALLOC_CTX *mem_ctx,
49 struct cli_credentials **pcli_creds);
51 char *netlogon_creds_cli_debug_string(
52 const struct netlogon_creds_cli_context *context,
53 TALLOC_CTX *mem_ctx);
55 enum dcerpc_AuthLevel netlogon_creds_cli_auth_level(
56 struct netlogon_creds_cli_context *context);
58 NTSTATUS netlogon_creds_cli_get(struct netlogon_creds_cli_context *context,
59 TALLOC_CTX *mem_ctx,
60 struct netlogon_creds_CredentialState **_creds);
61 bool netlogon_creds_cli_validate(struct netlogon_creds_cli_context *context,
62 const struct netlogon_creds_CredentialState *creds1);
64 NTSTATUS netlogon_creds_cli_store(struct netlogon_creds_cli_context *context,
65 struct netlogon_creds_CredentialState *creds);
66 NTSTATUS netlogon_creds_cli_delete(struct netlogon_creds_cli_context *context,
67 struct netlogon_creds_CredentialState *creds);
68 NTSTATUS netlogon_creds_cli_delete_lck(
69 struct netlogon_creds_cli_context *context);
71 struct tevent_req *netlogon_creds_cli_lock_send(TALLOC_CTX *mem_ctx,
72 struct tevent_context *ev,
73 struct netlogon_creds_cli_context *context);
74 NTSTATUS netlogon_creds_cli_lock_recv(struct tevent_req *req,
75 TALLOC_CTX *mem_ctx,
76 struct netlogon_creds_CredentialState **creds);
77 NTSTATUS netlogon_creds_cli_lock(struct netlogon_creds_cli_context *context,
78 TALLOC_CTX *mem_ctx,
79 struct netlogon_creds_CredentialState **creds);
81 struct netlogon_creds_cli_lck;
83 enum netlogon_creds_cli_lck_type {
84 NETLOGON_CREDS_CLI_LCK_NONE,
85 NETLOGON_CREDS_CLI_LCK_SHARED,
86 NETLOGON_CREDS_CLI_LCK_EXCLUSIVE,
89 struct tevent_req *netlogon_creds_cli_lck_send(
90 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
91 struct netlogon_creds_cli_context *context,
92 enum netlogon_creds_cli_lck_type type);
93 NTSTATUS netlogon_creds_cli_lck_recv(
94 struct tevent_req *req, TALLOC_CTX *mem_ctx,
95 struct netlogon_creds_cli_lck **lck);
96 NTSTATUS netlogon_creds_cli_lck(
97 struct netlogon_creds_cli_context *context,
98 enum netlogon_creds_cli_lck_type type,
99 TALLOC_CTX *mem_ctx, struct netlogon_creds_cli_lck **lck);
101 struct tevent_req *netlogon_creds_cli_auth_send(TALLOC_CTX *mem_ctx,
102 struct tevent_context *ev,
103 struct netlogon_creds_cli_context *context,
104 struct dcerpc_binding_handle *b,
105 uint8_t num_nt_hashes,
106 const struct samr_Password * const *nt_hashes);
107 NTSTATUS netlogon_creds_cli_auth_recv(struct tevent_req *req,
108 uint8_t *idx_nt_hashes);
109 NTSTATUS netlogon_creds_cli_auth(struct netlogon_creds_cli_context *context,
110 struct dcerpc_binding_handle *b,
111 uint8_t num_nt_hashes,
112 const struct samr_Password * const *nt_hashes,
113 uint8_t *idx_nt_hashes);
115 struct tevent_req *netlogon_creds_cli_check_send(TALLOC_CTX *mem_ctx,
116 struct tevent_context *ev,
117 struct netlogon_creds_cli_context *context,
118 struct dcerpc_binding_handle *b);
119 NTSTATUS netlogon_creds_cli_check_recv(struct tevent_req *req,
120 union netr_Capabilities *capabilities);
121 NTSTATUS netlogon_creds_cli_check(struct netlogon_creds_cli_context *context,
122 struct dcerpc_binding_handle *b,
123 union netr_Capabilities *capabilities);
125 struct tevent_req *netlogon_creds_cli_ServerPasswordSet_send(TALLOC_CTX *mem_ctx,
126 struct tevent_context *ev,
127 struct netlogon_creds_cli_context *context,
128 struct dcerpc_binding_handle *b,
129 const DATA_BLOB *new_password,
130 const uint32_t *new_version);
131 NTSTATUS netlogon_creds_cli_ServerPasswordSet_recv(struct tevent_req *req);
132 NTSTATUS netlogon_creds_cli_ServerPasswordSet(
133 struct netlogon_creds_cli_context *context,
134 struct dcerpc_binding_handle *b,
135 const DATA_BLOB *new_password,
136 const uint32_t *new_version);
138 struct tevent_req *netlogon_creds_cli_LogonSamLogon_send(TALLOC_CTX *mem_ctx,
139 struct tevent_context *ev,
140 struct netlogon_creds_cli_context *context,
141 struct dcerpc_binding_handle *b,
142 enum netr_LogonInfoClass logon_level,
143 const union netr_LogonLevel *logon,
144 uint32_t flags);
145 NTSTATUS netlogon_creds_cli_LogonSamLogon_recv(struct tevent_req *req,
146 TALLOC_CTX *mem_ctx,
147 uint16_t *validation_level,
148 union netr_Validation **validation,
149 uint8_t *authoritative,
150 uint32_t *flags);
151 NTSTATUS netlogon_creds_cli_LogonSamLogon(
152 struct netlogon_creds_cli_context *context,
153 struct dcerpc_binding_handle *b,
154 enum netr_LogonInfoClass logon_level,
155 const union netr_LogonLevel *logon,
156 TALLOC_CTX *mem_ctx,
157 uint16_t *validation_level,
158 union netr_Validation **validation,
159 uint8_t *authoritative,
160 uint32_t *flags);
161 struct tevent_req *netlogon_creds_cli_DsrUpdateReadOnlyServerDnsRecords_send(TALLOC_CTX *mem_ctx,
162 struct tevent_context *ev,
163 struct netlogon_creds_cli_context *context,
164 struct dcerpc_binding_handle *b,
165 const char *site_name,
166 uint32_t dns_ttl,
167 struct NL_DNS_NAME_INFO_ARRAY *dns_names);
168 NTSTATUS netlogon_creds_cli_DsrUpdateReadOnlyServerDnsRecords_recv(struct tevent_req *req);
169 NTSTATUS netlogon_creds_cli_DsrUpdateReadOnlyServerDnsRecords(
170 struct netlogon_creds_cli_context *context,
171 struct dcerpc_binding_handle *b,
172 const char *site_name,
173 uint32_t dns_ttl,
174 struct NL_DNS_NAME_INFO_ARRAY *dns_names);
176 struct tevent_req *netlogon_creds_cli_ServerGetTrustInfo_send(TALLOC_CTX *mem_ctx,
177 struct tevent_context *ev,
178 struct netlogon_creds_cli_context *context,
179 struct dcerpc_binding_handle *b);
180 NTSTATUS netlogon_creds_cli_ServerGetTrustInfo_recv(struct tevent_req *req,
181 TALLOC_CTX *mem_ctx,
182 struct samr_Password *new_owf_password,
183 struct samr_Password *old_owf_password,
184 struct netr_TrustInfo **trust_info);
185 NTSTATUS netlogon_creds_cli_ServerGetTrustInfo(
186 struct netlogon_creds_cli_context *context,
187 struct dcerpc_binding_handle *b,
188 TALLOC_CTX *mem_ctx,
189 struct samr_Password *new_owf_password,
190 struct samr_Password *old_owf_password,
191 struct netr_TrustInfo **trust_info);
193 struct tevent_req *netlogon_creds_cli_GetForestTrustInformation_send(TALLOC_CTX *mem_ctx,
194 struct tevent_context *ev,
195 struct netlogon_creds_cli_context *context,
196 struct dcerpc_binding_handle *b);
197 NTSTATUS netlogon_creds_cli_GetForestTrustInformation_recv(struct tevent_req *req,
198 TALLOC_CTX *mem_ctx,
199 struct lsa_ForestTrustInformation **forest_trust_info);
200 NTSTATUS netlogon_creds_cli_GetForestTrustInformation(
201 struct netlogon_creds_cli_context *context,
202 struct dcerpc_binding_handle *b,
203 TALLOC_CTX *mem_ctx,
204 struct lsa_ForestTrustInformation **forest_trust_info);
206 struct tevent_req *netlogon_creds_cli_SendToSam_send(TALLOC_CTX *mem_ctx,
207 struct tevent_context *ev,
208 struct netlogon_creds_cli_context *context,
209 struct dcerpc_binding_handle *b,
210 struct netr_SendToSamBase *message);
212 NTSTATUS netlogon_creds_cli_SendToSam(
213 struct netlogon_creds_cli_context *context,
214 struct dcerpc_binding_handle *b,
215 struct netr_SendToSamBase *message);
217 #endif /* NETLOGON_CREDS_CLI_H */