2 Unix SMB/CIFS implementation.
5 Copyright (C) Stefan Metzmacher 2009
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/>.
22 #include "smbd/smbd.h"
23 #include "smbd/globals.h"
24 #include "../libcli/smb/smb_common.h"
25 #include "../lib/util/tevent_ntstatus.h"
26 #include "rpc_server/srv_pipe_hnd.h"
27 #include "include/ntioctl.h"
28 #include "../librpc/ndr/libndr.h"
30 static struct tevent_req
*smbd_smb2_ioctl_send(TALLOC_CTX
*mem_ctx
,
31 struct tevent_context
*ev
,
32 struct smbd_smb2_request
*smb2req
,
33 struct files_struct
*in_fsp
,
36 uint32_t in_max_output
,
38 static NTSTATUS
smbd_smb2_ioctl_recv(struct tevent_req
*req
,
40 DATA_BLOB
*out_output
,
43 static void smbd_smb2_request_ioctl_done(struct tevent_req
*subreq
);
44 NTSTATUS
smbd_smb2_request_process_ioctl(struct smbd_smb2_request
*req
)
47 const uint8_t *inbody
;
48 uint32_t min_buffer_offset
;
49 uint32_t max_buffer_offset
;
50 uint32_t min_output_offset
;
51 uint32_t allowed_length_in
;
52 uint32_t allowed_length_out
;
54 uint64_t in_file_id_persistent
;
55 uint64_t in_file_id_volatile
;
56 struct files_struct
*in_fsp
= NULL
;
57 uint32_t in_input_offset
;
58 uint32_t in_input_length
;
59 DATA_BLOB in_input_buffer
= data_blob_null
;
60 uint32_t in_max_input_length
;
61 uint32_t in_output_offset
;
62 uint32_t in_output_length
;
63 DATA_BLOB in_output_buffer
= data_blob_null
;
64 uint32_t in_max_output_length
;
66 uint32_t data_length_in
;
67 uint32_t data_length_out
;
68 uint32_t data_length_tmp
;
69 uint32_t data_length_max
;
70 struct tevent_req
*subreq
;
72 status
= smbd_smb2_request_verify_sizes(req
, 0x39);
73 if (!NT_STATUS_IS_OK(status
)) {
74 return smbd_smb2_request_error(req
, status
);
76 inbody
= SMBD_SMB2_IN_BODY_PTR(req
);
78 in_ctl_code
= IVAL(inbody
, 0x04);
79 in_file_id_persistent
= BVAL(inbody
, 0x08);
80 in_file_id_volatile
= BVAL(inbody
, 0x10);
81 in_input_offset
= IVAL(inbody
, 0x18);
82 in_input_length
= IVAL(inbody
, 0x1C);
83 in_max_input_length
= IVAL(inbody
, 0x20);
84 in_output_offset
= IVAL(inbody
, 0x24);
85 in_output_length
= IVAL(inbody
, 0x28);
86 in_max_output_length
= IVAL(inbody
, 0x2C);
87 in_flags
= IVAL(inbody
, 0x30);
89 min_buffer_offset
= SMB2_HDR_BODY
+ SMBD_SMB2_IN_BODY_LEN(req
);
90 max_buffer_offset
= min_buffer_offset
+ SMBD_SMB2_IN_DYN_LEN(req
);
91 min_output_offset
= min_buffer_offset
;
94 * InputOffset (4 bytes): The offset, in bytes, from the beginning of
95 * the SMB2 header to the input data buffer. If no input data is
96 * required for the FSCTL/IOCTL command being issued, the client SHOULD
97 * set this value to 0.<49>
98 * <49> If no input data is required for the FSCTL/IOCTL command being
99 * issued, Windows-based clients set this field to any value.
101 allowed_length_in
= 0;
102 if ((in_input_offset
> 0) && (in_input_length
> 0)) {
105 if (in_input_offset
< min_buffer_offset
) {
106 return smbd_smb2_request_error(req
,
107 NT_STATUS_INVALID_PARAMETER
);
109 if (in_input_offset
> max_buffer_offset
) {
110 return smbd_smb2_request_error(req
,
111 NT_STATUS_INVALID_PARAMETER
);
113 allowed_length_in
= max_buffer_offset
- in_input_offset
;
115 tmp_ofs
= in_input_offset
- min_buffer_offset
;
116 in_input_buffer
.data
= SMBD_SMB2_IN_DYN_PTR(req
);
117 in_input_buffer
.data
+= tmp_ofs
;
118 in_input_buffer
.length
= in_input_length
;
119 min_output_offset
+= tmp_ofs
;
120 min_output_offset
+= in_input_length
;
123 if (in_input_length
> allowed_length_in
) {
124 return smbd_smb2_request_error(req
, NT_STATUS_INVALID_PARAMETER
);
127 allowed_length_out
= 0;
128 if (in_output_offset
> 0) {
129 if (in_output_offset
< min_buffer_offset
) {
130 return smbd_smb2_request_error(req
,
131 NT_STATUS_INVALID_PARAMETER
);
133 if (in_output_offset
> max_buffer_offset
) {
134 return smbd_smb2_request_error(req
,
135 NT_STATUS_INVALID_PARAMETER
);
137 allowed_length_out
= max_buffer_offset
- in_output_offset
;
140 if (in_output_length
> allowed_length_out
) {
141 return smbd_smb2_request_error(req
, NT_STATUS_INVALID_PARAMETER
);
144 if (in_output_length
> 0) {
147 if (in_output_offset
< min_output_offset
) {
148 return smbd_smb2_request_error(req
,
149 NT_STATUS_INVALID_PARAMETER
);
152 tmp_ofs
= in_output_offset
- min_buffer_offset
;
153 in_output_buffer
.data
= SMBD_SMB2_IN_DYN_PTR(req
);
154 in_output_buffer
.data
+= tmp_ofs
;
155 in_output_buffer
.length
= in_output_length
;
159 * verify the credits and avoid overflows
160 * in_input_buffer.length and in_output_buffer.length
161 * are already verified.
163 data_length_in
= in_input_buffer
.length
+ in_output_buffer
.length
;
165 data_length_out
= in_max_input_length
;
166 data_length_tmp
= UINT32_MAX
- data_length_out
;
167 if (data_length_tmp
< in_max_output_length
) {
168 return smbd_smb2_request_error(req
, NT_STATUS_INVALID_PARAMETER
);
170 data_length_out
+= in_max_output_length
;
172 data_length_max
= MAX(data_length_in
, data_length_out
);
174 status
= smbd_smb2_request_verify_creditcharge(req
, data_length_max
);
175 if (!NT_STATUS_IS_OK(status
)) {
176 return smbd_smb2_request_error(req
, status
);
180 * If the Flags field of the request is not SMB2_0_IOCTL_IS_FSCTL the
181 * server MUST fail the request with STATUS_NOT_SUPPORTED.
183 if (in_flags
!= SMB2_IOCTL_FLAG_IS_FSCTL
) {
184 return smbd_smb2_request_error(req
, NT_STATUS_NOT_SUPPORTED
);
187 switch (in_ctl_code
) {
188 case FSCTL_DFS_GET_REFERRALS
:
189 case FSCTL_DFS_GET_REFERRALS_EX
:
190 case FSCTL_PIPE_WAIT
:
191 case FSCTL_VALIDATE_NEGOTIATE_INFO_224
:
192 case FSCTL_VALIDATE_NEGOTIATE_INFO
:
193 case FSCTL_QUERY_NETWORK_INTERFACE_INFO
:
195 * Some SMB2 specific CtlCodes like FSCTL_DFS_GET_REFERRALS or
196 * FSCTL_PIPE_WAIT does not take a file handle.
198 * If FileId in the SMB2 Header of the request is not
199 * 0xFFFFFFFFFFFFFFFF, then the server MUST fail the request
200 * with STATUS_INVALID_PARAMETER.
202 if (in_file_id_persistent
!= UINT64_MAX
||
203 in_file_id_volatile
!= UINT64_MAX
) {
204 return smbd_smb2_request_error(req
,
205 NT_STATUS_INVALID_PARAMETER
);
209 in_fsp
= file_fsp_smb2(req
, in_file_id_persistent
,
210 in_file_id_volatile
);
211 if (in_fsp
== NULL
) {
212 return smbd_smb2_request_error(req
, NT_STATUS_FILE_CLOSED
);
217 subreq
= smbd_smb2_ioctl_send(req
, req
->sconn
->ev_ctx
,
221 in_max_output_length
,
223 if (subreq
== NULL
) {
224 return smbd_smb2_request_error(req
, NT_STATUS_NO_MEMORY
);
226 tevent_req_set_callback(subreq
, smbd_smb2_request_ioctl_done
, req
);
228 return smbd_smb2_request_pending_queue(req
, subreq
, 1000);
231 static void smbd_smb2_request_ioctl_done(struct tevent_req
*subreq
)
233 struct smbd_smb2_request
*req
= tevent_req_callback_data(subreq
,
234 struct smbd_smb2_request
);
235 const uint8_t *inbody
;
238 uint32_t in_ctl_code
;
239 uint64_t in_file_id_persistent
;
240 uint64_t in_file_id_volatile
;
241 uint32_t out_input_offset
;
242 uint32_t out_output_offset
;
243 DATA_BLOB out_output_buffer
= data_blob_null
;
245 NTSTATUS error
; /* transport error */
246 bool disconnect
= false;
248 status
= smbd_smb2_ioctl_recv(subreq
, req
,
252 DEBUG(10,("smbd_smb2_request_ioctl_done: smbd_smb2_ioctl_recv returned "
254 (unsigned int)out_output_buffer
.length
,
255 nt_errstr(status
) ));
260 smbd_server_connection_terminate(req
->sconn
,
265 if (NT_STATUS_EQUAL(status
, STATUS_BUFFER_OVERFLOW
)) {
267 } else if (!NT_STATUS_IS_OK(status
)) {
268 error
= smbd_smb2_request_error(req
, status
);
269 if (!NT_STATUS_IS_OK(error
)) {
270 smbd_server_connection_terminate(req
->sconn
,
277 out_input_offset
= SMB2_HDR_BODY
+ 0x30;
278 out_output_offset
= SMB2_HDR_BODY
+ 0x30;
280 inbody
= SMBD_SMB2_IN_BODY_PTR(req
);
282 in_ctl_code
= IVAL(inbody
, 0x04);
283 in_file_id_persistent
= BVAL(inbody
, 0x08);
284 in_file_id_volatile
= BVAL(inbody
, 0x10);
286 outbody
= data_blob_talloc(req
->out
.vector
, NULL
, 0x30);
287 if (outbody
.data
== NULL
) {
288 error
= smbd_smb2_request_error(req
, NT_STATUS_NO_MEMORY
);
289 if (!NT_STATUS_IS_OK(error
)) {
290 smbd_server_connection_terminate(req
->sconn
,
297 SSVAL(outbody
.data
, 0x00, 0x30 + 1); /* struct size */
298 SSVAL(outbody
.data
, 0x02, 0); /* reserved */
299 SIVAL(outbody
.data
, 0x04,
300 in_ctl_code
); /* ctl code */
301 SBVAL(outbody
.data
, 0x08,
302 in_file_id_persistent
); /* file id (persistent) */
303 SBVAL(outbody
.data
, 0x10,
304 in_file_id_volatile
); /* file id (volatile) */
305 SIVAL(outbody
.data
, 0x18,
306 out_input_offset
); /* input offset */
307 SIVAL(outbody
.data
, 0x1C, 0); /* input count */
308 SIVAL(outbody
.data
, 0x20,
309 out_output_offset
); /* output offset */
310 SIVAL(outbody
.data
, 0x24,
311 out_output_buffer
.length
); /* output count */
312 SIVAL(outbody
.data
, 0x28, 0); /* flags */
313 SIVAL(outbody
.data
, 0x2C, 0); /* reserved */
316 * Note: Windows Vista and 2008 send back also the
317 * input from the request. But it was fixed in
320 outdyn
= out_output_buffer
;
322 error
= smbd_smb2_request_done_ex(req
, status
, outbody
, &outdyn
,
324 if (!NT_STATUS_IS_OK(error
)) {
325 smbd_server_connection_terminate(req
->sconn
,
331 static NTSTATUS
fsctl_dfs_get_refers(TALLOC_CTX
*mem_ctx
,
332 struct tevent_context
*ev
,
333 struct connection_struct
*conn
,
335 uint32_t in_max_output
,
336 DATA_BLOB
*out_output
)
338 uint16_t in_max_referral_level
;
339 DATA_BLOB in_file_name_buffer
;
340 char *in_file_name_string
;
341 size_t in_file_name_string_size
;
343 bool overflow
= false;
346 char *dfs_data
= NULL
;
350 return NT_STATUS_INVALID_DEVICE_REQUEST
;
353 if (!lp_host_msdfs()) {
354 return NT_STATUS_FS_DRIVER_REQUIRED
;
357 if (in_input
->length
< (2 + 2)) {
358 return NT_STATUS_INVALID_PARAMETER
;
361 in_max_referral_level
= SVAL(in_input
->data
, 0);
362 in_file_name_buffer
.data
= in_input
->data
+ 2;
363 in_file_name_buffer
.length
= in_input
->length
- 2;
365 ok
= convert_string_talloc(mem_ctx
, CH_UTF16
, CH_UNIX
,
366 in_file_name_buffer
.data
,
367 in_file_name_buffer
.length
,
368 &in_file_name_string
,
369 &in_file_name_string_size
);
371 return NT_STATUS_ILLEGAL_CHARACTER
;
374 dfs_size
= setup_dfs_referral(conn
,
376 in_max_referral_level
,
382 if (dfs_size
> in_max_output
) {
384 * TODO: we need a testsuite for this
387 dfs_size
= in_max_output
;
390 output
= data_blob_talloc(mem_ctx
, (uint8_t *)dfs_data
, dfs_size
);
392 if ((dfs_size
> 0) && (output
.data
== NULL
)) {
393 return NT_STATUS_NO_MEMORY
;
395 *out_output
= output
;
398 return STATUS_BUFFER_OVERFLOW
;
403 static NTSTATUS
fsctl_validate_neg_info(TALLOC_CTX
*mem_ctx
,
404 struct tevent_context
*ev
,
405 struct smbXsrv_connection
*conn
,
407 uint32_t in_max_output
,
408 DATA_BLOB
*out_output
,
411 uint32_t in_capabilities
;
412 DATA_BLOB in_guid_blob
;
414 uint16_t in_security_mode
;
415 uint16_t in_num_dialects
;
417 DATA_BLOB out_guid_blob
;
420 if (in_input
->length
< 0x18) {
421 return NT_STATUS_INVALID_PARAMETER
;
424 in_capabilities
= IVAL(in_input
->data
, 0x00);
425 in_guid_blob
= data_blob_const(in_input
->data
+ 0x04, 16);
426 in_security_mode
= SVAL(in_input
->data
, 0x14);
427 in_num_dialects
= SVAL(in_input
->data
, 0x16);
429 if (in_input
->length
< (0x18 + in_num_dialects
*2)) {
430 return NT_STATUS_INVALID_PARAMETER
;
433 if (in_max_output
< 0x18) {
434 return NT_STATUS_BUFFER_TOO_SMALL
;
437 status
= GUID_from_ndr_blob(&in_guid_blob
, &in_guid
);
438 if (!NT_STATUS_IS_OK(status
)) {
442 if (in_num_dialects
!= conn
->smb2
.client
.num_dialects
) {
444 return NT_STATUS_ACCESS_DENIED
;
447 for (i
=0; i
< in_num_dialects
; i
++) {
448 uint16_t v
= SVAL(in_input
->data
, 0x18 + i
*2);
450 if (conn
->smb2
.client
.dialects
[i
] != v
) {
452 return NT_STATUS_ACCESS_DENIED
;
456 if (GUID_compare(&in_guid
, &conn
->smb2
.client
.guid
) != 0) {
458 return NT_STATUS_ACCESS_DENIED
;
461 if (in_security_mode
!= conn
->smb2
.client
.security_mode
) {
463 return NT_STATUS_ACCESS_DENIED
;
466 if (in_capabilities
!= conn
->smb2
.client
.capabilities
) {
468 return NT_STATUS_ACCESS_DENIED
;
471 status
= GUID_to_ndr_blob(&conn
->smb2
.server
.guid
, mem_ctx
,
473 if (!NT_STATUS_IS_OK(status
)) {
477 *out_output
= data_blob_talloc(mem_ctx
, NULL
, 0x18);
478 if (out_output
->data
== NULL
) {
479 return NT_STATUS_NO_MEMORY
;
482 SIVAL(out_output
->data
, 0x00, conn
->smb2
.server
.capabilities
);
483 memcpy(out_output
->data
+0x04, out_guid_blob
.data
, 16);
484 SIVAL(out_output
->data
, 0x14, conn
->smb2
.server
.security_mode
);
485 SIVAL(out_output
->data
, 0x16, conn
->smb2
.server
.dialect
);
491 struct smbd_smb2_ioctl_state
{
492 struct smbd_smb2_request
*smb2req
;
493 struct smb_request
*smbreq
;
496 uint32_t in_max_output
;
497 DATA_BLOB out_output
;
501 static void smbd_smb2_ioctl_pipe_write_done(struct tevent_req
*subreq
);
502 static void smbd_smb2_ioctl_pipe_read_done(struct tevent_req
*subreq
);
504 static struct tevent_req
*smbd_smb2_ioctl_send(TALLOC_CTX
*mem_ctx
,
505 struct tevent_context
*ev
,
506 struct smbd_smb2_request
*smb2req
,
507 struct files_struct
*fsp
,
508 uint32_t in_ctl_code
,
510 uint32_t in_max_output
,
513 struct tevent_req
*req
;
514 struct smbd_smb2_ioctl_state
*state
;
515 struct smb_request
*smbreq
;
516 struct tevent_req
*subreq
;
518 req
= tevent_req_create(mem_ctx
, &state
,
519 struct smbd_smb2_ioctl_state
);
523 state
->smb2req
= smb2req
;
524 state
->smbreq
= NULL
;
526 state
->in_input
= in_input
;
527 state
->in_max_output
= in_max_output
;
528 state
->out_output
= data_blob_null
;
530 DEBUG(10, ("smbd_smb2_ioctl: ctl_code[0x%08x] %s, %s\n",
531 (unsigned)in_ctl_code
,
532 fsp
? fsp_str_dbg(fsp
) : "<no handle>",
535 smbreq
= smbd_smb2_fake_smb_request(smb2req
);
536 if (tevent_req_nomem(smbreq
, req
)) {
537 return tevent_req_post(req
, ev
);
539 state
->smbreq
= smbreq
;
541 switch (in_ctl_code
) {
542 case 0x00060194: /* FSCTL_DFS_GET_REFERRALS */
544 status
= fsctl_dfs_get_refers(state
, ev
, state
->smbreq
->conn
,
546 state
->in_max_output
,
548 if (!tevent_req_nterror(req
, status
)) {
549 tevent_req_done(req
);
551 return tevent_req_post(req
, ev
);
553 case 0x0011C017: /* FSCTL_PIPE_TRANSCEIVE */
555 if (!IS_IPC(smbreq
->conn
)) {
556 tevent_req_nterror(req
, NT_STATUS_NOT_SUPPORTED
);
557 return tevent_req_post(req
, ev
);
561 tevent_req_nterror(req
, NT_STATUS_FILE_CLOSED
);
562 return tevent_req_post(req
, ev
);
565 if (!fsp_is_np(fsp
)) {
566 tevent_req_nterror(req
, NT_STATUS_FILE_CLOSED
);
567 return tevent_req_post(req
, ev
);
570 DEBUG(10,("smbd_smb2_ioctl_send: np_write_send of size %u\n",
571 (unsigned int)in_input
.length
));
573 subreq
= np_write_send(state
, ev
,
574 fsp
->fake_file_handle
,
577 if (tevent_req_nomem(subreq
, req
)) {
578 return tevent_req_post(req
, ev
);
580 tevent_req_set_callback(subreq
,
581 smbd_smb2_ioctl_pipe_write_done
,
585 case FSCTL_VALIDATE_NEGOTIATE_INFO
:
587 status
= fsctl_validate_neg_info(state
, ev
,
588 state
->smbreq
->sconn
->conn
,
590 state
->in_max_output
,
593 if (!tevent_req_nterror(req
, status
)) {
594 tevent_req_done(req
);
596 return tevent_req_post(req
, ev
);
600 uint8_t *out_data
= NULL
;
601 uint32_t out_data_len
= 0;
605 tevent_req_nterror(req
, NT_STATUS_FILE_CLOSED
);
606 return tevent_req_post(req
, ev
);
609 status
= SMB_VFS_FSCTL(fsp
,
618 state
->out_output
= data_blob_const(out_data
, out_data_len
);
619 if (NT_STATUS_IS_OK(status
)) {
620 tevent_req_done(req
);
621 return tevent_req_post(req
, ev
);
624 if (NT_STATUS_EQUAL(status
, NT_STATUS_NOT_SUPPORTED
)) {
625 if (IS_IPC(smbreq
->conn
)) {
626 status
= NT_STATUS_FS_DRIVER_REQUIRED
;
628 status
= NT_STATUS_INVALID_DEVICE_REQUEST
;
632 tevent_req_nterror(req
, status
);
633 return tevent_req_post(req
, ev
);
637 tevent_req_nterror(req
, NT_STATUS_INTERNAL_ERROR
);
638 return tevent_req_post(req
, ev
);
641 static void smbd_smb2_ioctl_pipe_write_done(struct tevent_req
*subreq
)
643 struct tevent_req
*req
= tevent_req_callback_data(subreq
,
645 struct smbd_smb2_ioctl_state
*state
= tevent_req_data(req
,
646 struct smbd_smb2_ioctl_state
);
648 ssize_t nwritten
= -1;
650 status
= np_write_recv(subreq
, &nwritten
);
652 DEBUG(10,("smbd_smb2_ioctl_pipe_write_done: received %ld\n",
653 (long int)nwritten
));
656 if (!NT_STATUS_IS_OK(status
)) {
657 NTSTATUS old
= status
;
658 status
= nt_status_np_pipe(old
);
659 tevent_req_nterror(req
, status
);
663 if (nwritten
!= state
->in_input
.length
) {
664 tevent_req_nterror(req
, NT_STATUS_PIPE_NOT_AVAILABLE
);
668 state
->out_output
= data_blob_talloc(state
, NULL
, state
->in_max_output
);
669 if (state
->in_max_output
> 0 &&
670 tevent_req_nomem(state
->out_output
.data
, req
)) {
674 DEBUG(10,("smbd_smb2_ioctl_pipe_write_done: issuing np_read_send "
676 (unsigned int)state
->out_output
.length
));
678 subreq
= np_read_send(state
->smbreq
->conn
,
679 state
->smb2req
->sconn
->ev_ctx
,
680 state
->fsp
->fake_file_handle
,
681 state
->out_output
.data
,
682 state
->out_output
.length
);
683 if (tevent_req_nomem(subreq
, req
)) {
686 tevent_req_set_callback(subreq
, smbd_smb2_ioctl_pipe_read_done
, req
);
689 static void smbd_smb2_ioctl_pipe_read_done(struct tevent_req
*subreq
)
691 struct tevent_req
*req
= tevent_req_callback_data(subreq
,
693 struct smbd_smb2_ioctl_state
*state
= tevent_req_data(req
,
694 struct smbd_smb2_ioctl_state
);
698 bool is_data_outstanding
= false;
700 status
= np_read_recv(subreq
, &nread
, &is_data_outstanding
);
704 status
= nt_status_np_pipe(old
);
706 DEBUG(10,("smbd_smb2_ioctl_pipe_read_done: np_read_recv nread = %d "
707 "is_data_outstanding = %d, status = %s%s%s\n",
709 (int)is_data_outstanding
,
711 NT_STATUS_EQUAL(old
, status
)?"":" => ",
712 NT_STATUS_EQUAL(old
, status
)?"":nt_errstr(status
)));
714 if (!NT_STATUS_IS_OK(status
)) {
715 tevent_req_nterror(req
, status
);
719 state
->out_output
.length
= nread
;
721 if (is_data_outstanding
) {
722 tevent_req_nterror(req
, STATUS_BUFFER_OVERFLOW
);
726 tevent_req_done(req
);
729 static NTSTATUS
smbd_smb2_ioctl_recv(struct tevent_req
*req
,
731 DATA_BLOB
*out_output
,
734 NTSTATUS status
= NT_STATUS_OK
;
735 struct smbd_smb2_ioctl_state
*state
= tevent_req_data(req
,
736 struct smbd_smb2_ioctl_state
);
738 *disconnect
= state
->disconnect
;
740 if (tevent_req_is_nterror(req
, &status
)) {
741 if (!NT_STATUS_EQUAL(status
, STATUS_BUFFER_OVERFLOW
)) {
742 tevent_req_received(req
);
747 *out_output
= state
->out_output
;
748 talloc_steal(mem_ctx
, out_output
->data
);
750 tevent_req_received(req
);