[SCM] Samba Shared Repository - branch v3-6-test updated

Karolin Seeger kseeger at samba.org
Tue Aug 30 13:09:21 MDT 2011


The branch, v3-6-test has been updated
       via  a0a7996 Fix bug 8412 - Microsoft Office 2007 (Microsoft Word) fails to save as on a Samba share with SMB2. (cherry picked from commit dec3b21cd1737b317749e7ebced5aa1c2115ebdf)
      from  2f0a5b4 s3: Use sys_read in fork_domain_child

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -----------------------------------------------------------------
commit a0a799663bd4780bb9f948e2dd0635dadb4e2c40
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Aug 29 16:47:16 2011 -0700

    Fix bug 8412 - Microsoft Office 2007 (Microsoft Word) fails to save as on a Samba share with SMB2. (cherry picked from commit dec3b21cd1737b317749e7ebced5aa1c2115ebdf)

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

Summary of changes:
 source3/smbd/reply.c        |   46 +++++++++++++++++++++++++++++++++++++++++++
 source3/smbd/smb2_setinfo.c |    6 -----
 2 files changed, 46 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 4178f3f..ac450bb 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -5936,6 +5936,47 @@ static void notify_rename(connection_struct *conn, bool is_dir,
 }
 
 /****************************************************************************
+ Returns an error if the parent directory for a filename is open in an
+ incompatible way.
+****************************************************************************/
+
+static NTSTATUS parent_dirname_compatible_open(connection_struct *conn,
+					const struct smb_filename *smb_fname_dst_in)
+{
+	char *parent_dir = NULL;
+	struct smb_filename smb_fname_parent;
+	struct file_id id;
+	files_struct *fsp = NULL;
+	int ret;
+
+	if (!parent_dirname(talloc_tos(), smb_fname_dst_in->base_name,
+			&parent_dir, NULL)) {
+		return NT_STATUS_NO_MEMORY;
+	}
+	ZERO_STRUCT(smb_fname_parent);
+	smb_fname_parent.base_name = parent_dir;
+
+	ret = SMB_VFS_LSTAT(conn, &smb_fname_parent);
+	if (ret == -1) {
+		return map_nt_error_from_unix(errno);
+	}
+
+	/*
+	 * We're only checking on this smbd here, mostly good
+	 * enough.. and will pass tests.
+	 */
+
+	id = vfs_file_id_from_sbuf(conn, &smb_fname_parent.st);
+	for (fsp = file_find_di_first(conn->sconn, id); fsp;
+			fsp = file_find_di_next(fsp)) {
+		if (fsp->access_mask & DELETE_ACCESS) {
+			return NT_STATUS_SHARING_VIOLATION;
+                }
+        }
+	return NT_STATUS_OK;
+}
+
+/****************************************************************************
  Rename an open file - given an fsp.
 ****************************************************************************/
 
@@ -5956,6 +5997,11 @@ NTSTATUS rename_internals_fsp(connection_struct *conn,
 		return status;
 	}
 
+	status = parent_dirname_compatible_open(conn, smb_fname_dst_in);
+	if (!NT_STATUS_IS_OK(status)) {
+		return status;
+	}
+
 	/* Make a copy of the dst smb_fname structs */
 
 	status = copy_smb_filename(ctx, smb_fname_dst_in, &smb_fname_dst);
diff --git a/source3/smbd/smb2_setinfo.c b/source3/smbd/smb2_setinfo.c
index e114940..96b44aa 100644
--- a/source3/smbd/smb2_setinfo.c
+++ b/source3/smbd/smb2_setinfo.c
@@ -219,12 +219,6 @@ static struct tevent_req *smbd_smb2_setinfo_send(TALLOC_CTX *mem_ctx,
 		if (file_info_level == SMB_FILE_RENAME_INFORMATION) {
 			/* SMB2_FILE_RENAME_INFORMATION_INTERNAL == 0xFF00 + in_file_info_class */
 			file_info_level = SMB2_FILE_RENAME_INFORMATION_INTERNAL;
-			if (fsp->oplock_type != FAKE_LEVEL_II_OPLOCK &&
-			    fsp->oplock_type != NO_OPLOCK) {
-				/* No break, but error. */
-				tevent_req_nterror(req, NT_STATUS_SHARING_VIOLATION);
-				return tevent_req_post(req, ev);
-			}
 		}
 
 		if (fsp->fh->fd == -1) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list