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

metze at samba.org metze at samba.org
Sat May 20 17:20:34 GMT 2006


Author: metze
Date: 2006-05-20 17:20:34 +0000 (Sat, 20 May 2006)
New Revision: 15754

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

Log:
- implement SMB2 Close
- add RAW_CLOSE_SMB2 generic mapping

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 17:06:28 UTC (rev 15753)
+++ branches/SAMBA_4_0/source/ntvfs/ntvfs_generic.c	2006-05-20 17:20:34 UTC (rev 15754)
@@ -1268,9 +1268,16 @@
 		return NT_STATUS_INVALID_LEVEL;
 
 	case RAW_CLOSE_SPLCLOSE:
-		cl2->close.level	= RAW_CLOSE_CLOSE;
-		cl2->close.in.file.ntvfs= cl->splclose.in.file.ntvfs;
+		cl2->generic.level		= RAW_CLOSE_CLOSE;
+		cl2->generic.in.file.ntvfs	= cl->splclose.in.file.ntvfs;
 		break;
+
+	case RAW_CLOSE_SMB2:
+		cl2->generic.level		= RAW_CLOSE_CLOSE;
+		cl2->generic.in.file.ntvfs	= cl->smb2.in.file.ntvfs;
+		/* SMB2 Close has output parameter, but we just zero them */
+		ZERO_STRUCT(cl->smb2.out);
+		break;
 	}
 
 	/* 

Modified: branches/SAMBA_4_0/source/smb_server/smb2/fileio.c
===================================================================
--- branches/SAMBA_4_0/source/smb_server/smb2/fileio.c	2006-05-20 17:06:28 UTC (rev 15753)
+++ branches/SAMBA_4_0/source/smb_server/smb2/fileio.c	2006-05-20 17:20:34 UTC (rev 15754)
@@ -79,9 +79,42 @@
 	SMB2SRV_CALL_NTVFS_BACKEND(ntvfs_open(req->ntvfs, io));
 }
 
+static void smb2srv_close_send(struct ntvfs_request *ntvfs)
+{
+	struct smb2srv_request *req;
+	union smb_close *io;
+
+	SMB2SRV_CHECK_ASYNC_STATUS(io, union smb_close);
+	SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x3C, False, 0));
+
+	SSVAL(req->out.body,	0x02,	io->smb2.out.flags);
+	SIVAL(req->out.body,	0x04,	io->smb2.out._pad);
+	SBVAL(req->out.body,	0x08,	io->smb2.out.create_time);
+	SBVAL(req->out.body,	0x10,	io->smb2.out.access_time);
+	SBVAL(req->out.body,	0x18,	io->smb2.out.write_time);
+	SBVAL(req->out.body,	0x20,	io->smb2.out.change_time);
+	SBVAL(req->out.body,	0x28,	io->smb2.out.alloc_size);
+	SBVAL(req->out.body,	0x30,	io->smb2.out.size);
+	SIVAL(req->out.body,	0x38,	io->smb2.out.file_attr);
+
+	smb2srv_send_reply(req);
+}
+
 void smb2srv_close_recv(struct smb2srv_request *req)
 {
-	smb2srv_send_error(req, NT_STATUS_NOT_IMPLEMENTED);
+	union smb_close *io;
+
+	SMB2SRV_CHECK_BODY_SIZE(req, 0x18, False);
+	SMB2SRV_TALLOC_IO_PTR(io, union smb_close);
+	SMB2SRV_SETUP_NTVFS_REQUEST(smb2srv_close_send, NTVFS_ASYNC_STATE_MAY_ASYNC);
+
+	io->smb2.level			= RAW_CLOSE_SMB2;
+	io->smb2.in.flags		= SVAL(req->in.body, 0x02);
+	io->smb2.in._pad		= IVAL(req->in.body, 0x04);
+	io->smb2.in.file.ntvfs		= smb2srv_pull_handle(req, req->in.body, 0x08);
+
+	SMB2SRV_CHECK_FILE_HANDLE(io->smb2.in.file.ntvfs);
+	SMB2SRV_CALL_NTVFS_BACKEND(ntvfs_close(req->ntvfs, io));
 }
 
 void smb2srv_flush_recv(struct smb2srv_request *req)



More information about the samba-cvs mailing list