diff options
author | Stefan Metzmacher <metze@samba.org> | 2006-05-20 18:56:08 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:08:14 -0500 |
commit | 772c4928404bc26e5cc7cfdcba1f931ee0d0de82 (patch) | |
tree | bc4b6937c7687cd88a0fa4dca4db5f0c71cf2c14 /source4/smb_server/smb2 | |
parent | 26047265cce081d0190ac781f3eba60fc12a4b60 (diff) | |
download | samba-772c4928404bc26e5cc7cfdcba1f931ee0d0de82.tar.gz samba-772c4928404bc26e5cc7cfdcba1f931ee0d0de82.tar.bz2 samba-772c4928404bc26e5cc7cfdcba1f931ee0d0de82.zip |
r15757: - add RAW_WRITE_SMB2 => generic mapping
- implement SMB2 Write
metze
(This used to be commit 5ab6f304f8b91c0362fd57429cc24126b241bd51)
Diffstat (limited to 'source4/smb_server/smb2')
-rw-r--r-- | source4/smb_server/smb2/fileio.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/source4/smb_server/smb2/fileio.c b/source4/smb_server/smb2/fileio.c index 946f52e90e..2b25cf0af1 100644 --- a/source4/smb_server/smb2/fileio.c +++ b/source4/smb_server/smb2/fileio.c @@ -127,9 +127,40 @@ void smb2srv_read_recv(struct smb2srv_request *req) smb2srv_send_error(req, NT_STATUS_NOT_IMPLEMENTED); } +static void smb2srv_write_send(struct ntvfs_request *ntvfs) +{ + struct smb2srv_request *req; + union smb_write *io; + + SMB2SRV_CHECK_ASYNC_STATUS(io, union smb_write); + SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x10, True, 0)); + + SSVAL(req->out.body, 0x02, io->smb2.out._pad); + SIVAL(req->out.body, 0x04, io->smb2.out.nwritten); + SBVAL(req->out.body, 0x08, io->smb2.out.unknown1); + SCVAL(req->out.body, 0x10, io->smb2.out._bug); + + smb2srv_send_reply(req); +} + void smb2srv_write_recv(struct smb2srv_request *req) { - smb2srv_send_error(req, NT_STATUS_NOT_IMPLEMENTED); + union smb_write *io; + + SMB2SRV_CHECK_BODY_SIZE(req, 0x30, True); + SMB2SRV_TALLOC_IO_PTR(io, union smb_write); + SMB2SRV_SETUP_NTVFS_REQUEST(smb2srv_write_send, NTVFS_ASYNC_STATE_MAY_ASYNC); + + /* TODO: avoid the memcpy */ + io->smb2.level = RAW_WRITE_SMB2; + SMB2SRV_CHECK(smb2_pull_o16s32_blob(&req->in, io, req->in.body+0x02, &io->smb2.in.data)); + 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); + + SMB2SRV_CHECK_FILE_HANDLE(io->smb2.in.file.ntvfs); + SMB2SRV_CALL_NTVFS_BACKEND(ntvfs_write(req->ntvfs, io)); } void smb2srv_lock_recv(struct smb2srv_request *req) |