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 "smb2_ioctl_private.h"
30 struct tevent_req
*smb2_ioctl_filesys(uint32_t ctl_code
,
31 struct tevent_context
*ev
,
32 struct tevent_req
*req
,
33 struct smbd_smb2_ioctl_state
*state
)
36 /* no filesystem device type ioctls are supported yet */
39 uint8_t *out_data
= NULL
;
40 uint32_t out_data_len
= 0;
42 if (state
->fsp
== NULL
) {
43 status
= NT_STATUS_NOT_SUPPORTED
;
45 status
= SMB_VFS_FSCTL(state
->fsp
,
48 state
->smbreq
->flags2
,
50 state
->in_input
.length
,
54 state
->out_output
= data_blob_const(out_data
, out_data_len
);
55 if (NT_STATUS_IS_OK(status
)) {
57 return tevent_req_post(req
, ev
);
61 if (NT_STATUS_EQUAL(status
, NT_STATUS_NOT_SUPPORTED
)) {
62 if (IS_IPC(state
->smbreq
->conn
)) {
63 status
= NT_STATUS_FS_DRIVER_REQUIRED
;
65 status
= NT_STATUS_INVALID_DEVICE_REQUEST
;
69 tevent_req_nterror(req
, status
);
70 return tevent_req_post(req
, ev
);
75 tevent_req_nterror(req
, NT_STATUS_INTERNAL_ERROR
);
76 return tevent_req_post(req
, ev
);