[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Tue Nov 24 22:48:04 UTC 2015


The branch, master has been updated
       via  2b0df37 s3: docs: Fix "strict rename" doc to match code.
       via  16f2028 s3: smbd: Change semantics of strict rename to search the file open db.
      from  1582006 s3: smbd: have_file_open_below() fails to enumerate open files below an open directory handle.

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 2b0df3788aaadcf907de15a6b6a518244c59aa81
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Nov 24 08:45:50 2015 -0800

    s3: docs: Fix "strict rename" doc to match code.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11065
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue Nov 24 23:47:19 CET 2015 on sn-devel-104

commit 16f202871ca850bec87e0ec243644b2c20266c44
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Nov 24 08:43:14 2015 -0800

    s3: smbd: Change semantics of strict rename to search the file open db.
    
    Without strict rename just look in local process. POSIX renames are
    already dealt with above.
    
    Documentation change to follow.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11065
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 docs-xml/smbdotconf/tuning/strictrename.xml | 15 ++++++++++++---
 source3/smbd/dir.c                          |  2 +-
 source3/smbd/proto.h                        |  2 ++
 source3/smbd/reply.c                        | 12 +++++++++++-
 4 files changed, 26 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/smbdotconf/tuning/strictrename.xml b/docs-xml/smbdotconf/tuning/strictrename.xml
index 5478863..91572f2 100644
--- a/docs-xml/smbdotconf/tuning/strictrename.xml
+++ b/docs-xml/smbdotconf/tuning/strictrename.xml
@@ -15,9 +15,18 @@
     Samba system the cost is even greater than the non-clustered
     case.</para>
 
-    <para>For this reason the default is "no", and it is recommended
-    to be left that way unless a specific Windows application requires
-    it to be changed.</para>
+    <para>When set to "no" smbd only checks the local process
+    the client is attached to for open files below a directory
+    being renamed, instead of checking for open files across all
+    smbd processes.</para>
+
+    <para>Because of the expense in fully searching the database,
+    the default is "no", and it is recommended to be left that way
+    unless a specific Windows application requires it to be changed.</para>
+
+    <para>If the client has requested UNIX extensions (POSIX
+    pathnames) then renames are always allowed and this parameter
+    has no effect.</para>
 
 </description>
 
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 2ab3768..ad57294 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -1963,7 +1963,7 @@ static int have_file_open_below_fn(struct file_id fid,
 	return 1;
 }
 
-static bool have_file_open_below(connection_struct *conn,
+bool have_file_open_below(connection_struct *conn,
 				 const struct smb_filename *name)
 {
 	struct have_file_open_below_state state = {
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index be51182..55e8286 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -232,6 +232,8 @@ long TellDir(struct smb_Dir *dirp);
 bool SearchDir(struct smb_Dir *dirp, const char *name, long *poffset);
 NTSTATUS can_delete_directory(struct connection_struct *conn,
 				const char *dirname);
+bool have_file_open_below(connection_struct *conn,
+			const struct smb_filename *name);
 
 /* The following definitions come from smbd/dmapi.c  */
 
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index c437135..efef613 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -2676,7 +2676,17 @@ static NTSTATUS can_rename(connection_struct *conn, files_struct *fsp,
 		/* If no pathnames are open below this
 		   directory, allow the rename. */
 
-		if (file_find_subpath(fsp)) {
+		if (lp_strict_rename(SNUM(conn))) {
+			/*
+			 * Strict rename, check open file db.
+			 */
+			if (have_file_open_below(fsp->conn, fsp->fsp_name)) {
+				return NT_STATUS_ACCESS_DENIED;
+			}
+		} else if (file_find_subpath(fsp)) {
+			/*
+			 * No strict rename, just look in local process.
+			 */
 			return NT_STATUS_ACCESS_DENIED;
 		}
 		return NT_STATUS_OK;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list