7c737dd920a5744fe7dddff391b351c0604d4068
[samba.git] / libcli / auth / netlogon_creds_cli.h
1 /*
2    Unix SMB/CIFS implementation.
3
4    module to store/fetch session keys for the schannel client
5
6    Copyright (C) Stefan Metzmacher 2013
7
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.
12
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.
17
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/>.
20 */
21
22 #ifndef NETLOGON_CREDS_CLI_H
23 #define NETLOGON_CREDS_CLI_H
24
25 #include "librpc/gen_ndr/dcerpc.h"
26 #include "librpc/gen_ndr/schannel.h"
27
28 struct netlogon_creds_cli_context;
29 struct messaging_context;
30 struct dcerpc_binding_handle;
31 struct db_context;
32
33 NTSTATUS netlogon_creds_cli_set_global_db(struct db_context **db);
34 NTSTATUS netlogon_creds_cli_open_global_db(struct loadparm_context *lp_ctx);
35
36 NTSTATUS netlogon_creds_cli_context_global(struct loadparm_context *lp_ctx,
37                                 struct messaging_context *msg_ctx,
38                                 const char *client_account,
39                                 enum netr_SchannelType type,
40                                 const char *server_computer,
41                                 const char *server_netbios_domain,
42                                 TALLOC_CTX *mem_ctx,
43                                 struct netlogon_creds_cli_context **_context);
44 NTSTATUS netlogon_creds_cli_context_tmp(const char *client_computer,
45                                 const char *client_account,
46                                 enum netr_SchannelType type,
47                                 uint32_t proposed_flags,
48                                 uint32_t required_flags,
49                                 enum dcerpc_AuthLevel auth_level,
50                                 const char *server_computer,
51                                 const char *server_netbios_domain,
52                                 TALLOC_CTX *mem_ctx,
53                                 struct netlogon_creds_cli_context **_context);
54
55 char *netlogon_creds_cli_debug_string(
56                 const struct netlogon_creds_cli_context *context,
57                 TALLOC_CTX *mem_ctx);
58
59 enum dcerpc_AuthLevel netlogon_creds_cli_auth_level(
60                 struct netlogon_creds_cli_context *context);
61
62 NTSTATUS netlogon_creds_cli_get(struct netlogon_creds_cli_context *context,
63                                 TALLOC_CTX *mem_ctx,
64                                 struct netlogon_creds_CredentialState **_creds);
65 bool netlogon_creds_cli_validate(struct netlogon_creds_cli_context *context,
66                         const struct netlogon_creds_CredentialState *creds1);
67
68 NTSTATUS netlogon_creds_cli_store(struct netlogon_creds_cli_context *context,
69                                   struct netlogon_creds_CredentialState **_creds);
70 NTSTATUS netlogon_creds_cli_delete(struct netlogon_creds_cli_context *context,
71                                    struct netlogon_creds_CredentialState **_creds);
72
73 struct tevent_req *netlogon_creds_cli_lock_send(TALLOC_CTX *mem_ctx,
74                                 struct tevent_context *ev,
75                                 struct netlogon_creds_cli_context *context);
76 NTSTATUS netlogon_creds_cli_lock_recv(struct tevent_req *req,
77                         TALLOC_CTX *mem_ctx,
78                         struct netlogon_creds_CredentialState **creds);
79 NTSTATUS netlogon_creds_cli_lock(struct netlogon_creds_cli_context *context,
80                         TALLOC_CTX *mem_ctx,
81                         struct netlogon_creds_CredentialState **creds);
82
83 struct tevent_req *netlogon_creds_cli_auth_send(TALLOC_CTX *mem_ctx,
84                                 struct tevent_context *ev,
85                                 struct netlogon_creds_cli_context *context,
86                                 struct dcerpc_binding_handle *b,
87                                 struct samr_Password current_nt_hash,
88                                 const struct samr_Password *previous_nt_hash);
89 NTSTATUS netlogon_creds_cli_auth_recv(struct tevent_req *req);
90 NTSTATUS netlogon_creds_cli_auth(struct netlogon_creds_cli_context *context,
91                                  struct dcerpc_binding_handle *b,
92                                  struct samr_Password current_nt_hash,
93                                  const struct samr_Password *previous_nt_hash);
94
95 struct tevent_req *netlogon_creds_cli_check_send(TALLOC_CTX *mem_ctx,
96                                 struct tevent_context *ev,
97                                 struct netlogon_creds_cli_context *context,
98                                 struct dcerpc_binding_handle *b);
99 NTSTATUS netlogon_creds_cli_check_recv(struct tevent_req *req);
100 NTSTATUS netlogon_creds_cli_check(struct netlogon_creds_cli_context *context,
101                                   struct dcerpc_binding_handle *b);
102
103 struct tevent_req *netlogon_creds_cli_ServerPasswordSet_send(TALLOC_CTX *mem_ctx,
104                                 struct tevent_context *ev,
105                                 struct netlogon_creds_cli_context *context,
106                                 struct dcerpc_binding_handle *b,
107                                 const char *new_password,
108                                 const uint32_t *new_version);
109 NTSTATUS netlogon_creds_cli_ServerPasswordSet_recv(struct tevent_req *req);
110 NTSTATUS netlogon_creds_cli_ServerPasswordSet(
111                                 struct netlogon_creds_cli_context *context,
112                                 struct dcerpc_binding_handle *b,
113                                 const char *new_password,
114                                 const uint32_t *new_version);
115
116 struct tevent_req *netlogon_creds_cli_LogonSamLogon_send(TALLOC_CTX *mem_ctx,
117                                 struct tevent_context *ev,
118                                 struct netlogon_creds_cli_context *context,
119                                 struct dcerpc_binding_handle *b,
120                                 enum netr_LogonInfoClass logon_level,
121                                 const union netr_LogonLevel *logon,
122                                 uint32_t flags);
123 NTSTATUS netlogon_creds_cli_LogonSamLogon_recv(struct tevent_req *req,
124                                         TALLOC_CTX *mem_ctx,
125                                         uint16_t *validation_level,
126                                         union netr_Validation **validation,
127                                         uint8_t *authoritative,
128                                         uint32_t *flags);
129 NTSTATUS netlogon_creds_cli_LogonSamLogon(
130                                 struct netlogon_creds_cli_context *context,
131                                 struct dcerpc_binding_handle *b,
132                                 enum netr_LogonInfoClass logon_level,
133                                 const union netr_LogonLevel *logon,
134                                 TALLOC_CTX *mem_ctx,
135                                 uint16_t *validation_level,
136                                 union netr_Validation **validation,
137                                 uint8_t *authoritative,
138                                 uint32_t *flags);
139 struct tevent_req *netlogon_creds_cli_DsrUpdateReadOnlyServerDnsRecords_send(TALLOC_CTX *mem_ctx,
140                                                                              struct tevent_context *ev,
141                                                                              struct netlogon_creds_cli_context *context,
142                                                                              struct dcerpc_binding_handle *b,
143                                                                              const char *site_name,
144                                                                              uint32_t dns_ttl,
145                                                                              struct NL_DNS_NAME_INFO_ARRAY *dns_names);
146 NTSTATUS netlogon_creds_cli_DsrUpdateReadOnlyServerDnsRecords_recv(struct tevent_req *req);
147 NTSTATUS netlogon_creds_cli_DsrUpdateReadOnlyServerDnsRecords(
148                                 struct netlogon_creds_cli_context *context,
149                                 struct dcerpc_binding_handle *b,
150                                 const char *site_name,
151                                 uint32_t dns_ttl,
152                                 struct NL_DNS_NAME_INFO_ARRAY *dns_names);
153
154 struct tevent_req *netlogon_creds_cli_ServerGetTrustInfo_send(TALLOC_CTX *mem_ctx,
155                                         struct tevent_context *ev,
156                                         struct netlogon_creds_cli_context *context,
157                                         struct dcerpc_binding_handle *b);
158 NTSTATUS netlogon_creds_cli_ServerGetTrustInfo_recv(struct tevent_req *req,
159                                         TALLOC_CTX *mem_ctx,
160                                         struct samr_Password *new_owf_password,
161                                         struct samr_Password *old_owf_password,
162                                         struct netr_TrustInfo **trust_info);
163 NTSTATUS netlogon_creds_cli_ServerGetTrustInfo(
164                                 struct netlogon_creds_cli_context *context,
165                                 struct dcerpc_binding_handle *b,
166                                 TALLOC_CTX *mem_ctx,
167                                 struct samr_Password *new_owf_password,
168                                 struct samr_Password *old_owf_password,
169                                 struct netr_TrustInfo **trust_info);
170
171 struct tevent_req *netlogon_creds_cli_GetForestTrustInformation_send(TALLOC_CTX *mem_ctx,
172                                         struct tevent_context *ev,
173                                         struct netlogon_creds_cli_context *context,
174                                         struct dcerpc_binding_handle *b);
175 NTSTATUS netlogon_creds_cli_GetForestTrustInformation_recv(struct tevent_req *req,
176                         TALLOC_CTX *mem_ctx,
177                         struct lsa_ForestTrustInformation **forest_trust_info);
178 NTSTATUS netlogon_creds_cli_GetForestTrustInformation(
179                         struct netlogon_creds_cli_context *context,
180                         struct dcerpc_binding_handle *b,
181                         TALLOC_CTX *mem_ctx,
182                         struct lsa_ForestTrustInformation **forest_trust_info);
183
184 struct tevent_req *netlogon_creds_cli_SendToSam_send(TALLOC_CTX *mem_ctx,
185                                                      struct tevent_context *ev,
186                                                      struct netlogon_creds_cli_context *context,
187                                                      struct dcerpc_binding_handle *b,
188                                                      struct netr_SendToSamBase *message);
189
190 NTSTATUS netlogon_creds_cli_SendToSam(
191                                 struct netlogon_creds_cli_context *context,
192                                 struct dcerpc_binding_handle *b,
193                                 struct netr_SendToSamBase *message);
194
195 #endif /* NETLOGON_CREDS_CLI_H */