wbinfo: Fix Coverity ID 242685 Resource leak
[Samba/gebeck_regimport.git] / source3 / smbd / smb2_ioctl.c
blobb1a9e32f368c244c433e57ad07c8510e92191f1b
1 /*
2 Unix SMB/CIFS implementation.
3 Core SMB2 server
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/>.
21 #include "includes.h"
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 uint32_t in_ctl_code,
34 uint64_t in_file_id_volatile,
35 DATA_BLOB in_input,
36 uint32_t in_max_output,
37 uint32_t in_flags);
38 static NTSTATUS smbd_smb2_ioctl_recv(struct tevent_req *req,
39 TALLOC_CTX *mem_ctx,
40 DATA_BLOB *out_output,
41 bool *disconnect);
43 static void smbd_smb2_request_ioctl_done(struct tevent_req *subreq);
44 NTSTATUS smbd_smb2_request_process_ioctl(struct smbd_smb2_request *req)
46 NTSTATUS status;
47 const uint8_t *inbody;
48 int i = req->current_idx;
49 uint32_t in_ctl_code;
50 uint64_t in_file_id_persistent;
51 uint64_t in_file_id_volatile;
52 uint32_t in_input_offset;
53 uint32_t in_input_length;
54 DATA_BLOB in_input_buffer;
55 uint32_t in_max_output_length;
56 uint32_t in_flags;
57 struct tevent_req *subreq;
59 status = smbd_smb2_request_verify_sizes(req, 0x39);
60 if (!NT_STATUS_IS_OK(status)) {
61 return smbd_smb2_request_error(req, status);
63 inbody = (const uint8_t *)req->in.vector[i+1].iov_base;
65 in_ctl_code = IVAL(inbody, 0x04);
66 in_file_id_persistent = BVAL(inbody, 0x08);
67 in_file_id_volatile = BVAL(inbody, 0x10);
68 in_input_offset = IVAL(inbody, 0x18);
69 in_input_length = IVAL(inbody, 0x1C);
70 in_max_output_length = IVAL(inbody, 0x2C);
71 in_flags = IVAL(inbody, 0x30);
74 * InputOffset (4 bytes): The offset, in bytes, from the beginning of
75 * the SMB2 header to the input data buffer. If no input data is
76 * required for the FSCTL/IOCTL command being issued, the client SHOULD
77 * set this value to 0.<49>
78 * <49> If no input data is required for the FSCTL/IOCTL command being
79 * issued, Windows-based clients set this field to any value.
81 if ((in_input_length > 0)
82 && (in_input_offset != (SMB2_HDR_BODY + req->in.vector[i+1].iov_len))) {
83 return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
86 if (in_input_length > req->in.vector[i+2].iov_len) {
87 return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
90 in_input_buffer.data = (uint8_t *)req->in.vector[i+2].iov_base;
91 in_input_buffer.length = in_input_length;
93 if (req->compat_chain_fsp) {
94 /* skip check */
95 } else if (in_file_id_persistent == UINT64_MAX &&
96 in_file_id_volatile == UINT64_MAX) {
97 /* without a handle */
98 } else if (in_file_id_persistent != in_file_id_volatile) {
99 return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
102 subreq = smbd_smb2_ioctl_send(req,
103 req->sconn->ev_ctx,
104 req,
105 in_ctl_code,
106 in_file_id_volatile,
107 in_input_buffer,
108 in_max_output_length,
109 in_flags);
110 if (subreq == NULL) {
111 return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
113 tevent_req_set_callback(subreq, smbd_smb2_request_ioctl_done, req);
115 return smbd_smb2_request_pending_queue(req, subreq, 1000);
118 static void smbd_smb2_request_ioctl_done(struct tevent_req *subreq)
120 struct smbd_smb2_request *req = tevent_req_callback_data(subreq,
121 struct smbd_smb2_request);
122 const uint8_t *inbody;
123 int i = req->current_idx;
124 DATA_BLOB outbody;
125 DATA_BLOB outdyn;
126 uint32_t in_ctl_code;
127 uint64_t in_file_id_persistent;
128 uint64_t in_file_id_volatile;
129 uint32_t out_input_offset;
130 uint32_t out_output_offset;
131 DATA_BLOB out_output_buffer = data_blob_null;
132 NTSTATUS status;
133 NTSTATUS error; /* transport error */
134 bool disconnect = false;
136 status = smbd_smb2_ioctl_recv(subreq, req,
137 &out_output_buffer,
138 &disconnect);
140 DEBUG(10,("smbd_smb2_request_ioctl_done: smbd_smb2_ioctl_recv returned "
141 "%u status %s\n",
142 (unsigned int)out_output_buffer.length,
143 nt_errstr(status) ));
145 TALLOC_FREE(subreq);
146 if (disconnect) {
147 error = status;
148 smbd_server_connection_terminate(req->sconn,
149 nt_errstr(error));
150 return;
153 if (NT_STATUS_EQUAL(status, STATUS_BUFFER_OVERFLOW)) {
154 /* also ok */
155 } else if (!NT_STATUS_IS_OK(status)) {
156 error = smbd_smb2_request_error(req, status);
157 if (!NT_STATUS_IS_OK(error)) {
158 smbd_server_connection_terminate(req->sconn,
159 nt_errstr(error));
160 return;
162 return;
165 out_input_offset = SMB2_HDR_BODY + 0x30;
166 out_output_offset = SMB2_HDR_BODY + 0x30;
168 inbody = (const uint8_t *)req->in.vector[i+1].iov_base;
170 in_ctl_code = IVAL(inbody, 0x04);
171 in_file_id_persistent = BVAL(inbody, 0x08);
172 in_file_id_volatile = BVAL(inbody, 0x10);
174 outbody = data_blob_talloc(req->out.vector, NULL, 0x30);
175 if (outbody.data == NULL) {
176 error = smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
177 if (!NT_STATUS_IS_OK(error)) {
178 smbd_server_connection_terminate(req->sconn,
179 nt_errstr(error));
180 return;
182 return;
185 SSVAL(outbody.data, 0x00, 0x30 + 1); /* struct size */
186 SSVAL(outbody.data, 0x02, 0); /* reserved */
187 SIVAL(outbody.data, 0x04,
188 in_ctl_code); /* ctl code */
189 SBVAL(outbody.data, 0x08,
190 in_file_id_persistent); /* file id (persistent) */
191 SBVAL(outbody.data, 0x10,
192 in_file_id_volatile); /* file id (volatile) */
193 SIVAL(outbody.data, 0x18,
194 out_input_offset); /* input offset */
195 SIVAL(outbody.data, 0x1C, 0); /* input count */
196 SIVAL(outbody.data, 0x20,
197 out_output_offset); /* output offset */
198 SIVAL(outbody.data, 0x24,
199 out_output_buffer.length); /* output count */
200 SIVAL(outbody.data, 0x28, 0); /* flags */
201 SIVAL(outbody.data, 0x2C, 0); /* reserved */
204 * Note: Windows Vista and 2008 send back also the
205 * input from the request. But it was fixed in
206 * Windows 7.
208 outdyn = out_output_buffer;
210 error = smbd_smb2_request_done_ex(req, status, outbody, &outdyn,
211 __location__);
212 if (!NT_STATUS_IS_OK(error)) {
213 smbd_server_connection_terminate(req->sconn,
214 nt_errstr(error));
215 return;
219 struct smbd_smb2_ioctl_state {
220 struct smbd_smb2_request *smb2req;
221 struct smb_request *smbreq;
222 files_struct *fsp;
223 DATA_BLOB in_input;
224 uint32_t in_max_output;
225 DATA_BLOB out_output;
226 bool disconnect;
229 static void smbd_smb2_ioctl_pipe_write_done(struct tevent_req *subreq);
230 static void smbd_smb2_ioctl_pipe_read_done(struct tevent_req *subreq);
232 static struct tevent_req *smbd_smb2_ioctl_send(TALLOC_CTX *mem_ctx,
233 struct tevent_context *ev,
234 struct smbd_smb2_request *smb2req,
235 uint32_t in_ctl_code,
236 uint64_t in_file_id_volatile,
237 DATA_BLOB in_input,
238 uint32_t in_max_output,
239 uint32_t in_flags)
241 struct tevent_req *req;
242 struct smbd_smb2_ioctl_state *state;
243 struct smb_request *smbreq;
244 files_struct *fsp = NULL;
245 struct tevent_req *subreq;
247 req = tevent_req_create(mem_ctx, &state,
248 struct smbd_smb2_ioctl_state);
249 if (req == NULL) {
250 return NULL;
252 state->smb2req = smb2req;
253 state->smbreq = NULL;
254 state->fsp = NULL;
255 state->in_input = in_input;
256 state->in_max_output = in_max_output;
257 state->out_output = data_blob_null;
259 DEBUG(10, ("smbd_smb2_ioctl: ctl_code[0x%08x] file_id[0x%016llX]\n",
260 (unsigned)in_ctl_code,
261 (unsigned long long)in_file_id_volatile));
263 smbreq = smbd_smb2_fake_smb_request(smb2req);
264 if (tevent_req_nomem(smbreq, req)) {
265 return tevent_req_post(req, ev);
267 state->smbreq = smbreq;
269 if (in_file_id_volatile != UINT64_MAX) {
270 fsp = file_fsp(smbreq, (uint16_t)in_file_id_volatile);
271 if (fsp == NULL) {
272 tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
273 return tevent_req_post(req, ev);
275 if (smbreq->conn != fsp->conn) {
276 tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
277 return tevent_req_post(req, ev);
279 if (smb2req->session->vuid != fsp->vuid) {
280 tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
281 return tevent_req_post(req, ev);
283 state->fsp = fsp;
286 switch (in_ctl_code) {
287 case 0x00060194: /* FSCTL_DFS_GET_REFERRALS */
289 uint16_t in_max_referral_level;
290 DATA_BLOB in_file_name_buffer;
291 char *in_file_name_string;
292 size_t in_file_name_string_size;
293 bool ok;
294 bool overflow = false;
295 NTSTATUS status;
296 int dfs_size;
297 char *dfs_data = NULL;
299 if (!IS_IPC(smbreq->conn)) {
300 tevent_req_nterror(req, NT_STATUS_INVALID_DEVICE_REQUEST);
301 return tevent_req_post(req, ev);
304 if (!lp_host_msdfs()) {
305 tevent_req_nterror(req, NT_STATUS_FS_DRIVER_REQUIRED);
306 return tevent_req_post(req, ev);
309 if (in_input.length < (2 + 2)) {
310 tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
311 return tevent_req_post(req, ev);
314 in_max_referral_level = SVAL(in_input.data, 0);
315 in_file_name_buffer.data = in_input.data + 2;
316 in_file_name_buffer.length = in_input.length - 2;
318 ok = convert_string_talloc(state, CH_UTF16, CH_UNIX,
319 in_file_name_buffer.data,
320 in_file_name_buffer.length,
321 &in_file_name_string,
322 &in_file_name_string_size);
323 if (!ok) {
324 tevent_req_nterror(req, NT_STATUS_ILLEGAL_CHARACTER);
325 return tevent_req_post(req, ev);
328 dfs_size = setup_dfs_referral(smbreq->conn,
329 in_file_name_string,
330 in_max_referral_level,
331 &dfs_data, &status);
332 if (dfs_size < 0) {
333 tevent_req_nterror(req, status);
334 return tevent_req_post(req, ev);
337 if (dfs_size > in_max_output) {
339 * TODO: we need a testsuite for this
341 overflow = true;
342 dfs_size = in_max_output;
345 state->out_output = data_blob_talloc(state,
346 (uint8_t *)dfs_data,
347 dfs_size);
348 SAFE_FREE(dfs_data);
349 if (dfs_size > 0 &&
350 tevent_req_nomem(state->out_output.data, req)) {
351 return tevent_req_post(req, ev);
354 if (overflow) {
355 tevent_req_nterror(req, STATUS_BUFFER_OVERFLOW);
356 } else {
357 tevent_req_done(req);
359 return tevent_req_post(req, ev);
361 case 0x0011C017: /* FSCTL_PIPE_TRANSCEIVE */
363 if (!IS_IPC(smbreq->conn)) {
364 tevent_req_nterror(req, NT_STATUS_NOT_SUPPORTED);
365 return tevent_req_post(req, ev);
368 if (fsp == NULL) {
369 tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
370 return tevent_req_post(req, ev);
373 if (!fsp_is_np(fsp)) {
374 tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
375 return tevent_req_post(req, ev);
378 DEBUG(10,("smbd_smb2_ioctl_send: np_write_send of size %u\n",
379 (unsigned int)in_input.length ));
381 subreq = np_write_send(state, ev,
382 fsp->fake_file_handle,
383 in_input.data,
384 in_input.length);
385 if (tevent_req_nomem(subreq, req)) {
386 return tevent_req_post(req, ev);
388 tevent_req_set_callback(subreq,
389 smbd_smb2_ioctl_pipe_write_done,
390 req);
391 return req;
393 case FSCTL_VALIDATE_NEGOTIATE_INFO_224:
395 struct smbXsrv_connection *conn = smbreq->sconn->conn;
396 uint32_t in_capabilities;
397 DATA_BLOB in_guid_blob;
398 struct GUID in_guid;
399 uint16_t in_security_mode;
400 uint16_t in_max_dialect;
401 uint16_t max_dialect;
402 DATA_BLOB out_guid_blob;
403 NTSTATUS status;
405 if (in_input.length != 0x18) {
406 tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
407 return tevent_req_post(req, ev);
410 if (in_max_output < 0x18) {
411 tevent_req_nterror(req, NT_STATUS_BUFFER_TOO_SMALL);
412 return tevent_req_post(req, ev);
415 in_capabilities = IVAL(in_input.data, 0x00);
416 in_guid_blob = data_blob_const(in_input.data + 0x04, 16);
417 in_security_mode = SVAL(in_input.data, 0x14);
418 in_max_dialect = SVAL(in_input.data, 0x16);
420 max_dialect = conn->smb2.client.dialects[conn->smb2.client.num_dialects-1];
421 if (in_max_dialect != max_dialect) {
422 state->disconnect = true;
423 tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
424 return tevent_req_post(req, ev);
427 if (!GUID_compare(&in_guid, &conn->smb2.client.guid)) {
428 state->disconnect = true;
429 tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
430 return tevent_req_post(req, ev);
433 if (in_security_mode != conn->smb2.client.security_mode) {
434 state->disconnect = true;
435 tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
436 return tevent_req_post(req, ev);
439 if (in_capabilities != conn->smb2.client.capabilities) {
440 state->disconnect = true;
441 tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
442 return tevent_req_post(req, ev);
445 status = GUID_to_ndr_blob(&conn->smb2.server.guid, state,
446 &out_guid_blob);
447 if (tevent_req_nterror(req, status)) {
448 return tevent_req_post(req, ev);
451 state->out_output = data_blob_talloc(state, NULL, 0x18);
452 if (tevent_req_nomem(state->out_output.data, req)) {
453 return tevent_req_post(req, ev);
456 SIVAL(state->out_output.data, 0x00, conn->smb2.server.capabilities);
457 memcpy(state->out_output.data+0x04, out_guid_blob.data, 16);
458 SIVAL(state->out_output.data, 0x14, conn->smb2.server.security_mode);
459 SIVAL(state->out_output.data, 0x16, conn->smb2.server.dialect);
461 tevent_req_done(req);
462 return tevent_req_post(req, ev);
465 case FSCTL_VALIDATE_NEGOTIATE_INFO:
467 struct smbXsrv_connection *conn = smbreq->sconn->conn;
468 uint32_t in_capabilities;
469 DATA_BLOB in_guid_blob;
470 struct GUID in_guid;
471 uint16_t in_security_mode;
472 uint16_t in_num_dialects;
473 uint16_t i;
474 DATA_BLOB out_guid_blob;
475 NTSTATUS status;
477 if (in_input.length < 0x18) {
478 tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
479 return tevent_req_post(req, ev);
482 in_capabilities = IVAL(in_input.data, 0x00);
483 in_guid_blob = data_blob_const(in_input.data + 0x04, 16);
484 in_security_mode = SVAL(in_input.data, 0x14);
485 in_num_dialects = SVAL(in_input.data, 0x16);
487 if (in_input.length != (0x18 + in_num_dialects*2)) {
488 tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
489 return tevent_req_post(req, ev);
492 if (in_max_output < 0x18) {
493 tevent_req_nterror(req, NT_STATUS_BUFFER_TOO_SMALL);
494 return tevent_req_post(req, ev);
497 if (in_num_dialects != conn->smb2.client.num_dialects) {
498 state->disconnect = true;
499 tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
500 return tevent_req_post(req, ev);
503 for (i=0; i < in_num_dialects; i++) {
504 uint16_t v = SVAL(in_input.data, 0x18 + i*2);
506 if (conn->smb2.client.dialects[i] != v) {
507 state->disconnect = true;
508 tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
509 return tevent_req_post(req, ev);
513 if (!GUID_compare(&in_guid, &conn->smb2.client.guid)) {
514 state->disconnect = true;
515 tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
516 return tevent_req_post(req, ev);
519 if (in_security_mode != conn->smb2.client.security_mode) {
520 state->disconnect = true;
521 tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
522 return tevent_req_post(req, ev);
525 if (in_capabilities != conn->smb2.client.capabilities) {
526 state->disconnect = true;
527 tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
528 return tevent_req_post(req, ev);
531 status = GUID_to_ndr_blob(&conn->smb2.server.guid, state,
532 &out_guid_blob);
533 if (tevent_req_nterror(req, status)) {
534 return tevent_req_post(req, ev);
537 state->out_output = data_blob_talloc(state, NULL, 0x18);
538 if (tevent_req_nomem(state->out_output.data, req)) {
539 return tevent_req_post(req, ev);
542 SIVAL(state->out_output.data, 0x00, conn->smb2.server.capabilities);
543 memcpy(state->out_output.data+0x04, out_guid_blob.data, 16);
544 SIVAL(state->out_output.data, 0x14, conn->smb2.server.security_mode);
545 SIVAL(state->out_output.data, 0x16, conn->smb2.server.dialect);
547 tevent_req_done(req);
548 return tevent_req_post(req, ev);
551 default: {
552 uint8_t *out_data = NULL;
553 uint32_t out_data_len = 0;
554 NTSTATUS status;
556 if (fsp == NULL) {
557 tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
558 return tevent_req_post(req, ev);
561 status = SMB_VFS_FSCTL(fsp,
562 state,
563 in_ctl_code,
564 smbreq->flags2,
565 in_input.data,
566 in_input.length,
567 &out_data,
568 in_max_output,
569 &out_data_len);
570 state->out_output = data_blob_const(out_data, out_data_len);
571 if (NT_STATUS_IS_OK(status)) {
572 tevent_req_done(req);
573 return tevent_req_post(req, ev);
576 if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) {
577 if (IS_IPC(smbreq->conn)) {
578 status = NT_STATUS_FS_DRIVER_REQUIRED;
579 } else {
580 status = NT_STATUS_INVALID_DEVICE_REQUEST;
584 tevent_req_nterror(req, status);
585 return tevent_req_post(req, ev);
589 tevent_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
590 return tevent_req_post(req, ev);
593 static void smbd_smb2_ioctl_pipe_write_done(struct tevent_req *subreq)
595 struct tevent_req *req = tevent_req_callback_data(subreq,
596 struct tevent_req);
597 struct smbd_smb2_ioctl_state *state = tevent_req_data(req,
598 struct smbd_smb2_ioctl_state);
599 NTSTATUS status;
600 ssize_t nwritten = -1;
602 status = np_write_recv(subreq, &nwritten);
604 DEBUG(10,("smbd_smb2_ioctl_pipe_write_done: received %ld\n",
605 (long int)nwritten ));
607 TALLOC_FREE(subreq);
608 if (!NT_STATUS_IS_OK(status)) {
609 tevent_req_nterror(req, status);
610 return;
613 if (nwritten != state->in_input.length) {
614 tevent_req_nterror(req, NT_STATUS_PIPE_NOT_AVAILABLE);
615 return;
618 state->out_output = data_blob_talloc(state, NULL, state->in_max_output);
619 if (state->in_max_output > 0 &&
620 tevent_req_nomem(state->out_output.data, req)) {
621 return;
624 DEBUG(10,("smbd_smb2_ioctl_pipe_write_done: issuing np_read_send "
625 "of size %u\n",
626 (unsigned int)state->out_output.length ));
628 TALLOC_FREE(subreq);
629 subreq = np_read_send(state->smbreq->conn,
630 state->smb2req->sconn->ev_ctx,
631 state->fsp->fake_file_handle,
632 state->out_output.data,
633 state->out_output.length);
634 if (tevent_req_nomem(subreq, req)) {
635 return;
637 tevent_req_set_callback(subreq, smbd_smb2_ioctl_pipe_read_done, req);
640 static void smbd_smb2_ioctl_pipe_read_done(struct tevent_req *subreq)
642 struct tevent_req *req = tevent_req_callback_data(subreq,
643 struct tevent_req);
644 struct smbd_smb2_ioctl_state *state = tevent_req_data(req,
645 struct smbd_smb2_ioctl_state);
646 NTSTATUS status;
647 ssize_t nread = -1;
648 bool is_data_outstanding = false;
650 status = np_read_recv(subreq, &nread, &is_data_outstanding);
652 DEBUG(10,("smbd_smb2_ioctl_pipe_read_done: np_read_recv nread = %d "
653 "is_data_outstanding = %d, status = %s\n",
654 (int)nread,
655 (int)is_data_outstanding,
656 nt_errstr(status) ));
658 TALLOC_FREE(subreq);
659 if (!NT_STATUS_IS_OK(status)) {
660 tevent_req_nterror(req, status);
661 return;
664 state->out_output.length = nread;
666 if (is_data_outstanding) {
667 tevent_req_nterror(req, STATUS_BUFFER_OVERFLOW);
668 return;
671 tevent_req_done(req);
674 static NTSTATUS smbd_smb2_ioctl_recv(struct tevent_req *req,
675 TALLOC_CTX *mem_ctx,
676 DATA_BLOB *out_output,
677 bool *disconnect)
679 NTSTATUS status = NT_STATUS_OK;
680 struct smbd_smb2_ioctl_state *state = tevent_req_data(req,
681 struct smbd_smb2_ioctl_state);
683 *disconnect = state->disconnect;
685 if (tevent_req_is_nterror(req, &status)) {
686 if (!NT_STATUS_EQUAL(status, STATUS_BUFFER_OVERFLOW)) {
687 tevent_req_received(req);
688 return status;
692 *out_output = state->out_output;
693 talloc_steal(mem_ctx, out_output->data);
695 tevent_req_received(req);
696 return status;