cracknames: Fix DoS (NULL pointer de-ref) when not servicePrincipalName is set on...
[Samba.git] / libcli / smb / smbXcli_base.h
blob20ef26e3353a1046be6036e08dca499653d6904a
1 /*
2 Unix SMB/CIFS implementation.
3 Infrastructure for async SMB client requests
4 Copyright (C) Volker Lendecke 2008
5 Copyright (C) Stefan Metzmacher 2011
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 _SMBXCLI_BASE_H_
22 #define _SMBXCLI_BASE_H_
24 struct smbXcli_conn;
25 struct smbXcli_session;
26 struct smbXcli_tcon;
27 struct smb_trans_enc_state;
28 struct GUID;
29 struct iovec;
30 struct smb2_create_blobs;
31 struct smb_create_returns;
33 struct smbXcli_conn *smbXcli_conn_create(TALLOC_CTX *mem_ctx,
34 int fd,
35 const char *remote_name,
36 enum smb_signing_setting signing_state,
37 uint32_t smb1_capabilities,
38 struct GUID *client_guid,
39 uint32_t smb2_capabilities);
41 bool smbXcli_conn_is_connected(struct smbXcli_conn *conn);
42 void smbXcli_conn_disconnect(struct smbXcli_conn *conn, NTSTATUS status);
44 bool smbXcli_conn_has_async_calls(struct smbXcli_conn *conn);
46 bool smbXcli_conn_dfs_supported(struct smbXcli_conn *conn);
48 enum protocol_types smbXcli_conn_protocol(struct smbXcli_conn *conn);
49 bool smbXcli_conn_use_unicode(struct smbXcli_conn *conn);
50 bool smbXcli_conn_signing_mandatory(struct smbXcli_conn *conn);
51 bool smbXcli_conn_support_passthrough(struct smbXcli_conn *conn);
53 void smbXcli_conn_set_sockopt(struct smbXcli_conn *conn, const char *options);
54 const struct sockaddr_storage *smbXcli_conn_local_sockaddr(struct smbXcli_conn *conn);
55 const struct sockaddr_storage *smbXcli_conn_remote_sockaddr(struct smbXcli_conn *conn);
56 const char *smbXcli_conn_remote_name(struct smbXcli_conn *conn);
58 uint16_t smbXcli_conn_max_requests(struct smbXcli_conn *conn);
59 NTTIME smbXcli_conn_server_system_time(struct smbXcli_conn *conn);
60 const DATA_BLOB *smbXcli_conn_server_gss_blob(struct smbXcli_conn *conn);
61 const struct GUID *smbXcli_conn_server_guid(struct smbXcli_conn *conn);
62 bool smbXcli_conn_get_force_channel_sequence(struct smbXcli_conn *conn);
63 void smbXcli_conn_set_force_channel_sequence(struct smbXcli_conn *conn,
64 bool v);
67 struct tevent_req *smbXcli_conn_samba_suicide_send(TALLOC_CTX *mem_ctx,
68 struct tevent_context *ev,
69 struct smbXcli_conn *conn,
70 uint8_t exitcode);
71 NTSTATUS smbXcli_conn_samba_suicide_recv(struct tevent_req *req);
72 NTSTATUS smbXcli_conn_samba_suicide(struct smbXcli_conn *conn,
73 uint8_t exitcode);
75 void smbXcli_req_unset_pending(struct tevent_req *req);
76 bool smbXcli_req_set_pending(struct tevent_req *req);
78 uint32_t smb1cli_conn_capabilities(struct smbXcli_conn *conn);
79 uint32_t smb1cli_conn_max_xmit(struct smbXcli_conn *conn);
80 bool smb1cli_conn_req_possible(struct smbXcli_conn *conn);
81 uint32_t smb1cli_conn_server_session_key(struct smbXcli_conn *conn);
82 const uint8_t *smb1cli_conn_server_challenge(struct smbXcli_conn *conn);
83 uint16_t smb1cli_conn_server_security_mode(struct smbXcli_conn *conn);
84 bool smb1cli_conn_server_readbraw(struct smbXcli_conn *conn);
85 bool smb1cli_conn_server_writebraw(struct smbXcli_conn *conn);
86 bool smb1cli_conn_server_lockread(struct smbXcli_conn *conn);
87 bool smb1cli_conn_server_writeunlock(struct smbXcli_conn *conn);
88 int smb1cli_conn_server_time_zone(struct smbXcli_conn *conn);
90 bool smb1cli_conn_activate_signing(struct smbXcli_conn *conn,
91 const DATA_BLOB user_session_key,
92 const DATA_BLOB response);
93 bool smb1cli_conn_check_signing(struct smbXcli_conn *conn,
94 const uint8_t *buf, uint32_t seqnum);
95 bool smb1cli_conn_signing_is_active(struct smbXcli_conn *conn);
97 void smb1cli_conn_set_encryption(struct smbXcli_conn *conn,
98 struct smb_trans_enc_state *es);
99 bool smb1cli_conn_encryption_on(struct smbXcli_conn *conn);
101 bool smb1cli_is_andx_req(uint8_t cmd);
102 size_t smb1cli_req_wct_ofs(struct tevent_req **reqs, int num_reqs);
104 uint16_t smb1cli_req_mid(struct tevent_req *req);
105 void smb1cli_req_set_mid(struct tevent_req *req, uint16_t mid);
107 uint32_t smb1cli_req_seqnum(struct tevent_req *req);
108 void smb1cli_req_set_seqnum(struct tevent_req *req, uint32_t seqnum);
110 struct smb1cli_req_expected_response {
111 NTSTATUS status;
112 uint8_t wct;
115 struct tevent_req *smb1cli_req_create(TALLOC_CTX *mem_ctx,
116 struct tevent_context *ev,
117 struct smbXcli_conn *conn,
118 uint8_t smb_command,
119 uint8_t additional_flags,
120 uint8_t clear_flags,
121 uint16_t additional_flags2,
122 uint16_t clear_flags2,
123 uint32_t timeout_msec,
124 uint32_t pid,
125 struct smbXcli_tcon *tcon,
126 struct smbXcli_session *session,
127 uint8_t wct, uint16_t *vwv,
128 int iov_count,
129 struct iovec *bytes_iov);
130 NTSTATUS smb1cli_req_chain_submit(struct tevent_req **reqs, int num_reqs);
132 struct tevent_req *smb1cli_req_send(TALLOC_CTX *mem_ctx,
133 struct tevent_context *ev,
134 struct smbXcli_conn *conn,
135 uint8_t smb_command,
136 uint8_t additional_flags,
137 uint8_t clear_flags,
138 uint16_t additional_flags2,
139 uint16_t clear_flags2,
140 uint32_t timeout_msec,
141 uint32_t pid,
142 struct smbXcli_tcon *tcon,
143 struct smbXcli_session *session,
144 uint8_t wct, uint16_t *vwv,
145 uint32_t num_bytes,
146 const uint8_t *bytes);
147 NTSTATUS smb1cli_req_recv(struct tevent_req *req,
148 TALLOC_CTX *mem_ctx,
149 struct iovec **piov,
150 uint8_t **phdr,
151 uint8_t *pwct,
152 uint16_t **pvwv,
153 uint32_t *pvwv_offset,
154 uint32_t *pnum_bytes,
155 uint8_t **pbytes,
156 uint32_t *pbytes_offset,
157 uint8_t **pinbuf,
158 const struct smb1cli_req_expected_response *expected,
159 size_t num_expected);
161 struct tevent_req *smb1cli_trans_send(
162 TALLOC_CTX *mem_ctx, struct tevent_context *ev,
163 struct smbXcli_conn *conn, uint8_t cmd,
164 uint8_t additional_flags, uint8_t clear_flags,
165 uint16_t additional_flags2, uint16_t clear_flags2,
166 uint32_t timeout_msec,
167 uint32_t pid,
168 struct smbXcli_tcon *tcon,
169 struct smbXcli_session *session,
170 const char *pipe_name, uint16_t fid, uint16_t function, int flags,
171 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
172 uint8_t *param, uint32_t num_param, uint32_t max_param,
173 uint8_t *data, uint32_t num_data, uint32_t max_data);
174 NTSTATUS smb1cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
175 uint16_t *recv_flags2,
176 uint16_t **setup, uint8_t min_setup,
177 uint8_t *num_setup,
178 uint8_t **param, uint32_t min_param,
179 uint32_t *num_param,
180 uint8_t **data, uint32_t min_data,
181 uint32_t *num_data);
182 NTSTATUS smb1cli_trans(TALLOC_CTX *mem_ctx, struct smbXcli_conn *conn,
183 uint8_t trans_cmd,
184 uint8_t additional_flags, uint8_t clear_flags,
185 uint16_t additional_flags2, uint16_t clear_flags2,
186 uint32_t timeout_msec,
187 uint32_t pid,
188 struct smbXcli_tcon *tcon,
189 struct smbXcli_session *session,
190 const char *pipe_name, uint16_t fid, uint16_t function,
191 int flags,
192 uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
193 uint8_t *param, uint32_t num_param, uint32_t max_param,
194 uint8_t *data, uint32_t num_data, uint32_t max_data,
195 uint16_t *recv_flags2,
196 uint16_t **rsetup, uint8_t min_rsetup, uint8_t *num_rsetup,
197 uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam,
198 uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata);
200 struct tevent_req *smb1cli_echo_send(TALLOC_CTX *mem_ctx,
201 struct tevent_context *ev,
202 struct smbXcli_conn *conn,
203 uint32_t timeout_msec,
204 uint16_t num_echos,
205 DATA_BLOB data);
206 NTSTATUS smb1cli_echo_recv(struct tevent_req *req);
207 NTSTATUS smb1cli_echo(struct smbXcli_conn *conn, uint32_t timeout_msec,
208 uint16_t num_echos, DATA_BLOB data);
210 struct tevent_req *smb1cli_session_setup_lm21_send(TALLOC_CTX *mem_ctx,
211 struct tevent_context *ev,
212 struct smbXcli_conn *conn,
213 uint32_t timeout_msec,
214 uint32_t pid,
215 struct smbXcli_session *session,
216 uint16_t in_buf_size,
217 uint16_t in_mpx_max,
218 uint16_t in_vc_num,
219 uint32_t in_sess_key,
220 const char *in_user,
221 const char *in_domain,
222 const DATA_BLOB in_password,
223 const char *in_native_os,
224 const char *in_native_lm);
225 NTSTATUS smb1cli_session_setup_lm21_recv(struct tevent_req *req,
226 TALLOC_CTX *mem_ctx,
227 char **out_native_os,
228 char **out_native_lm);
229 struct tevent_req *smb1cli_session_setup_nt1_send(TALLOC_CTX *mem_ctx,
230 struct tevent_context *ev,
231 struct smbXcli_conn *conn,
232 uint32_t timeout_msec,
233 uint32_t pid,
234 struct smbXcli_session *session,
235 uint16_t in_buf_size,
236 uint16_t in_mpx_max,
237 uint16_t in_vc_num,
238 uint32_t in_sess_key,
239 const char *in_user,
240 const char *in_domain,
241 const DATA_BLOB in_apassword,
242 const DATA_BLOB in_upassword,
243 uint32_t in_capabilities,
244 const char *in_native_os,
245 const char *in_native_lm);
246 NTSTATUS smb1cli_session_setup_nt1_recv(struct tevent_req *req,
247 TALLOC_CTX *mem_ctx,
248 struct iovec **precv_iov,
249 const uint8_t **precv_inbuf,
250 char **out_native_os,
251 char **out_native_lm,
252 char **out_primary_domain);
253 struct tevent_req *smb1cli_session_setup_ext_send(TALLOC_CTX *mem_ctx,
254 struct tevent_context *ev,
255 struct smbXcli_conn *conn,
256 uint32_t timeout_msec,
257 uint32_t pid,
258 struct smbXcli_session *session,
259 uint16_t in_buf_size,
260 uint16_t in_mpx_max,
261 uint16_t in_vc_num,
262 uint32_t in_sess_key,
263 const DATA_BLOB in_security_blob,
264 uint32_t in_capabilities,
265 const char *in_native_os,
266 const char *in_native_lm);
267 NTSTATUS smb1cli_session_setup_ext_recv(struct tevent_req *req,
268 TALLOC_CTX *mem_ctx,
269 struct iovec **precv_iov,
270 const uint8_t **precv_inbuf,
271 DATA_BLOB *out_security_blob,
272 char **out_native_os,
273 char **out_native_lm);
275 struct tevent_req *smb1cli_ntcreatex_send(TALLOC_CTX *mem_ctx,
276 struct tevent_context *ev,
277 struct smbXcli_conn *conn,
278 uint32_t timeout_msec,
279 uint32_t pid,
280 struct smbXcli_tcon *tcon,
281 struct smbXcli_session *session,
282 const char *fname,
283 uint32_t CreatFlags,
284 uint32_t RootDirectoryFid,
285 uint32_t DesiredAccess,
286 uint64_t AllocationSize,
287 uint32_t FileAttributes,
288 uint32_t ShareAccess,
289 uint32_t CreateDisposition,
290 uint32_t CreateOptions,
291 uint32_t ImpersonationLevel,
292 uint8_t SecurityFlags);
293 NTSTATUS smb1cli_ntcreatex_recv(struct tevent_req *req, uint16_t *pfnum);
294 NTSTATUS smb1cli_ntcreatex(struct smbXcli_conn *conn,
295 uint32_t timeout_msec,
296 uint32_t pid,
297 struct smbXcli_tcon *tcon,
298 struct smbXcli_session *session,
299 const char *fname,
300 uint32_t CreatFlags,
301 uint32_t RootDirectoryFid,
302 uint32_t DesiredAccess,
303 uint64_t AllocationSize,
304 uint32_t FileAttributes,
305 uint32_t ShareAccess,
306 uint32_t CreateDisposition,
307 uint32_t CreateOptions,
308 uint32_t ImpersonationLevel,
309 uint8_t SecurityFlags,
310 uint16_t *pfnum);
311 struct tevent_req *smb1cli_close_send(TALLOC_CTX *mem_ctx,
312 struct tevent_context *ev,
313 struct smbXcli_conn *conn,
314 uint32_t timeout_msec,
315 uint32_t pid,
316 struct smbXcli_tcon *tcon,
317 struct smbXcli_session *session,
318 uint16_t fnum,
319 uint32_t last_modified);
320 NTSTATUS smb1cli_close_recv(struct tevent_req *req);
321 NTSTATUS smb1cli_close(struct smbXcli_conn *conn,
322 uint32_t timeout_msec,
323 uint32_t pid,
324 struct smbXcli_tcon *tcon,
325 struct smbXcli_session *session,
326 uint16_t fnum,
327 uint32_t last_modified);
328 struct tevent_req *smb1cli_writex_send(TALLOC_CTX *mem_ctx,
329 struct tevent_context *ev,
330 struct smbXcli_conn *conn,
331 uint32_t timeout_msec,
332 uint32_t pid,
333 struct smbXcli_tcon *tcon,
334 struct smbXcli_session *session,
335 uint16_t fnum,
336 uint16_t mode,
337 const uint8_t *buf,
338 uint64_t offset,
339 uint32_t size);
340 NTSTATUS smb1cli_writex_recv(struct tevent_req *req,
341 uint32_t *pwritten,
342 uint16_t *pavailable);
343 NTSTATUS smb1cli_writex(struct smbXcli_conn *conn,
344 uint32_t timeout_msec,
345 uint32_t pid,
346 struct smbXcli_tcon *tcon,
347 struct smbXcli_session *session,
348 uint16_t fnum,
349 uint16_t mode,
350 const uint8_t *buf,
351 uint64_t offset,
352 uint32_t size,
353 uint32_t *pwritten,
354 uint16_t *pavailable);
355 struct tevent_req *smb1cli_readx_send(TALLOC_CTX *mem_ctx,
356 struct tevent_context *ev,
357 struct smbXcli_conn *conn,
358 uint32_t timeout_msec,
359 uint32_t pid,
360 struct smbXcli_tcon *tcon,
361 struct smbXcli_session *session,
362 uint16_t fnum,
363 uint64_t offset,
364 uint32_t size);
365 NTSTATUS smb1cli_readx_recv(struct tevent_req *req,
366 uint32_t *received,
367 uint8_t **rcvbuf);
369 bool smb2cli_conn_req_possible(struct smbXcli_conn *conn, uint32_t *max_dyn_len);
370 uint32_t smb2cli_conn_server_capabilities(struct smbXcli_conn *conn);
371 uint16_t smb2cli_conn_server_security_mode(struct smbXcli_conn *conn);
372 uint32_t smb2cli_conn_max_trans_size(struct smbXcli_conn *conn);
373 uint32_t smb2cli_conn_max_read_size(struct smbXcli_conn *conn);
374 uint32_t smb2cli_conn_max_write_size(struct smbXcli_conn *conn);
375 void smb2cli_conn_set_max_credits(struct smbXcli_conn *conn,
376 uint16_t max_credits);
377 uint16_t smb2cli_conn_get_cur_credits(struct smbXcli_conn *conn);
378 uint8_t smb2cli_conn_get_io_priority(struct smbXcli_conn *conn);
379 void smb2cli_conn_set_io_priority(struct smbXcli_conn *conn,
380 uint8_t io_priority);
381 uint32_t smb2cli_conn_cc_chunk_len(struct smbXcli_conn *conn);
382 void smb2cli_conn_set_cc_chunk_len(struct smbXcli_conn *conn,
383 uint32_t chunk_len);
384 uint32_t smb2cli_conn_cc_max_chunks(struct smbXcli_conn *conn);
385 void smb2cli_conn_set_cc_max_chunks(struct smbXcli_conn *conn,
386 uint32_t max_chunks);
387 void smb2cli_conn_set_mid(struct smbXcli_conn *conn, uint64_t mid);
388 uint64_t smb2cli_conn_get_mid(struct smbXcli_conn *conn);
390 struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx,
391 struct tevent_context *ev,
392 struct smbXcli_conn *conn,
393 uint16_t cmd,
394 uint32_t additional_flags,
395 uint32_t clear_flags,
396 uint32_t timeout_msec,
397 struct smbXcli_tcon *tcon,
398 struct smbXcli_session *session,
399 const uint8_t *fixed,
400 uint16_t fixed_len,
401 const uint8_t *dyn,
402 uint32_t dyn_len,
403 uint32_t max_dyn_len);
404 void smb2cli_req_set_notify_async(struct tevent_req *req);
405 NTSTATUS smb2cli_req_compound_submit(struct tevent_req **reqs,
406 int num_reqs);
407 void smb2cli_req_set_credit_charge(struct tevent_req *req, uint16_t charge);
409 struct smb2cli_req_expected_response {
410 NTSTATUS status;
411 uint16_t body_size;
414 struct tevent_req *smb2cli_req_send(TALLOC_CTX *mem_ctx,
415 struct tevent_context *ev,
416 struct smbXcli_conn *conn,
417 uint16_t cmd,
418 uint32_t additional_flags,
419 uint32_t clear_flags,
420 uint32_t timeout_msec,
421 struct smbXcli_tcon *tcon,
422 struct smbXcli_session *session,
423 const uint8_t *fixed,
424 uint16_t fixed_len,
425 const uint8_t *dyn,
426 uint32_t dyn_len,
427 uint32_t max_dyn_len);
428 NTSTATUS smb2cli_req_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
429 struct iovec **piov,
430 const struct smb2cli_req_expected_response *expected,
431 size_t num_expected);
434 * This expects an iov[3] array, that is filled with references to
435 * the buffers used for the sending the requests into the socket.
437 * This can only be called after smb2cli_req_recv(subreq) before
438 * the TALLOC_FREE(subreq).
440 NTSTATUS smb2cli_req_get_sent_iov(struct tevent_req *req,
441 struct iovec *sent_iov);
443 struct tevent_req *smbXcli_negprot_send(TALLOC_CTX *mem_ctx,
444 struct tevent_context *ev,
445 struct smbXcli_conn *conn,
446 uint32_t timeout_msec,
447 enum protocol_types min_protocol,
448 enum protocol_types max_protocol,
449 uint16_t max_credits);
450 NTSTATUS smbXcli_negprot_recv(struct tevent_req *req);
451 NTSTATUS smbXcli_negprot(struct smbXcli_conn *conn,
452 uint32_t timeout_msec,
453 enum protocol_types min_protocol,
454 enum protocol_types max_protocol);
456 struct tevent_req *smb2cli_validate_negotiate_info_send(TALLOC_CTX *mem_ctx,
457 struct tevent_context *ev,
458 struct smbXcli_conn *conn,
459 uint32_t timeout_msec,
460 struct smbXcli_session *session,
461 struct smbXcli_tcon *tcon);
462 NTSTATUS smb2cli_validate_negotiate_info_recv(struct tevent_req *req);
464 struct smbXcli_session *smbXcli_session_create(TALLOC_CTX *mem_ctx,
465 struct smbXcli_conn *conn);
466 struct smbXcli_session *smbXcli_session_copy(TALLOC_CTX *mem_ctx,
467 struct smbXcli_session *src);
468 bool smbXcli_session_is_guest(struct smbXcli_session *session);
469 bool smbXcli_session_is_authenticated(struct smbXcli_session *session);
470 NTSTATUS smbXcli_session_application_key(struct smbXcli_session *session,
471 TALLOC_CTX *mem_ctx,
472 DATA_BLOB *key);
473 void smbXcli_session_set_disconnect_expired(struct smbXcli_session *session);
474 uint16_t smb1cli_session_current_id(struct smbXcli_session* session);
475 void smb1cli_session_set_id(struct smbXcli_session* session,
476 uint16_t session_id);
477 void smb1cli_session_set_action(struct smbXcli_session *session,
478 uint16_t action);
479 NTSTATUS smb1cli_session_set_session_key(struct smbXcli_session *session,
480 const DATA_BLOB _session_key);
481 NTSTATUS smb1cli_session_protect_session_key(struct smbXcli_session *session);
482 uint8_t smb2cli_session_security_mode(struct smbXcli_session *session);
483 uint64_t smb2cli_session_current_id(struct smbXcli_session *session);
484 uint16_t smb2cli_session_get_flags(struct smbXcli_session *session);
485 void smb2cli_session_set_id_and_flags(struct smbXcli_session *session,
486 uint64_t session_id,
487 uint16_t session_flags);
488 void smb2cli_session_increment_channel_sequence(struct smbXcli_session *session);
489 uint16_t smb2cli_session_reset_channel_sequence(struct smbXcli_session *session,
490 uint16_t channel_sequence);
491 uint16_t smb2cli_session_current_channel_sequence(struct smbXcli_session *session);
492 void smb2cli_session_start_replay(struct smbXcli_session *session);
493 void smb2cli_session_stop_replay(struct smbXcli_session *session);
494 NTSTATUS smb2cli_session_update_preauth(struct smbXcli_session *session,
495 const struct iovec *iov);
496 NTSTATUS smb2cli_session_set_session_key(struct smbXcli_session *session,
497 const DATA_BLOB session_key,
498 const struct iovec *recv_iov);
499 NTSTATUS smb2cli_session_create_channel(TALLOC_CTX *mem_ctx,
500 struct smbXcli_session *session1,
501 struct smbXcli_conn *conn,
502 struct smbXcli_session **_session2);
503 NTSTATUS smb2cli_session_set_channel_key(struct smbXcli_session *session,
504 const DATA_BLOB channel_key,
505 const struct iovec *recv_iov);
506 NTSTATUS smb2cli_session_encryption_on(struct smbXcli_session *session);
508 struct smbXcli_tcon *smbXcli_tcon_create(TALLOC_CTX *mem_ctx);
509 struct smbXcli_tcon *smbXcli_tcon_copy(TALLOC_CTX *mem_ctx,
510 const struct smbXcli_tcon *tcon_in);
511 void smbXcli_tcon_set_fs_attributes(struct smbXcli_tcon *tcon,
512 uint32_t fs_attributes);
513 uint32_t smbXcli_tcon_get_fs_attributes(struct smbXcli_tcon *tcon);
514 bool smbXcli_tcon_is_dfs_share(struct smbXcli_tcon *tcon);
515 uint16_t smb1cli_tcon_current_id(struct smbXcli_tcon *tcon);
516 void smb1cli_tcon_set_id(struct smbXcli_tcon *tcon, uint16_t tcon_id);
517 bool smb1cli_tcon_set_values(struct smbXcli_tcon *tcon,
518 uint16_t tcon_id,
519 uint16_t optional_support,
520 uint32_t maximal_access,
521 uint32_t guest_maximal_access,
522 const char *service,
523 const char *fs_type);
524 uint32_t smb2cli_tcon_current_id(struct smbXcli_tcon *tcon);
525 void smb2cli_tcon_set_id(struct smbXcli_tcon *tcon, uint32_t tcon_id);
526 uint32_t smb2cli_tcon_capabilities(struct smbXcli_tcon *tcon);
527 uint32_t smb2cli_tcon_flags(struct smbXcli_tcon *tcon);
528 void smb2cli_tcon_set_values(struct smbXcli_tcon *tcon,
529 struct smbXcli_session *session,
530 uint32_t tcon_id,
531 uint8_t type,
532 uint32_t flags,
533 uint32_t capabilities,
534 uint32_t maximal_access);
535 void smb2cli_tcon_should_sign(struct smbXcli_tcon *tcon,
536 bool should_sign);
537 bool smb2cli_tcon_is_signing_on(struct smbXcli_tcon *tcon);
538 void smb2cli_tcon_should_encrypt(struct smbXcli_tcon *tcon,
539 bool should_encrypt);
540 bool smb2cli_tcon_is_encryption_on(struct smbXcli_tcon *tcon);
542 struct tevent_req *smb2cli_session_setup_send(TALLOC_CTX *mem_ctx,
543 struct tevent_context *ev,
544 struct smbXcli_conn *conn,
545 uint32_t timeout_msec,
546 struct smbXcli_session *session,
547 uint8_t in_flags,
548 uint32_t in_capabilities,
549 uint32_t in_channel,
550 uint64_t in_previous_session_id,
551 const DATA_BLOB *in_security_buffer);
552 NTSTATUS smb2cli_session_setup_recv(struct tevent_req *req,
553 TALLOC_CTX *mem_ctx,
554 struct iovec **recv_iov,
555 DATA_BLOB *out_security_buffer);
557 struct tevent_req *smb2cli_logoff_send(TALLOC_CTX *mem_ctx,
558 struct tevent_context *ev,
559 struct smbXcli_conn *conn,
560 uint32_t timeout_msec,
561 struct smbXcli_session *session);
562 NTSTATUS smb2cli_logoff_recv(struct tevent_req *req);
563 NTSTATUS smb2cli_logoff(struct smbXcli_conn *conn,
564 uint32_t timeout_msec,
565 struct smbXcli_session *session);
567 struct tevent_req *smb2cli_tcon_send(TALLOC_CTX *mem_ctx,
568 struct tevent_context *ev,
569 struct smbXcli_conn *conn,
570 uint32_t timeout_msec,
571 struct smbXcli_session *session,
572 struct smbXcli_tcon *tcon,
573 uint16_t flags,
574 const char *unc);
575 NTSTATUS smb2cli_tcon_recv(struct tevent_req *req);
576 NTSTATUS smb2cli_tcon(struct smbXcli_conn *conn,
577 uint32_t timeout_msec,
578 struct smbXcli_session *session,
579 struct smbXcli_tcon *tcon,
580 uint16_t flags,
581 const char *unc);
583 struct tevent_req *smb2cli_tdis_send(TALLOC_CTX *mem_ctx,
584 struct tevent_context *ev,
585 struct smbXcli_conn *conn,
586 uint32_t timeout_msec,
587 struct smbXcli_session *session,
588 struct smbXcli_tcon *tcon);
589 NTSTATUS smb2cli_tdis_recv(struct tevent_req *req);
590 NTSTATUS smb2cli_tdis(struct smbXcli_conn *conn,
591 uint32_t timeout_msec,
592 struct smbXcli_session *session,
593 struct smbXcli_tcon *tcon);
595 struct tevent_req *smb2cli_create_send(
596 TALLOC_CTX *mem_ctx,
597 struct tevent_context *ev,
598 struct smbXcli_conn *conn,
599 uint32_t timeout_msec,
600 struct smbXcli_session *session,
601 struct smbXcli_tcon *tcon,
602 const char *filename,
603 uint8_t oplock_level, /* SMB2_OPLOCK_LEVEL_* */
604 uint32_t impersonation_level, /* SMB2_IMPERSONATION_* */
605 uint32_t desired_access,
606 uint32_t file_attributes,
607 uint32_t share_access,
608 uint32_t create_disposition,
609 uint32_t create_options,
610 struct smb2_create_blobs *blobs);
611 NTSTATUS smb2cli_create_recv(struct tevent_req *req,
612 uint64_t *fid_persistent,
613 uint64_t *fid_volatile,
614 struct smb_create_returns *cr,
615 TALLOC_CTX *mem_ctx,
616 struct smb2_create_blobs *blobs);
617 NTSTATUS smb2cli_create(struct smbXcli_conn *conn,
618 uint32_t timeout_msec,
619 struct smbXcli_session *session,
620 struct smbXcli_tcon *tcon,
621 const char *filename,
622 uint8_t oplock_level, /* SMB2_OPLOCK_LEVEL_* */
623 uint32_t impersonation_level, /* SMB2_IMPERSONATION_* */
624 uint32_t desired_access,
625 uint32_t file_attributes,
626 uint32_t share_access,
627 uint32_t create_disposition,
628 uint32_t create_options,
629 struct smb2_create_blobs *blobs,
630 uint64_t *fid_persistent,
631 uint64_t *fid_volatile,
632 struct smb_create_returns *cr,
633 TALLOC_CTX *mem_ctx,
634 struct smb2_create_blobs *ret_blobs);
636 struct tevent_req *smb2cli_close_send(TALLOC_CTX *mem_ctx,
637 struct tevent_context *ev,
638 struct smbXcli_conn *conn,
639 uint32_t timeout_msec,
640 struct smbXcli_session *session,
641 struct smbXcli_tcon *tcon,
642 uint16_t flags,
643 uint64_t fid_persistent,
644 uint64_t fid_volatile);
645 NTSTATUS smb2cli_close_recv(struct tevent_req *req);
646 NTSTATUS smb2cli_close(struct smbXcli_conn *conn,
647 uint32_t timeout_msec,
648 struct smbXcli_session *session,
649 struct smbXcli_tcon *tcon,
650 uint16_t flags,
651 uint64_t fid_persistent,
652 uint64_t fid_volatile);
654 struct tevent_req *smb2cli_read_send(TALLOC_CTX *mem_ctx,
655 struct tevent_context *ev,
656 struct smbXcli_conn *conn,
657 uint32_t timeout_msec,
658 struct smbXcli_session *session,
659 struct smbXcli_tcon *tcon,
660 uint32_t length,
661 uint64_t offset,
662 uint64_t fid_persistent,
663 uint64_t fid_volatile,
664 uint64_t minimum_count,
665 uint64_t remaining_bytes);
666 NTSTATUS smb2cli_read_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
667 uint8_t **data, uint32_t *data_length);
668 NTSTATUS smb2cli_read(struct smbXcli_conn *conn,
669 uint32_t timeout_msec,
670 struct smbXcli_session *session,
671 struct smbXcli_tcon *tcon,
672 uint32_t length,
673 uint64_t offset,
674 uint64_t fid_persistent,
675 uint64_t fid_volatile,
676 uint64_t minimum_count,
677 uint64_t remaining_bytes,
678 TALLOC_CTX *mem_ctx,
679 uint8_t **data,
680 uint32_t *data_length);
682 struct tevent_req *smb2cli_write_send(TALLOC_CTX *mem_ctx,
683 struct tevent_context *ev,
684 struct smbXcli_conn *conn,
685 uint32_t timeout_msec,
686 struct smbXcli_session *session,
687 struct smbXcli_tcon *tcon,
688 uint32_t length,
689 uint64_t offset,
690 uint64_t fid_persistent,
691 uint64_t fid_volatile,
692 uint32_t remaining_bytes,
693 uint32_t flags,
694 const uint8_t *data);
695 NTSTATUS smb2cli_write_recv(struct tevent_req *req,
696 uint32_t *written);
697 NTSTATUS smb2cli_write(struct smbXcli_conn *conn,
698 uint32_t timeout_msec,
699 struct smbXcli_session *session,
700 struct smbXcli_tcon *tcon,
701 uint32_t length,
702 uint64_t offset,
703 uint64_t fid_persistent,
704 uint64_t fid_volatile,
705 uint32_t remaining_bytes,
706 uint32_t flags,
707 const uint8_t *data,
708 uint32_t *written);
710 struct tevent_req *smb2cli_flush_send(TALLOC_CTX *mem_ctx,
711 struct tevent_context *ev,
712 struct smbXcli_conn *conn,
713 uint32_t timeout_msec,
714 struct smbXcli_session *session,
715 struct smbXcli_tcon *tcon,
716 uint64_t fid_persistent,
717 uint64_t fid_volatile);
718 NTSTATUS smb2cli_flush_recv(struct tevent_req *req);
719 NTSTATUS smb2cli_flush(struct smbXcli_conn *conn,
720 uint32_t timeout_msec,
721 struct smbXcli_session *session,
722 struct smbXcli_tcon *tcon,
723 uint64_t fid_persistent,
724 uint64_t fid_volatile);
726 struct tevent_req *smb2cli_set_info_send(TALLOC_CTX *mem_ctx,
727 struct tevent_context *ev,
728 struct smbXcli_conn *conn,
729 uint32_t timeout_msec,
730 struct smbXcli_session *session,
731 struct smbXcli_tcon *tcon,
732 uint8_t in_info_type,
733 uint8_t in_file_info_class,
734 const DATA_BLOB *in_input_buffer,
735 uint32_t in_additional_info,
736 uint64_t in_fid_persistent,
737 uint64_t in_fid_volatile);
738 NTSTATUS smb2cli_set_info_recv(struct tevent_req *req);
739 NTSTATUS smb2cli_set_info(struct smbXcli_conn *conn,
740 uint32_t timeout_msec,
741 struct smbXcli_session *session,
742 struct smbXcli_tcon *tcon,
743 uint8_t in_info_type,
744 uint8_t in_file_info_class,
745 const DATA_BLOB *in_input_buffer,
746 uint32_t in_additional_info,
747 uint64_t in_fid_persistent,
748 uint64_t in_fid_volatile);
750 struct tevent_req *smb2cli_query_info_send(TALLOC_CTX *mem_ctx,
751 struct tevent_context *ev,
752 struct smbXcli_conn *conn,
753 uint32_t timeout_msec,
754 struct smbXcli_session *session,
755 struct smbXcli_tcon *tcon,
756 uint8_t in_info_type,
757 uint8_t in_file_info_class,
758 uint32_t in_max_output_length,
759 const DATA_BLOB *in_input_buffer,
760 uint32_t in_additional_info,
761 uint32_t in_flags,
762 uint64_t in_fid_persistent,
763 uint64_t in_fid_volatile);
764 NTSTATUS smb2cli_query_info_recv(struct tevent_req *req,
765 TALLOC_CTX *mem_ctx,
766 DATA_BLOB *out_output_buffer);
767 NTSTATUS smb2cli_query_info(struct smbXcli_conn *conn,
768 uint32_t timeout_msec,
769 struct smbXcli_session *session,
770 struct smbXcli_tcon *tcon,
771 uint8_t in_info_type,
772 uint8_t in_file_info_class,
773 uint32_t in_max_output_length,
774 const DATA_BLOB *in_input_buffer,
775 uint32_t in_additional_info,
776 uint32_t in_flags,
777 uint64_t in_fid_persistent,
778 uint64_t in_fid_volatile,
779 TALLOC_CTX *mem_ctx,
780 DATA_BLOB *out_output_buffer);
782 struct tevent_req *smb2cli_query_directory_send(TALLOC_CTX *mem_ctx,
783 struct tevent_context *ev,
784 struct smbXcli_conn *conn,
785 uint32_t timeout_msec,
786 struct smbXcli_session *session,
787 struct smbXcli_tcon *tcon,
788 uint8_t level,
789 uint8_t flags,
790 uint32_t file_index,
791 uint64_t fid_persistent,
792 uint64_t fid_volatile,
793 const char *mask,
794 uint32_t outbuf_len);
795 NTSTATUS smb2cli_query_directory_recv(struct tevent_req *req,
796 TALLOC_CTX *mem_ctx,
797 uint8_t **data,
798 uint32_t *data_length);
799 NTSTATUS smb2cli_query_directory(struct smbXcli_conn *conn,
800 uint32_t timeout_msec,
801 struct smbXcli_session *session,
802 struct smbXcli_tcon *tcon,
803 uint8_t level,
804 uint8_t flags,
805 uint32_t file_index,
806 uint64_t fid_persistent,
807 uint64_t fid_volatile,
808 const char *mask,
809 uint32_t outbuf_len,
810 TALLOC_CTX *mem_ctx,
811 uint8_t **data,
812 uint32_t *data_length);
814 struct tevent_req *smb2cli_notify_send(TALLOC_CTX *mem_ctx,
815 struct tevent_context *ev,
816 struct smbXcli_conn *conn,
817 uint32_t timeout_msec,
818 struct smbXcli_session *session,
819 struct smbXcli_tcon *tcon,
820 uint32_t output_buffer_length,
821 uint64_t fid_persistent,
822 uint64_t fid_volatile,
823 uint32_t completion_filter,
824 bool recursive);
825 NTSTATUS smb2cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
826 uint8_t **data, uint32_t *data_length);
827 NTSTATUS smb2cli_notify(struct smbXcli_conn *conn,
828 uint32_t timeout_msec,
829 struct smbXcli_session *session,
830 struct smbXcli_tcon *tcon,
831 uint32_t output_buffer_length,
832 uint64_t fid_persistent,
833 uint64_t fid_volatile,
834 uint32_t completion_filter,
835 bool recursive,
836 TALLOC_CTX *mem_ctx,
837 uint8_t **data,
838 uint32_t *data_length);
840 struct tevent_req *smb2cli_ioctl_send(TALLOC_CTX *mem_ctx,
841 struct tevent_context *ev,
842 struct smbXcli_conn *conn,
843 uint32_t timeout_msec,
844 struct smbXcli_session *session,
845 struct smbXcli_tcon *tcon,
846 uint64_t in_fid_persistent,
847 uint64_t in_fid_volatile,
848 uint32_t in_ctl_code,
849 uint32_t in_max_input_length,
850 const DATA_BLOB *in_input_buffer,
851 uint32_t in_max_output_length,
852 const DATA_BLOB *in_output_buffer,
853 uint32_t in_flags);
854 NTSTATUS smb2cli_ioctl_recv(struct tevent_req *req,
855 TALLOC_CTX *mem_ctx,
856 DATA_BLOB *out_input_buffer,
857 DATA_BLOB *out_output_buffer);
858 NTSTATUS smb2cli_ioctl(struct smbXcli_conn *conn,
859 uint32_t timeout_msec,
860 struct smbXcli_session *session,
861 struct smbXcli_tcon *tcon,
862 uint64_t in_fid_persistent,
863 uint64_t in_fid_volatile,
864 uint32_t in_ctl_code,
865 uint32_t in_max_input_length,
866 const DATA_BLOB *in_input_buffer,
867 uint32_t in_max_output_length,
868 const DATA_BLOB *in_output_buffer,
869 uint32_t in_flags,
870 TALLOC_CTX *mem_ctx,
871 DATA_BLOB *out_input_buffer,
872 DATA_BLOB *out_output_buffer);
874 struct tevent_req *smb2cli_echo_send(TALLOC_CTX *mem_ctx,
875 struct tevent_context *ev,
876 struct smbXcli_conn *conn,
877 uint32_t timeout_msec);
878 NTSTATUS smb2cli_echo_recv(struct tevent_req *req);
879 NTSTATUS smb2cli_echo(struct smbXcli_conn *conn,
880 uint32_t timeout_msec);
882 #endif /* _SMBXCLI_BASE_H_ */