diff options
Diffstat (limited to 'source4/smb_server/smb2')
-rw-r--r-- | source4/smb_server/smb2/fileio.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/source4/smb_server/smb2/fileio.c b/source4/smb_server/smb2/fileio.c index e46a42c2d8..d190049631 100644 --- a/source4/smb_server/smb2/fileio.c +++ b/source4/smb_server/smb2/fileio.c @@ -148,9 +148,47 @@ void smb2srv_flush_recv(struct smb2srv_request *req) SMB2SRV_CALL_NTVFS_BACKEND(ntvfs_flush(req->ntvfs, io)); } +static void smb2srv_read_send(struct ntvfs_request *ntvfs) +{ + struct smb2srv_request *req; + union smb_read *io; + + SMB2SRV_CHECK_ASYNC_STATUS(io, union smb_read); + SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x10, True, 0)); + + SMB2SRV_CHECK(smb2_push_o16s32_blob(&req->out, 0x02, io->smb2.out.data)); + SBVAL(req->out.body, 0x08, io->smb2.out.unknown1); + SCVAL(req->out.body, 0x10, 0); + + smb2srv_send_reply(req); +} + void smb2srv_read_recv(struct smb2srv_request *req) { - smb2srv_send_error(req, NT_STATUS_NOT_IMPLEMENTED); + union smb_read *io; + + SMB2SRV_CHECK_BODY_SIZE(req, 0x30, True); + SMB2SRV_TALLOC_IO_PTR(io, union smb_read); + SMB2SRV_SETUP_NTVFS_REQUEST(smb2srv_read_send, NTVFS_ASYNC_STATE_MAY_ASYNC); + + io->smb2.level = RAW_READ_SMB2; + io->smb2.in._pad = SVAL(req->in.body, 0x02); + io->smb2.in.length = IVAL(req->in.body, 0x04); + io->smb2.in.offset = BVAL(req->in.body, 0x08); + io->smb2.in.file.ntvfs = smb2srv_pull_handle(req, req->in.body, 0x10); + io->smb2.in.unknown1 = BVAL(req->in.body, 0x20); + io->smb2.in.unknown2 = BVAL(req->in.body, 0x28); + io->smb2.in._bug = CVAL(req->in.body, 0x30); + + SMB2SRV_CHECK_FILE_HANDLE(io->smb2.in.file.ntvfs); + + /* preallocate the buffer for the backends */ + io->smb2.out.data = data_blob_talloc(io, NULL, io->smb2.in.length); + if (io->smb2.out.data.length != io->smb2.in.length) { + SMB2SRV_CHECK(NT_STATUS_NO_MEMORY); + } + + SMB2SRV_CALL_NTVFS_BACKEND(ntvfs_read(req->ntvfs, io)); } static void smb2srv_write_send(struct ntvfs_request *ntvfs) |