summaryrefslogtreecommitdiff
path: root/source4/smb_server/smb2
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-05-20 19:03:06 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:08:15 -0500
commite23cc70a72e6582e91bcfdaf1d6ed2191e7e23a6 (patch)
tree874e55f837a108229fbd77c3a87a9070d530280b /source4/smb_server/smb2
parentf9ddc0dde562b0976a05fc6ca07ea8c9ce0bd284 (diff)
downloadsamba-e23cc70a72e6582e91bcfdaf1d6ed2191e7e23a6.tar.gz
samba-e23cc70a72e6582e91bcfdaf1d6ed2191e7e23a6.tar.bz2
samba-e23cc70a72e6582e91bcfdaf1d6ed2191e7e23a6.zip
r15760: - add RAW_READ_SMB2 => generic mapping
- Implement SMB2 Read metze (This used to be commit d0ac0c5af44ba5aa8b18106c2ac26c0d194e59b4)
Diffstat (limited to 'source4/smb_server/smb2')
-rw-r--r--source4/smb_server/smb2/fileio.c40
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)