svn commit: samba r15757 - in branches/SAMBA_4_0/source: ntvfs smb_server/smb2

metze at samba.org metze at samba.org
Sat May 20 18:56:12 GMT 2006


Author: metze
Date: 2006-05-20 18:56:08 +0000 (Sat, 20 May 2006)
New Revision: 15757

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15757

Log:
- add RAW_WRITE_SMB2 => generic mapping
- implement SMB2 Write

metze
Modified:
   branches/SAMBA_4_0/source/ntvfs/ntvfs_generic.c
   branches/SAMBA_4_0/source/smb_server/smb2/fileio.c


Changeset:
Modified: branches/SAMBA_4_0/source/ntvfs/ntvfs_generic.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/ntvfs_generic.c	2006-05-20 18:34:59 UTC (rev 15756)
+++ branches/SAMBA_4_0/source/ntvfs/ntvfs_generic.c	2006-05-20 18:56:08 UTC (rev 15757)
@@ -1056,6 +1056,14 @@
 
 	case RAW_WRITE_SPLWRITE:
 		break;
+
+	case RAW_WRITE_SMB2:
+		wr->smb2.out._pad	= 0;
+		wr->smb2.out.nwritten	= wr2->generic.out.nwritten;
+		wr->smb2.out.unknown1	= 0;
+		wr->smb2.out._bug	= 0;
+		break;
+
 	default:
 		return NT_STATUS_INVALID_LEVEL;
 	}
@@ -1131,6 +1139,15 @@
 		wr2->writex.in.data      = wr->splwrite.in.data;
 		status = ntvfs->ops->write(ntvfs, req, wr2);
 		break;
+
+	case RAW_WRITE_SMB2:
+		wr2->writex.in.file.ntvfs= wr->smb2.in.file.ntvfs;
+		wr2->writex.in.offset    = wr->smb2.in.offset;
+		wr2->writex.in.wmode     = 0;
+		wr2->writex.in.remaining = 0;
+		wr2->writex.in.count     = wr->smb2.in.data.length;
+		wr2->writex.in.data      = wr->smb2.in.data.data;
+		status = ntvfs->ops->write(ntvfs, req, wr2);
 	}
 
 	return ntvfs_map_async_finish(req, status);

Modified: branches/SAMBA_4_0/source/smb_server/smb2/fileio.c
===================================================================
--- branches/SAMBA_4_0/source/smb_server/smb2/fileio.c	2006-05-20 18:34:59 UTC (rev 15756)
+++ branches/SAMBA_4_0/source/smb_server/smb2/fileio.c	2006-05-20 18:56:08 UTC (rev 15757)
@@ -127,9 +127,40 @@
 	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)



More information about the samba-cvs mailing list