svn commit: samba r2930 - in branches/SAMBA_4_0/source/ntvfs/unixuid: .

tridge at samba.org tridge at samba.org
Tue Oct 12 05:59:56 GMT 2004


Author: tridge
Date: 2004-10-12 05:59:56 +0000 (Tue, 12 Oct 2004)
New Revision: 2930

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/ntvfs/unixuid&rev=2930&nolog=1

Log:
added a security context cache to the unixuid module. The module
doesn't actually leave us in the requested sec context between
requests yet, but it does prevent us from doing the samdb lookup on
every packet.

This change speeds up the BASE-MANGLE test against Samba4 with 5000
operations from 61 seconds to 16 seconds. For reference, Samba3 takes
27 seconds for the same test (the string and filename handling in
Samba4 is much more efficient than Samba3)

Modified:
   branches/SAMBA_4_0/source/ntvfs/unixuid/vfs_unixuid.c


Changeset:
Modified: branches/SAMBA_4_0/source/ntvfs/unixuid/vfs_unixuid.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/unixuid/vfs_unixuid.c	2004-10-12 05:36:37 UTC (rev 2929)
+++ branches/SAMBA_4_0/source/ntvfs/unixuid/vfs_unixuid.c	2004-10-12 05:59:56 UTC (rev 2930)
@@ -25,6 +25,8 @@
 
 struct unixuid_private {
 	void *samctx;
+	struct unix_sec_ctx *last_sec_ctx;
+	struct auth_session_info *last_session_info;
 };
 
 
@@ -279,6 +281,7 @@
 static NTSTATUS unixuid_setup_security(struct ntvfs_module_context *ntvfs,
 				       struct smbsrv_request *req, struct unix_sec_ctx **sec)
 {
+	struct unixuid_private *private = ntvfs->private_data;
 	struct auth_serversupplied_info *info = req->session->session_info->server_info;
 	void *ctx = talloc(req, 0);
 	struct unix_sec_ctx *newsec;
@@ -289,10 +292,20 @@
 		return NT_STATUS_NO_MEMORY;
 	}
 
-	status = authinfo_to_unix_security(ntvfs, req, info, &newsec);
-	if (!NT_STATUS_IS_OK(status)) {
-		talloc_free(ctx);
-		return status;
+	if (req->session->session_info == private->last_session_info) {
+		newsec = private->last_sec_ctx;
+	} else {
+		status = authinfo_to_unix_security(ntvfs, req, info, &newsec);
+		if (!NT_STATUS_IS_OK(status)) {
+			talloc_free(ctx);
+			return status;
+		}
+		if (private->last_sec_ctx) {
+			talloc_free(private->last_sec_ctx);
+		}
+		private->last_sec_ctx = newsec;
+		private->last_session_info = req->session->session_info;
+		talloc_steal(private, newsec);
 	}
 
 	status = set_unix_security(newsec);
@@ -340,6 +353,8 @@
 	}
 
 	ntvfs->private_data = private;
+	private->last_sec_ctx = NULL;
+	private->last_session_info = NULL;
 
 	PASS_THRU_REQ(ntvfs, req, connect, (ntvfs, req, sharename));
 
@@ -591,10 +606,13 @@
 static NTSTATUS unixuid_logoff(struct ntvfs_module_context *ntvfs,
 			      struct smbsrv_request *req)
 {
+	struct unixuid_private *private = ntvfs->private_data;
 	NTSTATUS status;
 
 	PASS_THRU_REQ(ntvfs, req, logoff, (ntvfs, req));
 
+	private->last_session_info = NULL;
+
 	return status;
 }
 



More information about the samba-cvs mailing list