r16889: implement SMB2 Ioctl in the frontend
authorStefan Metzmacher <metze@samba.org>
Sun, 9 Jul 2006 09:50:41 +0000 (09:50 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:09:56 +0000 (14:09 -0500)
metze
(This used to be commit 90b0ae53e40a220249b55035411e6b60ee04de7c)

source4/ntvfs/posix/pvfs_ioctl.c
source4/smb_server/smb2/fileio.c

index 3744530a7ad7f8890e060fed3bba8bba6ffd98ec..513f03c8ec3c621427828ef7af0d8d7d451a5dd1 100644 (file)
@@ -71,6 +71,9 @@ NTSTATUS pvfs_ioctl(struct ntvfs_module_context *ntvfs,
 
        case RAW_IOCTL_NTIOCTL:
                return pvfs_ntioctl(ntvfs, req, io);
+
+       case RAW_IOCTL_SMB2:
+               return NT_STATUS_FS_DRIVER_REQUIRED;
        }
 
        return NT_STATUS_INVALID_LEVEL;
index 18db782a79e63db74778772230a8ea06f3579e4e..69eb4a02f288dbcb4af21905c0e8a549ac57f9f6 100644 (file)
@@ -229,9 +229,46 @@ void smb2srv_lock_recv(struct smb2srv_request *req)
        smb2srv_send_error(req, NT_STATUS_NOT_IMPLEMENTED);
 }
 
+static void smb2srv_ioctl_send(struct ntvfs_request *ntvfs)
+{
+       struct smb2srv_request *req;
+       union smb_ioctl *io;
+
+       SMB2SRV_CHECK_ASYNC_STATUS_ERR(io, union smb_ioctl);
+       SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x30, True, 0));
+
+       SSVAL(req->out.body,    0x02,   io->smb2.out._pad);
+       SIVAL(req->out.body,    0x04,   io->smb2.out.function);
+       smb2srv_push_handle(req->out.body, 0x08,io->smb2.in.file.ntvfs);
+       SMB2SRV_CHECK(smb2_push_o32s32_blob(&req->out, 0x18, io->smb2.out.in));
+       SMB2SRV_CHECK(smb2_push_o32s32_blob(&req->out, 0x20, io->smb2.out.out));
+       SIVAL(req->out.body,    0x28,   io->smb2.out.unknown2);
+       SIVAL(req->out.body,    0x2C,   io->smb2.out.unknown3);
+
+       smb2srv_send_reply(req);
+}
+
 void smb2srv_ioctl_recv(struct smb2srv_request *req)
 {
-       smb2srv_send_error(req, NT_STATUS_FS_DRIVER_REQUIRED);
+       union smb_ioctl *io;
+
+       SMB2SRV_CHECK_BODY_SIZE(req, 0x38, True);
+       SMB2SRV_TALLOC_IO_PTR(io, union smb_ioctl);
+       SMB2SRV_SETUP_NTVFS_REQUEST(smb2srv_ioctl_send, NTVFS_ASYNC_STATE_MAY_ASYNC);
+
+       /* TODO: avoid the memcpy */
+       io->smb2.level                  = RAW_IOCTL_SMB2;
+       io->smb2.in._pad                = SVAL(req->in.body, 0x02);
+       io->smb2.in.function            = IVAL(req->in.body, 0x04);
+       io->smb2.in.file.ntvfs          = smb2srv_pull_handle(req, req->in.body, 0x08);
+       SMB2SRV_CHECK(smb2_pull_o32s32_blob(&req->in, io, req->in.body+0x18, &io->smb2.in.out));
+       io->smb2.in.unknown2            = IVAL(req->in.body, 0x20);
+       SMB2SRV_CHECK(smb2_pull_o32s32_blob(&req->in, io, req->in.body+0x24, &io->smb2.in.in));
+       io->smb2.in.max_response_size   = IVAL(req->in.body, 0x2C);
+       io->smb2.in.flags               = BVAL(req->in.body, 0x30);
+
+       SMB2SRV_CHECK_FILE_HANDLE(io->smb2.in.file.ntvfs);
+       SMB2SRV_CALL_NTVFS_BACKEND(ntvfs_ioctl(req->ntvfs, io));
 }
 
 void smb2srv_cancel_recv(struct smb2srv_request *req)